1.5.2 • Published 3 years ago

gdax-sim v1.5.2

Weekly downloads
7
License
AGPL-3.0-or-later
Repository
github
Last release
3 years ago

gdax-sim

Simulator used to help unit test and back test various Coinbase-Pro (gdax) interactions.

Install

npm i gdax-sim

Backtest

Reads data from saved candle objects and spits out matches 4 matches, one for open, one for the high, one for the low, and one for the close.

  • If open >= close, the high will be 'sent' second and the low third
  • If close > open, the low will be 'sent' second and the high third
    • Settings to change this will come later
  • Dispatches matches and dones based off of user orders to better replicate actual behavior
  • If there is a gap in teh data the time is filled with 1 heartbeat message per minute

Example Code

const ApiSim = require('gdax-sim)
let gdax = new ApiSim({
        quote_balance: 10,
        base_balance: 10,
        taker_fee: 0.5,
        hour_start_on: 30,
      }); //set base account (quote_balance-base_balance) taker_fee (in %), an when to start hourly candles
gdax.pair = 'LTC-USD';//set the name of the pair
gdax.websocketClient.on('message', (data) => {
  //your code to handle behavior upon recieving a message on the websocket
});

//function to run after all mesages generated by the specific data set have been disbatched
gdax.afterSession = () =>{
  console.log(gdax.user.fiatBalance, gdax.user.cryptoBalance);
}

//start the backtest
gdax.backtest(require('./TestData/LTC/27Nov2018.json').{
            start_time: "0000", //starts candles and events when >=
            end_time: "2460"    //stops when 24 hour time is less than
          });

Currnet API Endpoints

  • Buy
    • limit and market
  • Sell
    • limit and market
  • cancelOrder
    • limit only
  • getOrder
  • getHistoricRates
    • takes 'granularity'
    • takes 'end'

Coming Soon

  • Get Accounts
  • Get Balance
  • Multi-asset web socket

Unit Test

Done using a global install of Mocha

gdax-sim> mocha

Dev Blog

DownToCrypto.com

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.16

4 years ago

1.0.15

5 years ago

1.0.13

5 years ago

1.0.14

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago