Describe the bug
User data updates are not received when streaming coin-margined futures despite successfully subscribing to updates. Works fine when subscribing to usdt-margined user data updates though.
To Reproduce
// Set the default options of the Binance rest client.
BinanceClient.SetDefaultOptions(new BinanceClientOptions()
{
ApiCredentials = apiCredentials,
BaseAddress = "https://api.binance.us",
BaseAddressUsdtFutures = "https://testnet.binancefuture.com",
BaseAddressCoinFutures = "https://testnet.binancefuture.com",
LogVerbosity = LogVerbosity.Debug
});
// Set the default options of the Binance web socket client.
BinanceSocketClient.SetDefaultOptions(new BinanceSocketClientOptions()
{
ApiCredentials = apiCredentials,
BaseAddress = "wss://stream.binance.us:9443",
BaseAddressUsdtFutures = "wss://stream.binancefuture.com/",
BaseAddressCoinFutures = "wss://stream.binancefuture.com/",
LogVerbosity = LogVerbosity.Debug,
});
// Create a BinanceClient to make rest api requests.
BinanceClient = new BinanceClient();
// Create a BinanceSocketClient to make web socket requests.
BinanceSocketClient = new BinanceSocketClient();
// Subscripbe to usdt futures updates.
WebCallResult<string> futuresUsdtStartStreamResult = BinanceClient.FuturesUsdt.UserStream.StartUserStream();
if (futuresUsdtStartStreamResult.Success)
{
BinanceSocketClient.FuturesUsdt.SubscribeToUserDataUpdates(futuresUsdtStartStreamResult.Data,
null,
null,
onOrderUpdate => { Debug.Write("USDT FUTURE ORDER UPDATE RECEIVED" + Environment.NewLine); },
null);
}
// Subscribe to coin futures updates.
WebCallResult<string> futuresCoinStartStreamResult = BinanceClient.FuturesCoin.UserStream.StartUserStream();
if (futuresCoinStartStreamResult.Success)
{
BinanceSocketClient.FuturesCoin.SubscribeToUserDataUpdates(futuresCoinStartStreamResult.Data,
null,
null,
onOrderUpdate => { Debug.Write("COIN FUTURE ORDER UPDATE RECEIVED" + Environment.NewLine); },
null);
}
// Send usdt future order.
if (BinanceClient.FuturesUsdt.Order.PlaceOrder("BTCUSDT", OrderSide.Buy, OrderType.Market, 1).Success)
{
Debug.Write("USDT FUTURE ORDER SUCCESSFUL" + Environment.NewLine);
}
// Send coin future order.
if (BinanceClient.FuturesCoin.Order.PlaceOrder("BTCUSD_210326", OrderSide.Buy, OrderType.Market, 1).Success)
{
Debug.Write("COIN FUTURE ORDER SUCCESSFUL"+Environment.NewLine);
}
Expected behavior
The expected behavior is for user updates to be received through the user data stream subscription like how it happens for USDT futures.
Debug logging
2021/01/14 10:30:03:505 | Binance | Debug | Client configuration: LogVerbosity: Debug, Writers: 1, Credentials: Set, BaseAddress: https://api.binance.us/, Proxy: -, RateLimiters: 0, RateLimitBehaviour: Wait, RequestTimeout: 00:00:30
2021/01/14 10:30:03:568 | Binance | Debug | Client configuration: LogVerbosity: Debug, Writers: 1, Credentials: Set, BaseAddress: wss://stream.binance.us:9443/, Proxy: -, AutoReconnect: True, ReconnectInterval: 00:00:05, SocketResponseTimeout: 00:00:10, SocketSubscriptionsCombineTarget:
2021/01/14 10:30:03:578 | Binance | Debug | [1] Creating request for https://api.binance.us/api/v3/time
2021/01/14 10:30:03:597 | Binance | Debug | [1] Sending GET request to https://api.binance.us/api/v3/time
2021/01/14 10:30:03:774 | Binance | Debug | [1] Response received in 165ms: {"serverTime":1610638204515}
2021/01/14 10:30:03:912 | Binance | Debug | [2] Creating request for https://api.binance.us/api/v3/time
2021/01/14 10:30:03:913 | Binance | Debug | [2] Sending GET request to https://api.binance.us/api/v3/time
2021/01/14 10:30:03:929 | Binance | Debug | [2] Response received in 15ms: {"serverTime":1610638204675}
2021/01/14 10:30:03:931 | Binance | Info | Time offset set to 762.9376ms
2021/01/14 10:30:03:933 | Binance | Debug | [3] Creating request for https://testnet.binancefuture.com/fapi/v1/listenKey
2021/01/14 10:30:03:935 | Binance | Debug | [3] Sending POST request to https://testnet.binancefuture.com/fapi/v1/listenKey with request body
2021/01/14 10:30:04:522 | Binance | Debug | [3] Response received in 586ms: {"listenKey":"RWnCXTN9iL95pR13TUaOiamT9zxZKbpssaSIpnJ3eDZSDnA7S87Nm4L7gOFOHXyZ"}
2021/01/14 10:30:04:547 | Binance | Debug | Created new socket for wss://stream.binancefuture.com/ws/RWnCXTN9iL95pR13TUaOiamT9zxZKbpssaSIpnJ3eDZSDnA7S87Nm4L7gOFOHXyZ
2021/01/14 10:30:04:570 | Binance | Debug | Socket 1 connecting
2021/01/14 10:30:05:405 | Binance | Debug | Socket 1 connected
2021/01/14 10:30:05:408 | Binance | Debug | [5] Creating request for https://testnet.binancefuture.com/dapi/v1/listenKey
2021/01/14 10:30:05:409 | Binance | Debug | [5] Sending POST request to https://testnet.binancefuture.com/dapi/v1/listenKey with request body
2021/01/14 10:30:06:011 | Binance | Debug | [5] Response received in 601ms: {"listenKey":"xdq6x5FRcuTIZdarFmPj889Ejzj049aAW9uKjoAtNIRG2KFlihqdAi55krMxP6Lk"}
2021/01/14 10:30:06:013 | Binance | Debug | Created new socket for wss://stream.binancefuture.com/ws/xdq6x5FRcuTIZdarFmPj889Ejzj049aAW9uKjoAtNIRG2KFlihqdAi55krMxP6Lk
2021/01/14 10:30:06:014 | Binance | Debug | Socket 2 connecting
2021/01/14 10:30:06:732 | Binance | Debug | Socket 2 connected
2021/01/14 10:30:06:793 | Binance | Debug | [7] Creating request for https://testnet.binancefuture.com/fapi/v1/order
2021/01/14 10:30:06:832 | Binance | Debug | [7] Sending POST signed request to https://testnet.binancefuture.com/fapi/v1/order with request body quantity=1&recvWindow=5000&side=BUY&signature=0853BEE189FF34C5A396BE759A30CA76032C46478F56719E3C1854E4F7C694F2&symbol=BTCUSDT×tamp=1610638207555&type=MARKET
2021/01/14 10:30:07:632 | Binance | Debug | [7] Response received in 796ms: {"orderId":2611733004,"symbol":"BTCUSDT","status":"NEW","clientOrderId":"6bngw21DJGGemRmdGN9eQe","price":"0","avgPrice":"0.00000","origQty":"1","executedQty":"0","cumQty":"0","cumQuote":"0","timeInForce":"GTC","type":"MARKET","reduceOnly":false,"closePosition":false,"side":"BUY","positionSide":"BOTH","stopPrice":"0","workingType":"CONTRACT_PRICE","priceProtect":false,"origType":"MARKET","updateTime":1610638208309}
2021/01/14 10:30:07:665 | Binance | Debug | Socket 1 received data: {"e":"ORDER_TRADE_UPDATE","T":1610638208309,"E":1610638208312,"o":{"s":"BTCUSDT","c":"6bngw21DJGGemRmdGN9eQe","S":"BUY","o":"MARKET","f":"GTC","q":"1","p":"0","ap":"0","sp":"0","x":"NEW","X":"NEW","i":2611733004,"l":"0","z":"0","L":"0","T":1610638208309,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"MARKET","ps":"BOTH","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}
USDT FUTURE ORDER SUCCESSFUL
2021/01/14 10:30:07:679 | Binance | Debug | [8] Creating request for https://testnet.binancefuture.com/dapi/v1/order
2021/01/14 10:30:07:680 | Binance | Debug | [8] Sending POST signed request to https://testnet.binancefuture.com/dapi/v1/order with request body quantity=1&recvWindow=5000&side=BUY&signature=336904923664A5B5CC7FBC84B34144B82A915B42D29FCAD50185656239E9FD8C&symbol=BTCUSD_210326×tamp=1610638208442&type=MARKET
2021/01/14 10:30:07:685 | Binance | Debug | {
"e": "ORDER_TRADE_UPDATE",
"T": 1610638208309,
"E": 1610638208312,
"o": {
"s": "BTCUSDT",
"c": "6bngw21DJGGemRmdGN9eQe",
"S": "BUY",
"o": "MARKET",
"f": "GTC",
"q": "1",
"p": "0",
"ap": "0",
"sp": "0",
"x": "NEW",
"X": "NEW",
"i": 2611733004,
"l": "0",
"z": "0",
"L": "0",
"T": 1610638208309,
"t": 0,
"b": "0",
"a": "0",
"m": false,
"R": false,
"wt": "CONTRACT_PRICE",
"ot": "MARKET",
"ps": "BOTH",
"cp": false,
"rp": "0",
"pP": false,
"si": 0,
"ss": 0
}
}
USDT FUTURE ORDER UPDATE RECEIVED
2021/01/14 10:30:07:705 | Binance | Debug | Socket 1 received data: {"e":"ACCOUNT_UPDATE","T":1610638208309,"E":1610638208312,"a":{"B":[{"a":"USDT","wb":"41155.75036105","cw":"41155.75036105"}],"P":[{"s":"BTCUSDT","pa":"5","ep":"39560.50000","cr":"41904.65494994","up":"1408.83485865","mt":"cross","iw":"0","ps":"BOTH","ma":"USDT"},{"s":"BTCUSDT","pa":"0","ep":"0.00000","cr":"-9108.66000000","up":"0","mt":"cross","iw":"0","ps":"LONG","ma":"USDT"},{"s":"BTCUSDT","pa":"0","ep":"0.00000","cr":"4421.03000000","up":"0","mt":"cross","iw":"0","ps":"SHORT","ma":"USDT"}],"m":"ORDER"}}
2021/01/14 10:30:07:734 | Binance | Debug | Socket 1 received data: {"e":"ORDER_TRADE_UPDATE","T":1610638208309,"E":1610638208312,"o":{"s":"BTCUSDT","c":"6bngw21DJGGemRmdGN9eQe","S":"BUY","o":"MARKET","f":"GTC","q":"1","p":"0","ap":"39849.93000","sp":"0","x":"TRADE","X":"FILLED","i":2611733004,"l":"1","z":"1","L":"39849.93","n":"15.93997200","N":"USDT","T":1610638208309,"t":154402974,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"MARKET","ps":"BOTH","cp":false,"rp":"0","pP":false,"si":0,"ss":0}}
2021/01/14 10:30:07:736 | Binance | Debug | {
"e": "ORDER_TRADE_UPDATE",
"T": 1610638208309,
"E": 1610638208312,
"o": {
"s": "BTCUSDT",
"c": "6bngw21DJGGemRmdGN9eQe",
"S": "BUY",
"o": "MARKET",
"f": "GTC",
"q": "1",
"p": "0",
"ap": "39849.93000",
"sp": "0",
"x": "TRADE",
"X": "FILLED",
"i": 2611733004,
"l": "1",
"z": "1",
"L": "39849.93",
"n": "15.93997200",
"N": "USDT",
"T": 1610638208309,
"t": 154402974,
"b": "0",
"a": "0",
"m": false,
"R": false,
"wt": "CONTRACT_PRICE",
"ot": "MARKET",
"ps": "BOTH",
"cp": false,
"rp": "0",
"pP": false,
"si": 0,
"ss": 0
}
}
USDT FUTURE ORDER UPDATE RECEIVED
2021/01/14 10:30:08:293 | Binance | Debug | [8] Response received in 611ms: {"orderId":14702153,"symbol":"BTCUSD_210326","pair":"BTCUSD","status":"NEW","clientOrderId":"p1MIkOR8gRUjLUKWIwhAaO","price":"0","avgPrice":"0.0","origQty":"1","executedQty":"0","cumQty":"0","cumBase":"0","timeInForce":"GTC","type":"MARKET","reduceOnly":false,"closePosition":false,"side":"BUY","positionSide":"BOTH","stopPrice":"0","workingType":"CONTRACT_PRICE","priceProtect":false,"origType":"MARKET","updateTime":1610638208959}
COIN FUTURE ORDER SUCCESSFUL
Describe the bug User data updates are not received when streaming coin-margined futures despite successfully subscribing to updates. Works fine when subscribing to usdt-margined user data updates though.
To Reproduce
Expected behavior The expected behavior is for user updates to be received through the user data stream subscription like how it happens for USDT futures.
Debug logging 2021/01/14 10:30:03:505 | Binance | Debug | Client configuration: LogVerbosity: Debug, Writers: 1, Credentials: Set, BaseAddress: https://api.binance.us/, Proxy: -, RateLimiters: 0, RateLimitBehaviour: Wait, RequestTimeout: 00:00:30 2021/01/14 10:30:03:568 | Binance | Debug | Client configuration: LogVerbosity: Debug, Writers: 1, Credentials: Set, BaseAddress: wss://stream.binance.us:9443/, Proxy: -, AutoReconnect: True, ReconnectInterval: 00:00:05, SocketResponseTimeout: 00:00:10, SocketSubscriptionsCombineTarget: 2021/01/14 10:30:03:578 | Binance | Debug | [1] Creating request for https://api.binance.us/api/v3/time 2021/01/14 10:30:03:597 | Binance | Debug | [1] Sending GET request to https://api.binance.us/api/v3/time 2021/01/14 10:30:03:774 | Binance | Debug | [1] Response received in 165ms: {"serverTime":1610638204515} 2021/01/14 10:30:03:912 | Binance | Debug | [2] Creating request for https://api.binance.us/api/v3/time 2021/01/14 10:30:03:913 | Binance | Debug | [2] Sending GET request to https://api.binance.us/api/v3/time 2021/01/14 10:30:03:929 | Binance | Debug | [2] Response received in 15ms: {"serverTime":1610638204675} 2021/01/14 10:30:03:931 | Binance | Info | Time offset set to 762.9376ms 2021/01/14 10:30:03:933 | Binance | Debug | [3] Creating request for https://testnet.binancefuture.com/fapi/v1/listenKey 2021/01/14 10:30:03:935 | Binance | Debug | [3] Sending POST request to https://testnet.binancefuture.com/fapi/v1/listenKey with request body 2021/01/14 10:30:04:522 | Binance | Debug | [3] Response received in 586ms: {"listenKey":"RWnCXTN9iL95pR13TUaOiamT9zxZKbpssaSIpnJ3eDZSDnA7S87Nm4L7gOFOHXyZ"} 2021/01/14 10:30:04:547 | Binance | Debug | Created new socket for wss://stream.binancefuture.com/ws/RWnCXTN9iL95pR13TUaOiamT9zxZKbpssaSIpnJ3eDZSDnA7S87Nm4L7gOFOHXyZ 2021/01/14 10:30:04:570 | Binance | Debug | Socket 1 connecting 2021/01/14 10:30:05:405 | Binance | Debug | Socket 1 connected 2021/01/14 10:30:05:408 | Binance | Debug | [5] Creating request for https://testnet.binancefuture.com/dapi/v1/listenKey 2021/01/14 10:30:05:409 | Binance | Debug | [5] Sending POST request to https://testnet.binancefuture.com/dapi/v1/listenKey with request body 2021/01/14 10:30:06:011 | Binance | Debug | [5] Response received in 601ms: {"listenKey":"xdq6x5FRcuTIZdarFmPj889Ejzj049aAW9uKjoAtNIRG2KFlihqdAi55krMxP6Lk"} 2021/01/14 10:30:06:013 | Binance | Debug | Created new socket for wss://stream.binancefuture.com/ws/xdq6x5FRcuTIZdarFmPj889Ejzj049aAW9uKjoAtNIRG2KFlihqdAi55krMxP6Lk 2021/01/14 10:30:06:014 | Binance | Debug | Socket 2 connecting 2021/01/14 10:30:06:732 | Binance | Debug | Socket 2 connected 2021/01/14 10:30:06:793 | Binance | Debug | [7] Creating request for https://testnet.binancefuture.com/fapi/v1/order 2021/01/14 10:30:06:832 | Binance | Debug | [7] Sending POST signed request to https://testnet.binancefuture.com/fapi/v1/order with request body quantity=1&recvWindow=5000&side=BUY&signature=0853BEE189FF34C5A396BE759A30CA76032C46478F56719E3C1854E4F7C694F2&symbol=BTCUSDT×tamp=1610638207555&type=MARKET 2021/01/14 10:30:07:632 | Binance | Debug | [7] Response received in 796ms: {"orderId":2611733004,"symbol":"BTCUSDT","status":"NEW","clientOrderId":"6bngw21DJGGemRmdGN9eQe","price":"0","avgPrice":"0.00000","origQty":"1","executedQty":"0","cumQty":"0","cumQuote":"0","timeInForce":"GTC","type":"MARKET","reduceOnly":false,"closePosition":false,"side":"BUY","positionSide":"BOTH","stopPrice":"0","workingType":"CONTRACT_PRICE","priceProtect":false,"origType":"MARKET","updateTime":1610638208309} 2021/01/14 10:30:07:665 | Binance | Debug | Socket 1 received data: {"e":"ORDER_TRADE_UPDATE","T":1610638208309,"E":1610638208312,"o":{"s":"BTCUSDT","c":"6bngw21DJGGemRmdGN9eQe","S":"BUY","o":"MARKET","f":"GTC","q":"1","p":"0","ap":"0","sp":"0","x":"NEW","X":"NEW","i":2611733004,"l":"0","z":"0","L":"0","T":1610638208309,"t":0,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"MARKET","ps":"BOTH","cp":false,"rp":"0","pP":false,"si":0,"ss":0}} USDT FUTURE ORDER SUCCESSFUL 2021/01/14 10:30:07:679 | Binance | Debug | [8] Creating request for https://testnet.binancefuture.com/dapi/v1/order 2021/01/14 10:30:07:680 | Binance | Debug | [8] Sending POST signed request to https://testnet.binancefuture.com/dapi/v1/order with request body quantity=1&recvWindow=5000&side=BUY&signature=336904923664A5B5CC7FBC84B34144B82A915B42D29FCAD50185656239E9FD8C&symbol=BTCUSD_210326×tamp=1610638208442&type=MARKET 2021/01/14 10:30:07:685 | Binance | Debug | { "e": "ORDER_TRADE_UPDATE", "T": 1610638208309, "E": 1610638208312, "o": { "s": "BTCUSDT", "c": "6bngw21DJGGemRmdGN9eQe", "S": "BUY", "o": "MARKET", "f": "GTC", "q": "1", "p": "0", "ap": "0", "sp": "0", "x": "NEW", "X": "NEW", "i": 2611733004, "l": "0", "z": "0", "L": "0", "T": 1610638208309, "t": 0, "b": "0", "a": "0", "m": false, "R": false, "wt": "CONTRACT_PRICE", "ot": "MARKET", "ps": "BOTH", "cp": false, "rp": "0", "pP": false, "si": 0, "ss": 0 } } USDT FUTURE ORDER UPDATE RECEIVED 2021/01/14 10:30:07:705 | Binance | Debug | Socket 1 received data: {"e":"ACCOUNT_UPDATE","T":1610638208309,"E":1610638208312,"a":{"B":[{"a":"USDT","wb":"41155.75036105","cw":"41155.75036105"}],"P":[{"s":"BTCUSDT","pa":"5","ep":"39560.50000","cr":"41904.65494994","up":"1408.83485865","mt":"cross","iw":"0","ps":"BOTH","ma":"USDT"},{"s":"BTCUSDT","pa":"0","ep":"0.00000","cr":"-9108.66000000","up":"0","mt":"cross","iw":"0","ps":"LONG","ma":"USDT"},{"s":"BTCUSDT","pa":"0","ep":"0.00000","cr":"4421.03000000","up":"0","mt":"cross","iw":"0","ps":"SHORT","ma":"USDT"}],"m":"ORDER"}} 2021/01/14 10:30:07:734 | Binance | Debug | Socket 1 received data: {"e":"ORDER_TRADE_UPDATE","T":1610638208309,"E":1610638208312,"o":{"s":"BTCUSDT","c":"6bngw21DJGGemRmdGN9eQe","S":"BUY","o":"MARKET","f":"GTC","q":"1","p":"0","ap":"39849.93000","sp":"0","x":"TRADE","X":"FILLED","i":2611733004,"l":"1","z":"1","L":"39849.93","n":"15.93997200","N":"USDT","T":1610638208309,"t":154402974,"b":"0","a":"0","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"MARKET","ps":"BOTH","cp":false,"rp":"0","pP":false,"si":0,"ss":0}} 2021/01/14 10:30:07:736 | Binance | Debug | { "e": "ORDER_TRADE_UPDATE", "T": 1610638208309, "E": 1610638208312, "o": { "s": "BTCUSDT", "c": "6bngw21DJGGemRmdGN9eQe", "S": "BUY", "o": "MARKET", "f": "GTC", "q": "1", "p": "0", "ap": "39849.93000", "sp": "0", "x": "TRADE", "X": "FILLED", "i": 2611733004, "l": "1", "z": "1", "L": "39849.93", "n": "15.93997200", "N": "USDT", "T": 1610638208309, "t": 154402974, "b": "0", "a": "0", "m": false, "R": false, "wt": "CONTRACT_PRICE", "ot": "MARKET", "ps": "BOTH", "cp": false, "rp": "0", "pP": false, "si": 0, "ss": 0 } } USDT FUTURE ORDER UPDATE RECEIVED 2021/01/14 10:30:08:293 | Binance | Debug | [8] Response received in 611ms: {"orderId":14702153,"symbol":"BTCUSD_210326","pair":"BTCUSD","status":"NEW","clientOrderId":"p1MIkOR8gRUjLUKWIwhAaO","price":"0","avgPrice":"0.0","origQty":"1","executedQty":"0","cumQty":"0","cumBase":"0","timeInForce":"GTC","type":"MARKET","reduceOnly":false,"closePosition":false,"side":"BUY","positionSide":"BOTH","stopPrice":"0","workingType":"CONTRACT_PRICE","priceProtect":false,"origType":"MARKET","updateTime":1610638208959} COIN FUTURE ORDER SUCCESSFUL