sand-ex
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

SandEx

npm DeepScan grade Coverage Status

SandEx allow you to backtest your trading strategies and order execution in a simple way, or replay your trades based on OHLCV input.

Basic Usage:

import SandExchange from 'sand-ex';

const exchangeOptions = {
  balanceAsset: 1.0,
  balanceQuote: 20000.0,
  fee: 0.00075,
 // feeMaker: 0.00075, // Optional
 // feeTaker: 0.00075, // Optional
 // candleData: OHLCV[]; // Optional
 // candlePrice?: CandlePrice; // Optional , Default: Close
};

const Exchange = new SandExchange(exchangeOptions);

Update([time,open,high,low,close]):

Update Exchange with OHLCV candleStick

Exchange.update([1569160500000, 9977.09, 9992.3, 9972.63, 9986.24, 56.127912]);

nextTick():

If you have CandleData[] as input you can replay tick to tick

Exchange.nextTick();

getBalance():

Exchange.getBalance();

createNewOrder({orderDetails}):

Exchange.createNewOrder({
side: 'BUY',
type: 'LIMIT,
price: 10000,
quantity: 0.8,
});

cancelOrder(orderId):

Exchange.cancelOrder(1);

getOrders():

Get All Orders (New,Filled,Canceled)

Exchange.getOrders();

Dependents (0)

Package Sidebar

Install

npm i sand-ex

Weekly Downloads

9

Version

0.1.8

License

ISC

Unpacked Size

19.3 kB

Total Files

9

Last publish

Collaborators

  • palabola