# binoc

> Technical analysis framework for Binance

Latest version **0.2.0** (published 2023-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install binoc
pnpm add binoc
yarn add binoc
bun add binoc
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-05-23 |
| First published | 2023-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | James Reed |
| Maintainers | jcrd |

## Links

- npm: https://www.npmjs.com/package/binoc
- Repository: https://github.com/jcrd/binoc
- Issues: https://github.com/jcrd/binoc/issues
- npm.io page: https://npm.io/package/binoc

## Dependencies (1)

- [@binance/connector](https://npm.io/package/@binance/connector.md) ^3.0.0-rc.2

## Recent versions

- 0.2.0 (latest) — 2023-05-23
- 0.1.3 — 2023-05-11

## README

# binoc

> See the future in the past 🔮

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

## Features

- Flexible strategy definition
- Bring-your-own indicators
- Backtesting using [historical candlestick data][rest]
- Realtime signalling using [candlestick data streams][ws]

[binance]: https://www.binance.us/
[rest]: https://docs.binance.us/#get-candlestick-data
[ws]: https://docs.binance.us/#candlestick-data-stream

## Installation

```sh
npm install binoc
```

## Usage

```js
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](LICENSE)).

---
_Source: https://npm.io/package/binoc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
