danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 738 forks source link

Ticker channel is missing trade ids #333

Closed moyphilip closed 5 years ago

moyphilip commented 5 years ago

I am subscribing to ticker channel for ETH-USD and it seems to be missing trade ids.

For example,

2018-10-13 23:10:32,880 [crypto] [INFO] {'type': 'ticker', 'sequence': 5500659397, 'product_id': 'ETH-USD', 'price': '196.71000000', 'open_24h': '194.92000000', 'volume_24h': '39113.63137656', 'low_24h': '193.45000000', 'high_24h': '198.37000000', 'volume_30d': '3760588.64374714', 'best_bid': '196.71', 'best_ask': '196.72', 'side': 'sell', 'time': '2018-10-13T23:10:32.804000Z', 'trade_id': 41151855, 'last_size': '15.00000000'}

2018-10-13 23:10:32,881 [crypto] [INFO] {'type': 'ticker', 'sequence': 5500659401, 'product_id': 'ETH-USD', 'price': '196.71000000', 'open_24h': '194.92000000', 'volume_24h': '39113.67137656', 'low_24h': '193.45000000', 'high_24h': '198.37000000', 'volume_30d': '3760588.68374714', 'best_bid': '196.71', 'best_ask': '196.72', 'side': 'sell', 'time': '2018-10-13T23:10:32.804000Z', 'trade_id': 41151857, 'last_size': '0.04000000'}

The trade id starts at 41151855 then jumps to 41151857. I've noticed it does it multiple times. I have one idea on how to find the missing trade ids by requesting the REST API.

Does anyone else have this problem or a better work around?

lirenz commented 5 years ago

tick isn't what you think... it only ticks on inner-book changes. What you really want is matches.

This is why you'll see that summing up last_size on ticks << actual last size.