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

Commit

Permalink
Fixes for Quadriga CX trading (#386)
Browse files Browse the repository at this point in the history
* Quadriga CX Fixes

* Add amount for takers fee
* Minor update to backfill warning text
* Fix variable shadowing error
* Trades with the same timestamp are now ordered oldest to newest when r eturned from getTrades
* Trade volume now returned as number and not a string, prevents NaN on volume report
* Filter results on timestamp start to prevent re-reporting the same trades in the results

* Sometime opts.from is undefined, and we should return all results.

* Formatting
  • Loading branch information
cmroche authored and DeviaVir committed Jul 18, 2017
1 parent bdf4ed9 commit 21e2133
Showing 1 changed file with 9 additions and 6 deletions.
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

0 comments on commit 21e2133

Please sign in to comment.