0.2.0 • Published 12 months ago

binoc v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

binoc

See the future in the past 🔮

binoc is a JavaScript library for technical analysis on the Binance exchange.

Features

Installation

npm install binoc

Usage

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()

License

This project is licensed under the MIT License (see LICENSE).

0.2.0

12 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago