Binance Streaming exchange complains about multiple connections #357

Closed
opened 2021-03-03 23:53:53 -08:00 by scionaltera · 0 comments
scionaltera commented 2021-03-03 23:53:53 -08:00 (Migrated from github.com)

thisiscam on Discord is having trouble with staying connected to the Binance websocket. They upgraded XChange to 5.0.6 but otherwise are on the main branch.

2021-03-04 02:01:00.036  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 19
2021-03-04 02:01:00.065  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Binance: UpFrontSubscriptionRequiredException Binance exchange only supports up front subscriptions - subscribe at connect time x 1
2021-03-04 02:02:00.003  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Noncritical error summary: [Exception name]: [Error message] x [Count]
2021-03-04 02:02:00.038  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 20
2021-03-04 02:03:00.005  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Noncritical error summary: [Exception name]: [Error message] x [Count]
2021-03-04 02:03:00.035  INFO 98329 --- [   scheduling-1] c.r.arbitrader.service.TradingScheduler  : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 20

One possibility is the fact that we don't explicitly disconnect subscriptions. In StreamingTickerStrategy#getTickers() we connect and add the subscription(s) to a List, but if we ever got in there a second time we just throw away the old ones and replace them instead of actually calling dispose() on them first. I'm not sure how we'd do it twice since we don't ever remove anything from the tickers Map.

Another possibility is that we're putting the wrong CurrencyPairs in the ProductSubscription in StreamingTickerStrategy#getTickers() due to the homeCurrency setting. The code in the BinanceStreamingMarketDataService checks to see if the ticker you're asking for is in the original list created when the connection was first connected. If, for example, we put "BTC/USD" in at that point and "BTC/USDT" in later, or the reverse, that could cause this problem too.

**thisiscam** on Discord is having trouble with staying connected to the Binance websocket. They upgraded XChange to 5.0.6 but otherwise are on the main branch. ``` 2021-03-04 02:01:00.036 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 19 2021-03-04 02:01:00.065 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Binance: UpFrontSubscriptionRequiredException Binance exchange only supports up front subscriptions - subscribe at connect time x 1 2021-03-04 02:02:00.003 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Noncritical error summary: [Exception name]: [Error message] x [Count] 2021-03-04 02:02:00.038 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 20 2021-03-04 02:03:00.005 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Noncritical error summary: [Exception name]: [Error message] x [Count] 2021-03-04 02:03:00.035 INFO 98329 --- [ scheduling-1] c.r.arbitrader.service.TradingScheduler : Binance: UnsupportedOperationException Exchange only handles a single connection - disconnect the current connection. x 20 ``` One possibility is the fact that we don't explicitly disconnect subscriptions. In `StreamingTickerStrategy#getTickers()` we connect and add the subscription(s) to a List, but if we ever got in there a second time we just throw away the old ones and replace them instead of actually calling `dispose()` on them first. I'm not sure how we'd do it twice since we don't ever remove anything from the `tickers` Map. Another possibility is that we're putting the wrong `CurrencyPair`s in the `ProductSubscription` in `StreamingTickerStrategy#getTickers()` due to the `homeCurrency` setting. The code in the `BinanceStreamingMarketDataService` checks to see if the ticker you're asking for is in the original list created when the connection was first connected. If, for example, we put "BTC/USD" in at that point and "BTC/USDT" in later, or the reverse, that could cause this problem too.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
scion/arbitrader#357
No description provided.