All Projects → evilive3000 → poloniex-orderbook

evilive3000 / poloniex-orderbook

Licence: other
Poloniex Orderbook manager

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to poloniex-orderbook

cryptoviz
A web-based Depth-Of-Market visualization for data of the Poloniex cryptocurrency exchange.
Stars: ✭ 65 (+80.56%)
Mutual labels:  poloniex, orderbook
Crypto vba
An Excel/VBA project to communicate with various cryptocurrency exchanges APIs
Stars: ✭ 103 (+186.11%)
Mutual labels:  btc, poloniex
My Token
📈Track token prices of your favorite exchanges in terminal!
Stars: ✭ 141 (+291.67%)
Mutual labels:  btc, poloniex
Goex
Exchange Rest And WebSocket API For Golang Wrapper support okcoin,okex,huobi,hbdm,bitmex,coinex,poloniex,bitfinex,bitstamp,binance,kraken,bithumb,zb,hitbtc,fcoin, coinbene
Stars: ✭ 1,188 (+3200%)
Mutual labels:  btc, poloniex
Pololender
Free, open source, high performance bot for lending funds on Poloniex exchange
Stars: ✭ 163 (+352.78%)
Mutual labels:  btc, poloniex
Btcbf
Bitcoin private key brute force tool, written in python. Also can be used as a bitcoin wallet generator.
Stars: ✭ 91 (+152.78%)
Mutual labels:  btc
bitcoin-kit-android
Comprehensive Bitcoin development library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash, Litecoin and Dash blockchains. Fully compliant with existing standards and BIPs.
Stars: ✭ 102 (+183.33%)
Mutual labels:  btc
Open Crypto Tracker
Bitcoin / Alts private portfolio tracker, with email / text / alexa / telegram price alerts, charts, leverage support and much more.
Stars: ✭ 59 (+63.89%)
Mutual labels:  btc
GoogleConsole CPUminer
free miner for google cloud shell
Stars: ✭ 14 (-61.11%)
Mutual labels:  btc
Bitcoin-wallet-cracker
Automated Bitcoin wallet generator that with mnemonic and passphrases bruteforces wallet addresses
Stars: ✭ 140 (+288.89%)
Mutual labels:  btc
marconibot
Marco... Polo - Poloni.... Marconi... Poloniex Trade bot
Stars: ✭ 24 (-33.33%)
Mutual labels:  poloniex
HTML-Crypto-Currency-Chart-Snippets
💹 Simple HTML Snippets to create Tickers / Charts of Cryptocurrencies with the TradingView API 💹
Stars: ✭ 89 (+147.22%)
Mutual labels:  btc
Coinbase.Pro
📈 A .NET/C# implementation of the Coinbase Pro API.
Stars: ✭ 63 (+75%)
Mutual labels:  orderbook
trader
a ping pong and maker/taker order bot for trading cryptocurrency on Waves Exchange, Poloniex, Bittrex, and Binance
Stars: ✭ 23 (-36.11%)
Mutual labels:  poloniex
coinbash
💰 A bash script (CLI) for displaying crypto currencies market data in a terminal 🖥
Stars: ✭ 110 (+205.56%)
Mutual labels:  btc
Welcome
Welcome to PTDefender
Stars: ✭ 27 (-25%)
Mutual labels:  poloniex
pybtcturk
Python client for the Btcturk api
Stars: ✭ 26 (-27.78%)
Mutual labels:  btc
coinaly
🚀 Fast and easy to use mobile trade interface for cryptocurrencies. Track your trades to the moon and beyond. Currently only for Bittrex.
Stars: ✭ 32 (-11.11%)
Mutual labels:  btc
nordnet
Uonfficial wrapper for financial data api from the Scandinavian broker Nordnet
Stars: ✭ 13 (-63.89%)
Mutual labels:  orderbook
orderbook
A fast L2/L3 orderbook data structure, in C, for Python
Stars: ✭ 101 (+180.56%)
Mutual labels:  orderbook

Poloniex Orderbook

npm GitHub tag GitHub stars

!!! Read it !!!

Since August 2017 Poloniex added anti-bot protection for their site and websocket connection which were used in this library. If you want to go on with poloniex-orderbook you will have to do extra workaround to make it work. Otherwise you're left with another option is to use official poloniex api (which I'm not support here).

Module for creating and maintaining Poloniex's orderbook on server side.

  • From v3.0 I switched from pushAPI to WebScoket based API, it's made intaraction with poloniex much faster.
  • From v3.2 we have to deal with Poloniex's anti-bot protection. Or refuse to use this lib and return to official API.

Installation

$ npm install poloniex-orderbook

Usage

Requires nodejs => 6.0

Create file headers.json and fill it with your User-Agent and cf_clearance cookie. You should grab this information from your browser.

{
  "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36",
  "Cookie": "cf_clearance=7332b18714d3aa45aed82424e50cf166d6093c6f-1501832791-1800"
}

As I can suggest this cookie gives you a window in 30 minutes to connects. It's mean you can coonect many times in this time frame, then you have to renew cookie. When ws-connection is set up you can stop worrying about renewing because websocket sends cookies only on connection, so I hope it will last until you decide to reconnect. Yes, it's very inconvenient, but that's all I can offer you now.

The central part of the lib is PoloManager. This class holds socket connection and PairMarket instances, and connects them between.

const PoloManager = require('poloniex-orderbook');
const poloman = new PoloManager().connect({ 
  headers: require('./headers.json') 
});

// call connect to initiate socket connection
poloman.connect();

Now you can set event handlers:

poloman.on('change', info => { /* info = {channel, side, rate, amount}*/});
poloman.on('error', info => { /* info = {msg} */});

initiate markets:

poloman.market('BTC_ETH');

remove markets:

poloman.remove('BTC_ETH');

get access to markets orderbooks:

// take first
poloman.market('BTC_ETH').asks[0];

// top 5
poloman.market('BTC_ETH').bids.slice(0, 5);

close connection:

poloman.disconnect();

Note:

  • You HAVE to set Error handler otherwise the script will throw an Error and exit if error event will occur. (see: Node.js ErrorEvents)
  • For debug purposes run with DEBUG=* variable.

Example

const PoloManager = require('poloniex-orderbook');
const poloman = new PoloManager().connect({ 
  headers: require('./headers.json') 
});

poloman.on('error', err => console.log(err));

poloman.on('change', info => {
  const {channel, side} = info;
  const market = poloman.market(channel);
  const top5 = market[side].slice(0, 5);

  console.log(`${side.toUpperCase()} :: ${market.seq}`);
  console.log(top5);
});

poloman.market('BTC_ETC');

// 5 seconds later
setTimeout(() => {
  //poloman.disconnect();
}, 5000);

you should get the output:

ASKS :: 132227424
[ [ '0.00178668', '412.77676591' ],
  [ '0.00178684', '99.99000000' ],
  [ '0.00178685', '10.85537516' ],
  [ '0.00178700', '0.23521517' ],
  [ '0.00179312', '1156.41500000' ] ]
ASKS :: 132227424
[ [ '0.00178668', '412.77676591' ],
  [ '0.00178684', '99.99000000' ],
  [ '0.00178685', '10.85537516' ],
  [ '0.00178700', '0.23521517' ],
  [ '0.00179312', '1156.41500000' ] ]
BIDS :: 132227425
[ [ '0.00178665', '1028.38378169' ],
  [ '0.00178610', '3400.02648465' ],
  [ '0.00178600', '177.11520540' ],
  [ '0.00178278', '179.50264208' ],
  [ '0.00178277', '10.93802113' ] ]

Contacts

If you have some suggestions please email me: [email protected]

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].