See the future in the past ๐ฎ
binoc is a JavaScript library for technical analysis on the Binance exchange.
- Flexible strategy definition
- Bring-your-own indicators
- Backtesting using historical candlestick data
- Realtime signalling using candlestick data streams
npm install binoc
import { Strategy } from "binoc"
import { SMA, WMA } from "@debut/indicators"
// Define a strategy.
const strategy = new Strategy({
symbol: "BNBUSD",
indicators: [
{
name: "SMA20_1m",
interval: "1m",
indicator: new SMA(20),
signal: (v, close) => [close > v, { v, close }],
minimumValues: 20,
},
{
name: "WMA20_1m",
interval: "1m",
indicator: new WMA(20),
signal: (v, close) => [close > v, { v, close }],
minimumValues: 20,
},
],
})
// Backtest a strategy given a timestamp and expected signal.
const [result, state] = await strategy.backtest(1683685980000, false)
// Run a strategy for realtime signalling.
await strategy.run(([signal, state]) => {
console.log(signal, state)
})
strategy.stop()
This project is licensed under the MIT License (see LICENSE).