[bitstamp] API v2 not getting trades
Opened this issue · 16 comments
Hello Gentlemen,
I tried to replace the old Bitstamp API with v2 today.
I only changed the import line:
import info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingExchange;
and everything compiled fine.
However, it seems I am not getting any updates from the exchange. The log shows normal connection:
2019-11-06 18:55:19 | INFO | [main] i.b.x.b.v.BitstampStreamingService:125 - Connecting to wss://ws.bitstamp.net 2019-11-06 18:55:21 | INFO | [nioEventLoopGroup-2-1] i.b.x.s.n.WebSocketClientHandler:63 - WebSocket Client connected! 2019-11-06 18:55:21 | WARN | [nioEventLoopGroup-2-1] i.b.x.b.v.BitstampStreamingService:228 - Resubscribing channels 2019-11-06 18:55:21 | INFO | [main] i.b.x.b.v.BitstampStreamingService:312 - Subscribing to channel live_trades_btceur 2019-11-06 18:55:22 | INFO | [main] i.b.x.b.v.BitstampStreamingService:312 - Subscribing to channel live_trades_etheur
There is just not a single trade incoming.
Subscription remained exactly the same as in v1, where it worked flawlessly.
Anyone had the same problem?
Thank you and best regards,
Jure
Nobody noted that?
Just so you know someone's listening... I don't use Bitstamp myself, sorry!
Ok, I saw @pchertalev commited something in bitstamp v2. I'll wait a bit to see if he knows something.
If not, I'l dig in myself....just don't know where properly...maybe with wireshark ;)
@jurepetrovic I've investigated this issue and found out it that the problem is in
https://github.com/bitrich-info/xchange-stream/blob/develop/xchange-bitstamp/src/main/java/info/bitrich/xchangestream/bitstamp/v2/BitstampStreamingService.java line 59. Name of the event in channels live_orders_...
and live_trades_...
is not data
but trades
or order_...
. See https://www.bitstamp.net/websocket/v2/
@chachalaca Nice! I see they also have javascript examples on the site. I will check, when I find some time...
Ok, I changed that on my fork to come pass this line.
https://github.com/jurepetrovic/xchange-stream
And then it crashed on JSON to object mapping in
BitstampStreamingMarketDataService.java, line 67
Need to go deeper here.
Seems like BitstampWebSocketTransaction.java class does not match the specs. Will need to update the mapping class.
This is weird. I've made almost identical fix as you but it works flawlessly..
java.lang.NoSuchMethodError: org.knowm.xchange.bitstamp.dto.marketdata.BitstampTransaction.(JJLjava/math/BigDecimal;Ljava/math/BigDecimal;I)V
I'm getting this exception when trying to call constructor of the parent class in BitstampWebSocketTransaction.java.
What version of basic xchange are you using?
Thanks,
Jure
Ok, I got this. It works for me now.
Did a little cleanup and new class for v2 BitstampTrades.
Can somebody of you guys do a quick check?
jurepetrovic@580ce20
What do you think? Can we do PR?
Ok, let's see how this pans out.
@badgerwithagun who's reviewing this part?
Guys, I'm not clear what is the problem I started BitstampManualExample and trades are recieved well:
15:43:29.390 [main] INFO info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingExchange - Calling Remote Init...
15:43:29.398 [main] DEBUG si.mazi.rescu.HttpTemplate - Executing GET request at https://www.bitstamp.net/api/v2/trading-pairs-info/
15:43:30.286 [main] DEBUG si.mazi.rescu.HttpTemplate - Request http status = 200
15:43:30.386 [main] INFO info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingService - Connecting to wss://ws.bitstamp.net
15:43:31.685 [nioEventLoopGroup-2-1] INFO info.bitrich.xchangestream.service.netty.WebSocketClientHandler - WebSocket Client connected!
15:43:31.685 [nioEventLoopGroup-2-1] WARN info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingService - Resubscribing channels
15:43:31.687 [main] INFO info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingService - Subscribing to channel live_trades_btcusd
15:43:31.720 [main] DEBUG info.bitrich.xchangestream.bitstamp.v2.BitstampStreamingService - Sending message: {"event":"bts:subscribe","data":{"channel":"live_trades_btcusd"}}
15:43:31.760 [nioEventLoopGroup-2-1] DEBUG info.bitrich.xchangestream.service.netty.JsonNettyStreamingService - Received message: {"event":"bts:subscription_succeeded","channel":"live_trades_btcusd","data":{}}
15:43:32.992 [nioEventLoopGroup-2-1] DEBUG info.bitrich.xchangestream.service.netty.JsonNettyStreamingService - Received message: {"data": {"microtimestamp": "1574858612723759", "amount": 0.01006, "buy_order_id": 4387860425, "sell_order_id": 4387860983, "amount_str": "0.01006000", "price_str": "7268.04", "timestamp": "1574858612", "price": 7268.04, "type": 1, "id": 101101885}, "event": "trade", "channel": "live_trades_btcusd"}
15:43:41.185 [nioEventLoopGroup-2-1] DEBUG info.bitrich.xchangestream.service.netty.JsonNettyStreamingService - Received message: {"data": {"microtimestamp": "1574858621023145", "amount": 0.09047, "buy_order_id": 4387861204, "sell_order_id": 4387861446, "amount_str": "0.09047000", "price_str": "7263.35", "timestamp": "1574858621", "price": 7263.35, "type": 1, "id": 101101889}, "event": "trade", "channel": "live_trades_btcusd"}
15:43:44.136 [nioEventLoopGroup-2-1] DEBUG info.bitrich.xchangestream.service.netty.JsonNettyStreamingService - Received message: {"data": {"microtimestamp": "1574858623986044", "amount": 0.007401, "buy_order_id": 4387861720, "sell_order_id": 4387861684, "amount_str": "0.00740100", "price_str": "7265.58", "timestamp": "1574858623", "price": 7265.58, "type": 0, "id": 101101891}, "event": "trade", "channel": "live_trades_btcusd"}
Ah! I got - subscriber is not recieving trades - there is just JsonNettyStreamingService log.
Guys, sorry I don't like changes from @jurepetrovic.
I have opened my PR regarding this issue.