Hackable charting lib for traders. You can draw literally ANYTHING on top of candlestick charts. [Not Maintained]
Hackable charting lib for traders. You can draw literally ANYTHING on top of candlestick charts. [Not Maintained]
TradingVue.js was a hackable charting lib for traders. You could draw literally ANYTHING on top of candlestick charts. [Not Maintained]
If you create trading software - this lib is probably for you. If you like to make custom indicators and think out of the box - this lib is most likely for you. And if you miss usability of TradingView.com in other open-source libraries and can't stand it - you are definetly in the right place!
To run the examples, download the repo & npm run test
NPM
npm i trading-vue-jsIn browser
<script src="trading-vue.min.js"></script>Minimal working example:
<template>
<trading-vue :data="this.$data"></trading-vue>
</template>
<script>
import TradingVue from 'trading-vue-js'
export default {
name: 'app',
components: { TradingVue },
data() {
return {
ohlcv: [
[ 1551128400000, 33, 37.1, 14, 14, 196 ],
[ 1551132000000, 13.7, 30, 6.6, 30, 206 ],
[ 1551135600000, 29.9, 33, 21.3, 21.8, 74 ],
[ 1551139200000, 21.7, 25.9, 18, 24, 140 ],
[ 1551142800000, 24.1, 24.1, 24, 24.1, 29 ],
]
}
}
}
</script>The core philosophy is Data -> Screen Mapping (DSM). The library provides you with functions that map your data (it could be anything) to screen coordinates. The lib does all the dirty work behind the scenes: scrolling, scaling, reactivity, etc.
layout.t2screen(t) // time -> x
layout.$2screen($) // price -> y
layout.t_magnet(t) // time -> nearest candle x
layout.screen2$(y) // y -> price
layout.screen2t(x) // x -> timeUsing these functions and the standard js canvas API, you can do magic.
PRO TIP: chart is mandatory if you want to see something other than a white screen
IMPORTANT: All data must be sorted by time (in ascending order). The main OHLCV must not contain duplicate timestamps.
…The process of adding a new indicator is simple: first you define your own data format (should be timestamped though) and display settings. For example, EMA data might look like this:
{
"name": "EMA, 25",
"type": "EMA",
"data": [
[ 1551128400000, 3091 ],
[ 1551132000000, 3112 ],
[ 1551135600000, 3105 ]
],
"settings": {
"color": "#42b28a"
}
},
And then you make a new overlay class to display that data on the grid:
…That's why the title doesn't lie: you can draw ANYTHING.
Progress in details: https://github.com/tvjsx/trading-vue-js/projects/1
See CHANGELOG.md
Install devDependencies
npm installRun development enviroment (hot)
npm run devServer is running on http://localhost:8080
Run in a CDN-like mode
npm run cdnServer is running on http://localhost:8080
Build the bundle
npm run buildVisual testing
npm run testServer is running on http://localhost:8080
Automatic testing
npm run auto-testgit checkout -b cool-new-feature)git commit -am 'Let's rock smth')git push origin cool-new-feature)Please read the guidelines in CONTRIBUTING.md
No open issues yet, or sync has not completed.