question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetchTicker() en masse incorrect treatment of base/quote volume

See original GitHub issue

Looks like a result of copypaste which is spread over all exchanges.

I don’t think it wise to check with all the API docs for all exchanges to determine if they indeed return base or quote. I believe it would be quite safe to assume that if exchange provides only one volume than treat it as baseVolume rather than quoteVolume.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mkutnycommented, Oct 7, 2017

Actually, I just ran a simple smoke test on 1.9.59 (just BTC/USD pair):

'use strict'

const ccxt = require ('ccxt');
const exchanges = ccxt.exchanges;

(async () => {
for (let i = 0; i < exchanges.length; i++) {
  const id = exchanges[i];
  const exchange = new ccxt[id] ();
  try {
    const ticker = await exchange.fetchTicker('BTC/USD');
    if (ticker.baseVolume == undefined || ticker.baseVolume > ticker.quoteVolume) {
      console.log(id, ticker.baseVolume, ticker.quoteVolume);
    }
  } catch (e) {
    // these don't quote in USD (or just not accessible)
  }
}
}) ();

What I’ve got is:

bitbay undefined 4.70222414
bitfinex2 undefined 16925.54092995
bitlish undefined undefined
coinfloor undefined 18.6501
coinmarketcap undefined 918644000
coinsecure 2316000000 668495474
fybse undefined 0.0370270312
fybsg undefined 4.33956766
gatecoin undefined 1319.66810865
gdax undefined 4996.88767076
huobipro 1254.2214 88.4188633339
independentreserve 44.90041288 0.03696869
itbit undefined 1023.2192
lakebtc undefined 1285.864735
livecoin undefined 464.82359383
mixcoins undefined 111.6665
okcoincny undefined 2012.353
okcoinusd undefined 47.682
okex undefined 515954
quadrigacx undefined 5.64532372
southxchange undefined 0.33816411
vaultoro undefined 150.504

Those which have undefined as baseVolume and up to five digits as quoteVolume are just leftovers after the split.

Some figures seem to be just insane, in particular:

coinsecure 2316000000 668495474
huobipro 1254.2214 88.4188633339 (1254 / 88 = 14)
independentreserve 44.90041288 0.03696869 (45 / 0.037 = 1189)
okcoincny undefined 2012.353
okex undefined 515954

Looks like they return ticket info although they don’t quote in USD at all.

1reaction
kroitorcommented, Oct 7, 2017

Ok, I fixed most of those bugs, but there may still be some issues with volumes, I’ll test and debug further to bring it all to a consistent return. The bug was caused by the fact, that we had only one volume for the tickers initially, and then it was split into base/quote with some errors left over. Hope to fix them all. Thx again for your help! I’m closing this for now, if you don’t mind. Feel free to reopen it if needed. I’ll continue the work on this anyway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is a Currency Pair? Major, Minor, and Exotic Examples
All currency pairs are categorized according to the volume that is traded on a daily basis for a pair. The currencies that trade...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found