Code Monkey home page Code Monkey logo

mextick's Introduction

mextick

Simple example of how to parse historical trade data and emit ticks and aggregate trade bin events (i.e. candlestick bars)

This could be the basis needed to build a very accurate backtesting system able to process intrabar price tick events.

Update: added volume to the output bars.

How to use

First thing you need is some trade data which can be downloaded for free as .csv.gz (zipped csv files) found on BitMEX's public cloud archive here:

https://public.bitmex.com/?prefix=data/trade/ IMPORTANT NOTE THIS WEBSITE ONLY SEEMS TO WORK ON THE Chrome WEB BROWSER

Download the files and unzip the CSVs into the trade folder.

Install the dependency

npm install

Import the module:

    const Aggregate = require('./Aggregate');

Instantiate the object, passing:

  1. the folder containing the csv files you downloaded
  2. the bar resolution you want e.g. 1h, 4h, 15m etc (see Aggregate.js for more info)
let agg = new Aggregate({ files: './trade', resolution: '1h' });

Then subscribe to the events, both optional, that the Aggregate class will fire:

    agg.on('bar', bar => { /* do whatever with your bar */ });

    agg.on('tick', tick => { /* do whatever with your tick */ });

Finally, start the system, specifying which symbol you're interested in. Note that all of the BitMEX symbols are supported!:

    agg.start('ETHUSD');

Notes:

The system processes every single file in the trade folder in order.

mextick's People

Contributors

azidyn avatar

Watchers

James Cloos 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.