webtrader-charts
The charting library extracted from Webtrader.
See Demo
How to use it
Use npm / yarn
npm install --save webtrader-charts
yarn add webtrader-charts
You need to provide these dependences jquery
, moment
and highstock#5.0.x
.
Take a look at webpack.config.js -> externals
.
Basic usage
import wtcharts from 'webtrader-charts';
wtcharts.init({
appId: 11,
lang: 'en',
server: 'wss://ws.binaryws.com/websockets/v3'
});
const chart = wtcharts.chartWindow.addNewChart($parent, {
"type": "line",
"timePeriod": "1m",
"instrumentCode": "RDBULL",
"instrumentName": "Bull Market Index",
"showInstrumentName": true,
"showOverlays": false,
"showShare": false,
"indicators": [
{
"id": "cks",
"name": "Chande Kroll Stop",
"options": {
"period": 10,
"maxMinPeriod": 20,
"multiplier": 3,
"longStopStroke": "#00C176",
"shortStopStroke": "#FF003C",
"strokeWidth": 1,
"dashStyle": "Solid"
}
},
],
"overlays": [ ],
"timezoneOffset": 0,
});
chart.events.anyChange = () => {
console.warn(chart.data());
};
chart.actions.reflow();
chart.actions.refresh();
chart.actions.destroy();
Displaying trade results (Exprimental)
Note: This is an exprimental api, it might change in future releases.
chart.darw.startTime(epoch);
chart.draw.endTime(epoch);
chart.draw.entrySpot(epoch);
chart.draw.exitSpot(epoch);
chart.draw.barrier({value: value});
How to extend it
- Clone the repo
- Change
webpack.config.js
to write the output into /example
folder. yarn install
on both main project and /example
folder.yarn watch
on main project.yarn watch
on /example
folder.- Open
localhost:8080
building translations
- Run
yarn build-translation
to get dictionary.json
file. - The language files
/src/i18/{lang}.json
files. - The library uses the generated
dictionary.json
file.
deploying to gh-pages
yarn deploy-example
to deploy the /example
folder.yarn deploy-hard
to deploy latest version embedded in binary-static (for testing)yarn deploy-soft
same as yarn deploy-hard
(use it the second time you are deploying).app-id
for aminroosta.github.io/binary-static
is 7770