import "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js";
import { CIQ } from "https://jsfiddle.chartiq.com/chart/js/advanced.js";
import "https://jsfiddle.chartiq.com/chart/js/componentUI.js";
import "https://jsfiddle.chartiq.com/chart/js/components.js";
import "https://jsfiddle.chartiq.com/chart/plugins/activetrader/cryptoiq.js";
// Activate the License Key
import getLicenseKey from "https://jsfiddle.chartiq.com/chart/key.js";
getLicenseKey(CIQ);
// instantiate a chart engine
// this is needed to load and manage the L2 data
const stxx = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer")
});
// configure settings. For example decimal places.
stxx.chart.panel.decimalPlaces = 4;
// initialize the UI context
new CIQ.UI.Context(stxx, document.querySelector("cq-context,[cq-context]"));
// setup the Trade data.
// These are the minimum required elements for trade history,
// but this object can also include all of the other L2 data required
// for the order book and market depth charts)
const dataSet1 = {
DT: new Date(),
Last: 30.43,
LastSize: 75,
LastTime: new Date(),
}
const dataSet2 = {
DT: new Date(),
Last: 25.48,
LastSize: 53,
LastTime: new Date(),
}
const dataSet3 = {
DT: new Date(),
Last: 25.12,
LastSize: 254,
LastTime: new Date(),
}
const dataSet4 = {
DT: new Date(),
Last: 42.87,
LastSize: 129,
LastTime: new Date(),
}
// Call this line as often as you wish to refresh the data.
stxx.updateCurrentMarketData(dataSet1);
setTimeout(function() {
console.log('Update data 2.')
stxx.updateCurrentMarketData(dataSet2);
}, 2500);
setTimeout(function() {
console.log('Update data 3.')
stxx.updateCurrentMarketData(dataSet3);
}, 5000);
setTimeout(function() {
console.log('Update data 4.')
stxx.updateCurrentMarketData(dataSet4);
}, 7500);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.