0

I recently discovered Poloniex's API and am a big fan. I am puzzled about the following thing though: I query one Poloniex's BTC-ETH trade history for a 24h trading period. E.g., https://poloniex.com/public?command=returnTradeHistory&currencyPair=BTC_ETH&start=1489190400&end=1489276799 queries all BTC-ETH trades on March 11, 2017 (UTC). The returned JSON contains 46,675 trades (below the API's max result size of 50k). When counting up all the sell- and buy-trades contained in this JSON, I see that there is a total of 8,814.124270 coins bought vs 7,754.184259 coins sold. How can that be? Shouldn't those two numbers be the same? What am I missing?

Thank you very much in advance.

dotwin
  • 1,302
  • 2
  • 11
  • 31
  • Why did you expect those totals to be the same? There can be more buys than sells (or vice versa) in a day no? – Yann39 Jul 15 '17 at 20:32
  • Yes, I expect them to be the same. Where do you buy the coins from / sell the coins to if they are not the same? Please explain further... – dotwin Jul 15 '17 at 20:47
  • 1
    But this is for a single day, the buy/sell orders were not to 0/0 at the begining of the day. For example at the time of writing, ETH/BTC sell order book is 8210 BTC, buy order book is 7924 BTC, so you can buy more than you send. – Yann39 Jul 15 '17 at 21:19
  • @Yann39 I understand that there can be differences in demand and supply. However, shouldn't there always be the same amount of coin sold that there are coins bought. The order book reflects people's willingness to buy, but transactions should take place on a 1:1 ratio no? When there is one coin sold, there should be other transactions summing up to one coin that are bought. There should not be excess coins. I understand that I only have a 1 day snapshot, but things will likely look similar if I pulled 2 or 3 days... Why is there a difference between the total volume purchased and sold? – dotwin Jul 16 '17 at 00:08
  • Maybe I'm wrong but I think the ratio is not necessarily 1:1 in a range. Let's reduce the range from 1 day to 1 hour, for example from _2014-12-09 05:00:00_ to _2014-12-09 06:00:00_ UTC ([example](https://poloniex.com/public?command=returnTradeHistory&currencyPair=BTC_NXT&start=1418097600&end=1418101200)). You only get 4 sell trades, it does not mean that there are no corresponding buy trades, but they may be out of the specified range. Trades are just executed in the order they appear in the order book according to the current price. – Yann39 Jul 16 '17 at 11:57

1 Answers1

0

A buy is when someone buys the ask, also known as an uptick. A sell is when someone sells the bid, also known as a downtick.

Everything that is stuck on the book is considered liquidity. Market price buyers and sellers remove liquidity. People who put orders on the book add liquidity.

So no, the buys should not equal the sells as it is totally possible that all that happened one day is that everyone kept hitting the buy button.

Consider this, if the buys equalled the sells, why would you need the data sent twice, and how would you know whether the bid or ask was taken?

djgandy
  • 1,125
  • 6
  • 15