Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.

Fixes for Quadriga CX trading #386

Merged
merged 7 commits into from
Jul 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions extensions/exchanges/quadriga/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = function container(get, set, clear) {
name: 'quadriga',
historyScan: 'backward',
makerFee: 0.5,
takerFee: 0.5,

getProducts: function() {
return require('./products.json')
Expand All @@ -63,21 +64,23 @@ module.exports = function container(get, set, clear) {
}

var client = publicClient()
client.api('transactions', args, function(err, trades) {
client.api('transactions', args, function(err, body) {
if (!shownWarnings) {
console.log('please note: the quadriga api does not support backfilling (trade/paper only).')
console.log('please note: make sure to set the period to 1h')
console.log('please note: the quadriga api does not support backfilling.')
console.log('please note: periods should be set to 1h or less.');
shownWarnings = true;
}

if (err) return retry('getTrades', func_args, err)
if (trades.error) return retry('getTrades', func_args, trades.error)
if (body.error) return retry('getTrades', func_args, trades.error)

var trades = trades.map(function(trade) {
var trades = body.filter(t => {
return (typeof opts.from === 'undefined') ? true : (moment.unix(t.date).valueOf() > opts.from)
}).reverse().map(function(trade) {
return {
trade_id: trade.tid,
time: moment.unix(trade.date).valueOf(),
size: trade.amount,
size: Number(trade.amount),
price: trade.price,
side: trade.side
}
Expand Down