GithubHelp home page GithubHelp logo

depth_chart's Introduction

depth_chart

depth_chart is a chart for displaying orderbook timeseries data. Each price level is displayed as a channel that is more or less filled depending on how many orders are open at that level. The principles of the horizontal chart are used to increase the range of displayable values. Trades are displayed as red or blue intermissions.

#Using

##Creating a chart

<canvas id="mychartid" width=900 height=900>
<script type="text/javascript" src="moving_window.js"></script>
<script type="text/javascript" src="depth_chart.js"></script>
<script type="text/javascript">
tickToPrice = function (x) {return x*0.1;} // Ticksize of 0.1
var myChart = new DepthChart ("mychartid", tickToPrice);
</script>

##Adding a orderbook snapshot

var snapshot = {};
snapshot.time = 0; // In nanos
// List of [price, tick, volume] triplets
snapshot.asks = [[101.1, 1011, 0.3], [101.2, 1012, 0.4]];
snapshot.bids = [[100.9, 1009, 0.26], [100.7, 1007, 0.82]];
myChart.add(snapshot);

##Adding a trade

var trade = {};
trade.time = 1000;
trade.sellerActive = false;
trade.volume = 0.3;
trade.price = 101.1;
trade.tick = 1011;
myChart.add(trade);

##Rendering This should be done periodically or the chart wont update.

myChart.render ();

depth_chart's People

Contributors

jesperny avatar rickardnorlander avatar

Watchers

James Cloos avatar Mourad Ilyes Mlik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.