mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
const ccxt = require ('ccxt')
|
||||
, SocksProxyAgent = require ('socks-proxy-agent')
|
||||
, socks = 'socks://127.0.0.1:7000'
|
||||
, socksAgent = new SocksProxyAgent (socks)
|
||||
, exchange = new ccxt.binance ({
|
||||
enableRatLimit: true,
|
||||
httpsAgent: socksAgent, // ←--------------------- socksAgent here
|
||||
options: {
|
||||
'ws': {
|
||||
'options': { agent: socksAgent }, // ←--- socksAgent here
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
;(async () => {
|
||||
console.log (socks)
|
||||
const symbol = 'BTC/USDT'
|
||||
await exchange.loadMarkets ()
|
||||
console.log ('Markets loaded')
|
||||
while (true) {
|
||||
try {
|
||||
const orderbook = await exchange.watchOrderBook (symbol)
|
||||
console.log (exchange.iso8601 (exchange.milliseconds()), symbol, orderbook['asks'][0], orderbook['bids'][0])
|
||||
} catch (e) {
|
||||
console.log (e.constructor.name, e.message)
|
||||
}
|
||||
}
|
||||
}) ()
|
||||
Reference in New Issue
Block a user