zenbotを試してみる。 (3)
products.json
[ { "asset": "BTC", "currency": "JPY", "min_size": "0.005", "max_size": "2000.0", "increment": "0.0001", "label": "BTC/JPY" }, { "asset": "FX_BTC", "currency": "JPY", "min_size": "0.005", "max_size": "2000.0", "increment": "0.0001", "label": "FX_BTC/JPY" } ]
exchange.js
ふぉ
const pri = require('blac/lightning/builder/pub.js') const moment = require('moment')
はっ
function joinProduct (product_id) { return product_id.split('-')[0] + '_' + product_id.split('-')[1] }
ふぉっふぉ
getTrades: function (opts, cb) { if (!pair) { pair = joinProduct(opts.product_id) } // Backfilling using the REST API if (opts.to || opts.to === null) { //var func_args = [].slice.call(arguments) if(!opts.from) { opts.from = 1 } if(!opts.to) { opts.to = 999999999 } body = new pri.getexecutions() .product_code(pair) .count(1000) .before(opts.to) .after(opts.from) .executeSync(); var trades = body.map(function(trade) { return { trade_id: trade.id, time: moment(trade.exec_date).valueOf(), size: trade.size, price: trade.price, side: trade.side == 'BUY' ? 'buy' : 'sell' } }) cb(null, trades) } else { console.log("???") } }
ほいっ
getCursor: function (trade) { return (trade.trade_id || trade) }