Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

[bitstamp] API v2 not getting trades #446

Open
jurepetrovic opened this issue Nov 6, 2019 · 16 comments
Open

[bitstamp] API v2 not getting trades #446

jurepetrovic opened this issue Nov 6, 2019 · 16 comments
Labels
bug required-for-xchange-merge This issue has been identified as needing fixing before the project can be merged with XChange.

Comments

@jurepetrovic
Copy link

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

@jurepetrovic
Copy link
Author

Nobody noted that?

@badgerwithagun
Copy link
Collaborator

Just so you know someone's listening... I don't use Bitstamp myself, sorry!

@jurepetrovic
Copy link
Author

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 ;)

@chachalaca
Copy link

@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/

@jurepetrovic
Copy link
Author

@chachalaca Nice! I see they also have javascript examples on the site. I will check, when I find some time...

@jurepetrovic
Copy link
Author

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.

Mapper Crash

@jurepetrovic
Copy link
Author

Seems like BitstampWebSocketTransaction.java class does not match the specs. Will need to update the mapping class.

@chachalaca
Copy link

This is weird. I've made almost identical fix as you but it works flawlessly..

@jurepetrovic
Copy link
Author

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

@jurepetrovic
Copy link
Author

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?

@jurepetrovic
Copy link
Author

Ok, let's see how this pans out.
@badgerwithagun who's reviewing this part?

#451

@pchertalev
Copy link
Contributor

pchertalev commented Nov 27, 2019

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"}

@pchertalev
Copy link
Contributor

Ah! I got - subscriber is not recieving trades - there is just JsonNettyStreamingService log.

pchertalev pushed a commit to dsx-tech/xchange-stream that referenced this issue Nov 27, 2019
@pchertalev
Copy link
Contributor

Guys, sorry I don't like changes from @jurepetrovic.
I have opened my PR regarding this issue.

@pchertalev
Copy link
Contributor

#456

pchertalev pushed a commit to dsx-tech/xchange-stream that referenced this issue Nov 27, 2019
@mdvx
Copy link
Contributor

mdvx commented Nov 29, 2019

With #456 I get trades again
image

pchertalev pushed a commit to dsx-tech/xchange-stream that referenced this issue Dec 4, 2019
@badgerwithagun badgerwithagun changed the title Bitstamp v2 not getting trades [bitstamp] API v2 not getting trades Dec 6, 2019
@badgerwithagun badgerwithagun added bug required-for-xchange-merge This issue has been identified as needing fixing before the project can be merged with XChange. labels Dec 6, 2019
pchertalev pushed a commit to dsx-tech/xchange-stream that referenced this issue Dec 9, 2019
badgerwithagun added a commit that referenced this issue Dec 9, 2019
…-trades

#446 Bitstamp v2 not getting trades - fixed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug required-for-xchange-merge This issue has been identified as needing fixing before the project can be merged with XChange.
Projects
None yet
Development

No branches or pull requests

5 participants