All Projects → valamidev → candlestick-convert

valamidev / candlestick-convert

Licence: MIT license
[NPM] OHLCV Candlestick Batcher/Converter

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to candlestick-convert

TAcharts
Apply popular TA tools and charts to candlestick data with NumPy.
Stars: ✭ 131 (+235.9%)
Mutual labels:  ohlc, ohlcv
AdvancedTimer
AdvancedTimer implementation for Xamarin.Forms This repo is no longer maintained. New repo available.
Stars: ✭ 40 (+2.56%)
Mutual labels:  interval
numeric
numeric facilities for C++ 14; dual numbers, dual quaternions, constrained numbers, intervals
Stars: ✭ 21 (-46.15%)
Mutual labels:  interval
chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (-61.54%)
Mutual labels:  interval
task-bundle
Scheduling of tasks for symfony made simple
Stars: ✭ 33 (-15.38%)
Mutual labels:  interval
kdb-tick
Latest source files for kdb+tick
Stars: ✭ 73 (+87.18%)
Mutual labels:  tick
cryptoquant
An Quantatitive trading library for crypto-assets 数字货币量化交易框架
Stars: ✭ 96 (+146.15%)
Mutual labels:  ccxt
rust-lapper
Rust implementation of a fast, easy, interval tree library nim-lapper
Stars: ✭ 39 (+0%)
Mutual labels:  interval
Customizable-Crypto-Currency-Dashboard-with-Chart
📺 A Dashboard with the price movements of the selected Cryptocurrencies 💹
Stars: ✭ 79 (+102.56%)
Mutual labels:  candlestick
irsync
rsync on interval, via command line binary or docker container. Server and IOT builds for pull or push based device content management.
Stars: ✭ 19 (-51.28%)
Mutual labels:  interval
interval-tree
A C++ header only interval tree implementation.
Stars: ✭ 38 (-2.56%)
Mutual labels:  interval
dukascopy-tools
✨ Download historical price tick data for Crypto, Stocks, ETFs, CFDs, Forex via CLI and Node.js ✨
Stars: ✭ 128 (+228.21%)
Mutual labels:  ohlc
interval
This PHP library provides some tools to handle intervals. For instance, you can compute the union or intersection of two intervals.
Stars: ✭ 25 (-35.9%)
Mutual labels:  interval
MLLineChart
A simple Line Chart Lib
Stars: ✭ 28 (-28.21%)
Mutual labels:  chart-library
quick trade
convenient script for trading with python.
Stars: ✭ 63 (+61.54%)
Mutual labels:  ccxt
animate
👾 Create and manage animation functions with AnimationFrame API.
Stars: ✭ 11 (-71.79%)
Mutual labels:  interval
binance-proxy
A websocket proxy written in GoLang, that caches the endpoints: klines, depth, ticker/24hr, and exchangeInfo. It resembles the Binance API behaviour. And has a primary usecase to eliminate ratelimits when querying the Binance API from a single IP.
Stars: ✭ 70 (+79.49%)
Mutual labels:  ccxt
twitter-crypto-bot
This is a Twitter bot that tweets about cryptocurrencies prices every certain amount of minutes
Stars: ✭ 21 (-46.15%)
Mutual labels:  candlestick
fluent-plugin-http-pull
The input plugin of fluentd to pull log from rest api.
Stars: ✭ 19 (-51.28%)
Mutual labels:  interval
MOTE
Magnitude of the Effect - An Effect Size and CI calculator
Stars: ✭ 17 (-56.41%)
Mutual labels:  interval

candlestick-convert

Coverage Status DeepScan grade npm

This package allow you to batch OHLCV candlesticks or creating them from trade(tick) data sets.

Supported formats:

  • OHLCV (CCXT format) [[time,open,high,low,close,volume]]
  • OHLCV JSON [{time: number,open: number, high: number, low: number close: number, volume: number}]
  • Trade JSON [{price: number, quantity: number, time:number}]

Features:

  • Typescript support!
  • CCXT support
  • No Dependencies
  • Performance single loop used
  • Skip missing candles

Important!:

  • Intervals only supported as second integers (1 minute = 60 , 2 minute = 120...)
  • Only positive integer multiplication allowed between base interval and the new interval. e.g. 60->120, 60->180

Install:

npm install candlestick-convert

Available functions:

import {batchCandleArray, batchCandleJSON, batchTicksToCandle, ticksToTickChart} from "candlestick-convert";

batchCandleArray(candledata: OHLCV[], baseInterval = 60, targetInterval = 300, includeOpenCandle = false) 
//return OHLCV[]

batchCandleJSON(candledata: IOHLCV [], 60, 300) 
// return IOHLCV[]

batchTicksToCandle(tradedata: TradeTick[], 60,  includeOpenCandle = false) 
// return IOHLCV[]

ticksToTickChart(tradedata: TradeTick[], 5) 
// return IOHLCV[]

** includeOpenCandle allow to add a lastCandle not full candle based on the available information

Types

export type IOHLCV = {
  time: number;
  open: number;
  high: number;
  low: number;
  close: number;
  volume: number;
}

export type OHLCV = [
  number,
  number,
  number,
  number,
  number,
  number,
]

export type TradeTick = {
  price: number;
  quantity: number;
  time: number;
}

Examples

CCXT OHLCV:

import {batchCandleJSON} from "candlestick-convert";

const link_btc_1m = [
  {
    time: 1563625680000,
    open: 0.00024824,
    high: 0.00024851,
    low: 0.00024798,
    close: 0.00024831,
    volume: 2264
  },
  {
    time: 1563625740000,
    open: 0.00024817,
    high: 0.00024832,
    low: 0.00024795,
    close: 0.00024828,
    volume: 3145
  }];

const baseFrame = 60; // 60 seconds
const newFrame = 120; // 120 seconds

// Convert to 2m Candles

const link_btc_2m = batchCandleJSON(link_btc_1m, baseFrame, newFrame);

Tick Chart:

import {ticksToTickChart, TradeTick} from "candlestick-convert";

const adabnb_trades = [
  {
    time: "1564502620356",
    side: "sell",
    quantity: "4458",
    price: "0.00224",
    tradeId: "1221272"
  },
  {
    time: "1564503133949",
    side: "sell",
    quantity: "3480",
    price: "0.002242",
    tradeId: "1221273"
  },
  {
    time: "1564503134553",
    side: "buy",
    quantity: "51",
    price: "0.002248",
    tradeId: "1221274"
  }];


const filtered_adabnb_trades: TradeTick[] = adabnb_trades.map((trade: any) => ({
  time: trade.time,
  quantity: trade.quantity,
  price: trade.price
}));

const batchSize = 2; // Every TickCandle consist 2 trade
const tickChart = ticksToTickChart(filtered_adabnb_trades, batchSize);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].