bitfinexcom / bitfinex-api-go

BITFINEX Go trading API - Bitcoin, Litecoin, and Ether exchange
https://www.bitfinex.com/
MIT License
309 stars 220 forks source link

v2: Websocket connection errors #99

Closed jsgv closed 5 years ago

jsgv commented 6 years ago

I am using the Websocket package to subscribe to Ticker updates and I am getting connection errors. It was working before, but I recently reinstalled my dependencies (not an update).

Some other things broke too. Such as the new client method https://github.com/bitfinexcom/bitfinex-api-go/commit/15f42ed8f9574d3dd2a56921ddf1e51dd636559d#diff-93015be9a1b3ee72156236756317284dL220

Is there a possibility to have tags or versioning on the repo as well? This way we can keep using the package without the fear of it breaking in the future.

Websocket Log

2018/02/16 11:08:17 sub len: 0
2018/02/16 11:08:17 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:19 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:19 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097001", Channel:"ticker", ChanID:1, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:19 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9947, BidPeriod:0, BidSize:63.74092799, Ask:9947.1, AskPeriod:0, AskSize:47.82445395, DailyChange:-77, DailyChangePerc:-0.0077, LastPrice:9947, Volume:50804.0219273, High:10271, Low:9670}
2018/02/16 11:08:24 reconnect attempt 1/5
2018/02/16 11:08:24 sub len: 1
2018/02/16 11:08:24 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:25 resubscribing to ticker tBTCUSD with nonce 1518808097002
2018/02/16 11:08:25 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:25 [WARN]: could not find subscription for channel ID 1
2018/02/16 11:08:25 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097002", Channel:"ticker", ChanID:1, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:27 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9946, BidPeriod:0, BidSize:64.07389119, Ask:9946.1, AskPeriod:0, AskSize:63.59846063, DailyChange:-77, DailyChangePerc:-0.0077, LastPrice:9947, Volume:50809.02576089, High:10271, Low:9670}
2018/02/16 11:08:30 reconnect attempt 1/5
2018/02/16 11:08:30 sub len: 1
2018/02/16 11:08:30 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:30 resubscribing to ticker tBTCUSD with nonce 1518808097003
2018/02/16 11:08:30 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:31 [WARN]: could not find subscription for channel ID 3
2018/02/16 11:08:31 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097003", Channel:"ticker", ChanID:3, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:35 reconnect attempt 1/5
2018/02/16 11:08:35 sub len: 1
2018/02/16 11:08:35 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:36 resubscribing to ticker tBTCUSD with nonce 1518808097004
2018/02/16 11:08:36 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:37 [WARN]: could not find subscription for channel ID 2
2018/02/16 11:08:37 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097004", Channel:"ticker", ChanID:2, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:37 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9949.1, BidPeriod:0, BidSize:66.94639044, Ask:9950, AskPeriod:0, AskSize:35.63762188, DailyChange:-74, DailyChangePerc:-0.0074, LastPrice:9950, Volume:50808.91830258, High:10271, Low:9670}
2018/02/16 11:08:41 reconnect attempt 1/5
2018/02/16 11:08:41 sub len: 1
2018/02/16 11:08:41 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:42 resubscribing to ticker tBTCUSD with nonce 1518808097005
2018/02/16 11:08:42 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:42 [WARN]: could not find subscription for channel ID 2
2018/02/16 11:08:42 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097005", Channel:"ticker", ChanID:2, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:47 reconnect attempt 1/5
2018/02/16 11:08:47 sub len: 1
2018/02/16 11:08:47 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:47 resubscribing to ticker tBTCUSD with nonce 1518808097006
2018/02/16 11:08:47 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:48 [WARN]: could not find subscription for channel ID 5
2018/02/16 11:08:48 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097006", Channel:"ticker", ChanID:5, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:48 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9963.9, BidPeriod:0, BidSize:75.5583129, Ask:9966.5, AskPeriod:0, AskSize:52.52509153, DailyChange:-59.5, DailyChangePerc:-0.0059, LastPrice:9964.5, Volume:50815.72499832, High:10271, Low:9670}
2018/02/16 11:08:52 reconnect attempt 1/5
2018/02/16 11:08:52 sub len: 1
2018/02/16 11:08:52 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:53 resubscribing to ticker tBTCUSD with nonce 1518808097007
2018/02/16 11:08:53 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:53 [WARN]: could not find subscription for channel ID 12
2018/02/16 11:08:53 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097007", Channel:"ticker", ChanID:12, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:08:58 reconnect attempt 1/5
2018/02/16 11:08:58 sub len: 1
2018/02/16 11:08:58 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:08:59 resubscribing to ticker tBTCUSD with nonce 1518808097008
2018/02/16 11:08:59 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:08:59 [WARN]: could not find subscription for channel ID 5
2018/02/16 11:08:59 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097008", Channel:"ticker", ChanID:5, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:04 reconnect attempt 1/5
2018/02/16 11:09:04 sub len: 1
2018/02/16 11:09:04 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:04 resubscribing to ticker tBTCUSD with nonce 1518808097009
2018/02/16 11:09:04 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:04 [WARN]: could not find subscription for channel ID 5
2018/02/16 11:09:04 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097009", Channel:"ticker", ChanID:5, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:08 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9958.1, BidPeriod:0, BidSize:55.43289962, Ask:9958.9, AskPeriod:0, AskSize:14.35730542, DailyChange:-65.7, DailyChangePerc:-0.0066, LastPrice:9958.3, Volume:50827.83805265, High:10271, Low:9670}
2018/02/16 11:09:09 reconnect attempt 1/5
2018/02/16 11:09:09 sub len: 1
2018/02/16 11:09:09 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:09 resubscribing to ticker tBTCUSD with nonce 1518808097010
2018/02/16 11:09:09 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:10 [WARN]: could not find subscription for channel ID 9
2018/02/16 11:09:10 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097010", Channel:"ticker", ChanID:9, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:14 reconnect attempt 1/5
2018/02/16 11:09:14 sub len: 1
2018/02/16 11:09:14 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:16 resubscribing to ticker tBTCUSD with nonce 1518808097011
2018/02/16 11:09:16 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:16 [WARN]: could not find subscription for channel ID 16
2018/02/16 11:09:16 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097011", Channel:"ticker", ChanID:16, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:18 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9954.1, BidPeriod:0, BidSize:83.21620341, Ask:9954.2, AskPeriod:0, AskSize:26.7526391, DailyChange:-69.1, DailyChangePerc:-0.0069, LastPrice:9954.9, Volume:50827.60858321, High:10271, Low:9670}
2018/02/16 11:09:21 reconnect attempt 1/5
2018/02/16 11:09:21 sub len: 1
2018/02/16 11:09:21 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:22 resubscribing to ticker tBTCUSD with nonce 1518808097012
2018/02/16 11:09:22 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:23 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097012", Channel:"ticker", ChanID:3, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:23 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9954.1, BidPeriod:0, BidSize:83.21620341, Ask:9954.2, AskPeriod:0, AskSize:26.7526391, DailyChange:-69.1, DailyChangePerc:-0.0069, LastPrice:9954.9, Volume:50827.60858321, High:10271, Low:9670}
2018/02/16 11:09:27 reconnect attempt 1/5
2018/02/16 11:09:27 sub len: 1
2018/02/16 11:09:27 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:28 resubscribing to ticker tBTCUSD with nonce 1518808097013
2018/02/16 11:09:28 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:29 [WARN]: could not find subscription for channel ID 15
2018/02/16 11:09:29 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097013", Channel:"ticker", ChanID:15, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:33 reconnect attempt 1/5
2018/02/16 11:09:33 sub len: 1
2018/02/16 11:09:33 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:34 resubscribing to ticker tBTCUSD with nonce 1518808097014
2018/02/16 11:09:34 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:34 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097014", Channel:"ticker", ChanID:9, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:34 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9952, BidPeriod:0, BidSize:60.27652022, Ask:9952.1, AskPeriod:0, AskSize:35.26959297, DailyChange:-115.9, DailyChangePerc:-0.0115, LastPrice:9952.1, Volume:50826.37450999, High:10271, Low:9670}
2018/02/16 11:09:37 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9951, BidPeriod:0, BidSize:59.8403597, Ask:9951.1, AskPeriod:0, AskSize:30.41273471, DailyChange:-116.92401978, DailyChangePerc:-0.0116, LastPrice:9951.07598022, Volume:50826.03804297, High:10271, Low:9670}
2018/02/16 11:09:39 reconnect attempt 1/5
2018/02/16 11:09:39 sub len: 1
2018/02/16 11:09:39 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:40 resubscribing to ticker tBTCUSD with nonce 1518808097015
2018/02/16 11:09:40 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:40 [WARN]: could not find subscription for channel ID 2
2018/02/16 11:09:40 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097015", Channel:"ticker", ChanID:2, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:45 reconnect attempt 1/5
2018/02/16 11:09:45 sub len: 1
2018/02/16 11:09:45 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:46 resubscribing to ticker tBTCUSD with nonce 1518808097016
2018/02/16 11:09:46 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:46 [WARN]: could not find subscription for channel ID 2
2018/02/16 11:09:46 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097016", Channel:"ticker", ChanID:2, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:47 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9951, BidPeriod:0, BidSize:63.12733983, Ask:9951.1, AskPeriod:0, AskSize:28.70953471, DailyChange:-116.9, DailyChangePerc:-0.0116, LastPrice:9951.1, Volume:50818.87207771, High:10271, Low:9670}
2018/02/16 11:09:51 reconnect attempt 1/5
2018/02/16 11:09:51 sub len: 1
2018/02/16 11:09:51 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:52 resubscribing to ticker tBTCUSD with nonce 1518808097017
2018/02/16 11:09:52 MSG RECV: &websocket.InfoEvent{Version:2}
2018/02/16 11:09:52 MSG RECV: &websocket.SubscribeEvent{SubID:"1518808097017", Channel:"ticker", ChanID:1, Symbol:"tBTCUSD", Precision:"", Frequency:"", Key:"", Len:"", Pair:"BTCUSD"}
2018/02/16 11:09:52 MSG RECV: &bitfinex.Ticker{Symbol:"tBTCUSD", Bid:9951, BidPeriod:0, BidSize:63.12733983, Ask:9951.1, AskPeriod:0, AskSize:28.70953471, DailyChange:-116.9, DailyChangePerc:-0.0116, LastPrice:9951.1, Volume:50818.87207771, High:10271, Low:9670}
2018/02/16 11:09:57 reconnect attempt 1/5
2018/02/16 11:09:57 sub len: 1
2018/02/16 11:09:57 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:57 bad handshake: status code 429
2018/02/16 11:09:57 reconnect failed: websocket: bad handshake
2018/02/16 11:09:58 reconnect attempt 2/5
2018/02/16 11:09:58 sub len: 0
2018/02/16 11:09:58 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:58 bad handshake: status code 429
2018/02/16 11:09:58 reconnect failed: websocket: bad handshake
2018/02/16 11:09:59 reconnect attempt 3/5
2018/02/16 11:09:59 sub len: 0
2018/02/16 11:09:59 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:09:59 bad handshake: status code 429
2018/02/16 11:09:59 reconnect failed: websocket: bad handshake
2018/02/16 11:10:00 reconnect attempt 4/5
2018/02/16 11:10:00 sub len: 0
2018/02/16 11:10:00 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:10:00 bad handshake: status code 429
2018/02/16 11:10:00 reconnect failed: websocket: bad handshake
2018/02/16 11:10:01 reconnect attempt 5/5
2018/02/16 11:10:01 sub len: 0
2018/02/16 11:10:01 connecting ws to wss://api.bitfinex.com/ws/2
2018/02/16 11:10:02 bad handshake: status code 429
2018/02/16 11:10:02 reconnect failed: websocket: bad handshake
2018/02/16 11:10:02 could not reconnect: websocket: bad handshake
2018/02/16 11:10:02 Bitfinex listening error: %+vwebsocket: bad handshake
exit status 1
jvatianou-connamara commented 6 years ago

This should be closed as a pull request has been merged.

jvatianou-connamara commented 6 years ago

Moving to 'review/qa' pipeline until I verify that this should be closed.