Hi,
I am using LEAN CLI locally to live trading Binance.
In 'def Initialize(self)', I already successfully added over 200 coins using the below function.
self.AddCrypto('BTSUDST', Resolution.Minute, Market.Binance)And in Ondata function, I just want to simply test if I can get all (over 200) coins' minute data.def OnData(self, data): self.Debug(data.Time) self.Debug('total symbol number is %s' %len(data.keys())) for symbol in data.keys(): # self.Debug(symbol.Value) self.Debug('symbol %s price is %s' %(symbol, data[symbol].Close)) And I find out I can only get 13 coins' minute data output.Is there any limiation for this in LEAN CLI, or Binance do rate limiation? It seems Binancecan support 1200 requests per minute base on document.Also in log file, I can find many informaiton like below. Is it the reason I can only get around 13 coins minute data even I subscribe over 200 coins' data? 2021-05-13T02:12:13.0576694Z ERROR:: WebSocketClientWrapper.OnError(): WebSocketClientWrapper.OnError(): (IsOpen:True, State:Open): wss://stream.binance.com:9443/ws/NjylvVj2rEUPz8a7eptepxqYKUUeAQzErdOdKvrhT7Ueubpc80mnnqsAVD0n: The remote party closed the WebSocket connection without completing the close handshake. System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. ---> System.IO.IOException: Unable to write data to the transport connection: Broken pipe.
Jasper van Merle
Hi Henry,
This appears to be LEAN hitting the rate limit of Binance's WebSocket. I have opened an issue for it on GitHub, you can track its progress by subscribing to it.
Jasper van Merle
Hi Henry,
Now that the issue linked above is fixed you can run the lean live command with the --update flag to update to the latest version, which no longer hits Binance's rate limit.
Henry111
HI, Jasper
Thanks for the quick update!
I did a test again, it looks much better. But still can get maximum get 128 coins data in minute Ondata function.
For example. I want to get all USDT related coins minute data, which is totally 222.
['BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'NEOUSDT', 'LTCUSDT', 'QTUMUSDT', 'ADAUSDT', 'XRPUSDT', 'EOSUSDT', 'TUSDUSDT', 'IOTAUSDT', 'XLMUSDT', 'ONTUSDT', 'TRXUSDT', 'ETCUSDT', 'ICXUSDT', 'NULSUSDT', 'VETUSDT', 'PAXUSDT', 'BCHUSDT', 'USDCUSDT', 'LINKUSDT', 'WAVESUSDT', 'BTTUSDT', 'ONGUSDT', 'HOTUSDT', 'ZILUSDT', 'ZRXUSDT', 'FETUSDT', 'BATUSDT', 'XMRUSDT', 'ZECUSDT', 'IOSTUSDT', 'CELRUSDT', 'DASHUSDT', 'NANOUSDT', 'OMGUSDT', 'THETAUSDT', 'ENJUSDT', 'MITHUSDT', 'MATICUSDT', 'ATOMUSDT', 'TFUELUSDT', 'ONEUSDT', 'FTMUSDT', 'ALGOUSDT', 'GTOUSDT', 'DOGEUSDT', 'DUSKUSDT', 'ANKRUSDT', 'WINUSDT', 'COSUSDT', 'COCOSUSDT', 'MTLUSDT', 'TOMOUSDT', 'PERLUSDT', 'DENTUSDT', 'MFTUSDT', 'KEYUSDT', 'DOCKUSDT', 'WANUSDT', 'FUNUSDT', 'CVCUSDT', 'CHZUSDT', 'BANDUSDT', 'BUSDUSDT', 'BEAMUSDT', 'XTZUSDT', 'RENUSDT', 'RVNUSDT', 'HBARUSDT', 'NKNUSDT', 'STXUSDT', 'KAVAUSDT', 'ARPAUSDT', 'IOTXUSDT', 'RLCUSDT', 'CTXCUSDT', 'TROYUSDT', 'VITEUSDT', 'FTTUSDT', 'EURUSDT', 'OGNUSDT', 'DREPUSDT', 'TCTUSDT', 'WRXUSDT', 'BTSUSDT', 'LSKUSDT', 'BNTUSDT', 'LTOUSDT', 'AIONUSDT', 'MBLUSDT', 'COTIUSDT', 'STPTUSDT', 'WTCUSDT', 'DATAUSDT', 'SOLUSDT', 'CTSIUSDT', 'HIVEUSDT', 'CHRUSDT', 'GXSUSDT', 'ARDRUSDT', 'MDTUSDT', 'STMXUSDT', 'KNCUSDT', 'REPUSDT', 'LRCUSDT', 'PNTUSDT', 'COMPUSDT', 'SCUSDT', 'ZENUSDT', 'SNXUSDT', 'VTHOUSDT', 'DGBUSDT', 'GBPUSDT', 'SXPUSDT', 'MKRUSDT', 'DCRUSDT', 'STORJUSDT', 'MANAUSDT', 'AUDUSDT', 'YFIUSDT', 'BALUSDT', 'BLZUSDT', 'IRISUSDT', 'KMDUSDT', 'JSTUSDT', 'SRMUSDT', 'ANTUSDT', 'CRVUSDT', 'SANDUSDT', 'OCEANUSDT', 'NMRUSDT', 'DOTUSDT', 'LUNAUSDT', 'RSRUSDT', 'PAXGUSDT', 'WNXMUSDT', 'TRBUSDT', 'BZRXUSDT', 'SUSHIUSDT', 'YFIIUSDT', 'KSMUSDT', 'EGLDUSDT', 'DIAUSDT', 'RUNEUSDT', 'FIOUSDT', 'UMAUSDT', 'BELUSDT', 'WINGUSDT', 'UNIUSDT', 'NBSUSDT', 'OXTUSDT', 'SUNUSDT', 'AVAXUSDT', 'HNTUSDT', 'FLMUSDT', 'ORNUSDT', 'UTKUSDT', 'XVSUSDT', 'ALPHAUSDT', 'AAVEUSDT', 'NEARUSDT', 'FILUSDT', 'INJUSDT', 'AUDIOUSDT', 'CTKUSDT', 'AKROUSDT', 'AXSUSDT', 'HARDUSDT', 'DNTUSDT', 'STRAXUSDT', 'UNFIUSDT', 'ROSEUSDT', 'AVAUSDT', 'XEMUSDT', 'SKLUSDT', 'SUSDUSDT', 'GRTUSDT', 'JUVUSDT', 'PSGUSDT', '1INCHUSDT', 'REEFUSDT', 'OGUSDT', 'ATMUSDT', 'ASRUSDT', 'CELOUSDT', 'RIFUSDT', 'BTCSTUSDT', 'TRUUSDT', 'CKBUSDT', 'TWTUSDT', 'FIROUSDT', 'LITUSDT', 'SFPUSDT', 'DODOUSDT', 'CAKEUSDT', 'ACMUSDT', 'BADGERUSDT', 'FISUSDT', 'OMUSDT', 'PONDUSDT', 'DEGOUSDT', 'ALICEUSDT', 'LINAUSDT', 'PERPUSDT', 'RAMPUSDT', 'CFXUSDT', 'EPSUSDT', 'AUTOUSDT', 'TKOUSDT', 'PUNDIXUSDT', 'TLMUSDT', 'BTGUSDT', 'MIRUSDT', 'BARUSDT', 'FORTHUSDT', 'BAKEUSDT', 'BURGERUSDT', 'SLPUSDT', 'SHIBUSDT', 'ICPUSDT']
I already add all of them successfully self.AddCrypto(symbol, Resolution.Minute, Market.Binance) for all 222 coins.
In OnData function, I can get maximum 128 coins output for below;
['ADAUSDT', 'AIONUSDT', 'ALGOUSDT', 'ANKRUSDT', 'ARDRUSDT', 'ATOMUSDT', 'BALUSDT', 'BANDUSDT', 'BATUSDT', 'BCHUSDT', 'BEAMUSDT', 'BLZUSDT', 'BNBUSDT', 'BTCUSDT', 'BTTUSDT', 'BUSDUSDT', 'CELRUSDT', 'CHRUSDT', 'CHZUSDT', 'COCOSUSDT', 'COMPUSDT', 'COSUSDT', 'COTIUSDT', 'CRVUSDT', 'CTSIUSDT', 'CTXCUSDT', 'CVCUSDT', 'DASHUSDT', 'DATAUSDT', 'DENTUSDT', 'DOGEUSDT', 'DOTUSDT', 'DUSKUSDT', 'ENJUSDT', 'EOSUSDT', 'ETCUSDT', 'ETHUSDT', 'EURUSDT', 'FETUSDT', 'FTMUSDT', 'FTTUSDT', 'FUNUSDT', 'GBPUSDT', 'GTOUSDT', 'HBARUSDT', 'HOTUSDT', 'ICXUSDT', 'IOSTUSDT', 'IOTAUSDT', 'IOTXUSDT', 'KAVAUSDT', 'KEYUSDT', 'KNCUSDT', 'LINKUSDT', 'LRCUSDT', 'LTCUSDT', 'LTOUSDT', 'LUNAUSDT', 'MANAUSDT', 'MATICUSDT', 'MBLUSDT', 'MFTUSDT', 'MITHUSDT', 'MKRUSDT', 'MTLUSDT', 'NANOUSDT', 'NEOUSDT', 'NKNUSDT', 'NULSUSDT', 'OGNUSDT', 'OMGUSDT', 'ONEUSDT', 'ONTUSDT', 'PAXUSDT', 'PERLUSDT', 'PNTUSDT', 'QTUMUSDT', 'RENUSDT', 'RLCUSDT', 'RVNUSDT', 'SCUSDT', 'SNXUSDT', 'SOLUSDT', 'STMXUSDT', 'STORJUSDT', 'STPTUSDT', 'STXUSDT', 'SXPUSDT', 'TCTUSDT', 'TFUELUSDT', 'THETAUSDT', 'TOMOUSDT', 'TROYUSDT', 'TRXUSDT', 'USDCUSDT', 'VETUSDT', 'WAVESUSDT', 'WINUSDT', 'WTCUSDT', 'XLMUSDT', 'XMRUSDT', 'XRPUSDT', 'XTZUSDT', 'YFIUSDT', 'ZECUSDT', 'ZILUSDT', 'ZRXUSDT', 'ARPAUSDT', 'BNTUSDT', 'DCRUSDT', 'DREPUSDT', 'GXSUSDT', 'HIVEUSDT', 'IRISUSDT', 'JSTUSDT', 'KMDUSDT', 'LSKUSDT', 'NMRUSDT', 'OCEANUSDT', 'ONGUSDT', 'PAXGUSDT', 'REPUSDT', 'RSRUSDT', 'SRMUSDT', 'TUSDUSDT', 'VITEUSDT', 'WANUSDT', 'ZENUSDT']
And below 94 coins data still missing. I check in Binance GUI, the minute do exist there, but LEAN cannot get it in the minute OnData function. Is it because 128 coins is the maximum?
['DOCKUSDT', 'WRXUSDT', 'BTSUSDT', 'MDTUSDT', 'VTHOUSDT', 'DGBUSDT', 'AUDUSDT', 'ANTUSDT', 'SANDUSDT', 'WNXMUSDT', 'TRBUSDT', 'BZRXUSDT', 'SUSHIUSDT', 'YFIIUSDT', 'KSMUSDT', 'EGLDUSDT', 'DIAUSDT', 'RUNEUSDT', 'FIOUSDT', 'UMAUSDT', 'BELUSDT', 'WINGUSDT', 'UNIUSDT', 'NBSUSDT', 'OXTUSDT', 'SUNUSDT', 'AVAXUSDT', 'HNTUSDT', 'FLMUSDT', 'ORNUSDT', 'UTKUSDT', 'XVSUSDT', 'ALPHAUSDT', 'AAVEUSDT', 'NEARUSDT', 'FILUSDT', 'INJUSDT', 'AUDIOUSDT', 'CTKUSDT', 'AKROUSDT', 'AXSUSDT', 'HARDUSDT', 'DNTUSDT', 'STRAXUSDT', 'UNFIUSDT', 'ROSEUSDT', 'AVAUSDT', 'XEMUSDT', 'SKLUSDT', 'SUSDUSDT', 'GRTUSDT', 'JUVUSDT', 'PSGUSDT', '1INCHUSDT', 'REEFUSDT', 'OGUSDT', 'ATMUSDT', 'ASRUSDT', 'CELOUSDT', 'RIFUSDT', 'BTCSTUSDT', 'TRUUSDT', 'CKBUSDT', 'TWTUSDT', 'FIROUSDT', 'LITUSDT', 'SFPUSDT', 'DODOUSDT', 'CAKEUSDT', 'ACMUSDT', 'BADGERUSDT', 'FISUSDT', 'OMUSDT', 'PONDUSDT', 'DEGOUSDT', 'ALICEUSDT', 'LINAUSDT', 'PERPUSDT', 'RAMPUSDT', 'CFXUSDT', 'EPSUSDT', 'AUTOUSDT', 'TKOUSDT', 'PUNDIXUSDT', 'TLMUSDT', 'BTGUSDT', 'MIRUSDT', 'BARUSDT', 'FORTHUSDT', 'BAKEUSDT', 'BURGERUSDT', 'SLPUSDT', 'SHIBUSDT', 'ICPUSDT']
Henry111
HI,
I did several tests again, sometimes I can get 128 coins minute data return, sometimes can get 134 coins to return, etc.
Also in the logs, I can see below:
2021-05-14T18:45:43.1040607Z TRACE:: Brokerage.OnMessage(): Warning - Code: InvalidTickType - Quote tick type not supported, no history returned 2021-05-14T18:45:43.5256208Z TRACE:: Send: {"method":"SUBSCRIBE","params":["ltcusdt@trade","ltcusdt@bookTicker"],"id":526} 2021-05-14T18:45:43.5314361Z ERROR:: WebSocketClientWrapper.OnError(): WebSocketClientWrapper.OnError(): (IsOpen:True, State:Open): wss://stream.binance.com:9443/ws/19DhJEnxuXgsjWgsgnwxFB8vw62IwuN9MKHSFb187wAZyzWlBNyRCsXg6WHX: The remote party closed the WebSocket connection without completing the close handshake. System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. ---> System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException (104): Connection reset by peer at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken) at System.Net.Sockets.Socket.SendAsyncForNetworkStream(ReadOnlyMemory`1 buffer, SocketFlags socketFlags, CancellationToken cancellationToken) at System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken) at System.Net.Security.SslStream.WriteSingleChunk[TIOAdapter](TIOAdapter writeAdapter, ReadOnlyMemory`1 buffer) at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](TIOAdapter writeAdapter, ReadOnlyMemory`1 buffer) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](TIOAdapter writeAdapter, ReadOnlyMemory`1 buffer) at System.Net.Security.SslStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken) at System.Net.Http.HttpConnection.WriteToStreamAsync(ReadOnlyMemory`1 source, Boolean async) at System.Net.Http.HttpConnection.WriteWithoutBufferingAsync(ReadOnlyMemory`1 source, Boolean async) at System.Net.Http.HttpConnection.RawConnectionStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken) at System.Net.WebSockets.ManagedWebSocket.SendFrameFallbackAsync(MessageOpcode opcode, Boolean endOfMessage, ReadOnlyMemory`1 payloadBuffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at System.Net.WebSockets.ManagedWebSocket.SendFrameFallbackAsync(MessageOpcode opcode, Boolean endOfMessage, ReadOnlyMemory`1 payloadBuffer, CancellationToken cancellationToken) at System.Net.WebSockets.ManagedWebSocket.SendFrameAsync(MessageOpcode opcode, Boolean endOfMessage, ReadOnlyMemory`1 payloadBuffer, CancellationToken cancellationToken) at System.Net.WebSockets.ManagedWebSocket.SendPrivateAsync(ReadOnlyMemory`1 buffer, WebSocketMessageType messageType, Boolean endOfMessage, CancellationToken cancellationToken) at System.Net.WebSockets.ManagedWebSocket.SendAsync(ArraySegment`1 buffer, WebSocketMessageType messageType, Boolean endOfMessage, CancellationToken cancellationToken) at QuantConnect.Brokerages.WebSocketClientWrapper.Send(String data) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 58 at QuantConnect.Brokerages.Binance.BinanceBrokerage.Send(IWebSocket webSocket, Object obj) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/Binance/BinanceBrokerage.cs:line 464 at QuantConnect.Brokerages.Binance.BinanceBrokerage.Subscribe(IEnumerable`1 symbols) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/Binance/BinanceBrokerage.cs:line 411 at QuantConnect.Brokerages.BaseWebsocketsBrokerage.<.ctor>b__8_0(Object sender, EventArgs args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/BaseWebsocketsBrokerage.cs:line 92 at QuantConnect.Brokerages.WebSocketClientWrapper.OnOpen() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 177 at QuantConnect.Brokerages.WebSocketClientWrapper.HandleConnection(CancellationTokenSource connectionCts) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 197 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult() at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Net.Http.HttpConnection.ReadNextResponseHeaderLineAsync(Boolean async, Boolean foldedHeadersAllowed) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult() at System.Net.Http.HttpConnection.FillAsync(Boolean async) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.InvokeContinuation(Action`1 continuation, Object state, Boolean forceAsync, Boolean requiresExecutionContextFlow) at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() --- End of stack trace from previous location --- --- End of inner exception stack trace --- at System.Net.Security.SslStream.<WriteSingleChunk>g__CompleteWriteAsync|177_1[TIOAdapter](ValueTask writeTask, Byte[] bufferToReturn) at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](TIOAdapter writeAdapter, ReadOnlyMemory`1 buffer) at System.Net.WebSockets.ManagedWebSocket.SendFrameFallbackAsync(MessageOpcode opcode, Boolean endOfMessage, ReadOnlyMemory`1 payloadBuffer, CancellationToken cancellationToken) at System.Net.WebSockets.ManagedWebSocket.SendFrameFallbackAsync(MessageOpcode opcode, Boolean endOfMessage, ReadOnlyMemory`1 payloadBuffer, CancellationToken cancellationToken) at QuantConnect.Extensions.SynchronouslyAwaitTask(Task task) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Extensions.cs:line 2566 at QuantConnect.Brokerages.WebSocketClientWrapper.Send(String data) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 60 at QuantConnect.Brokerages.Binance.BinanceBrokerage.Send(IWebSocket webSocket, Object obj) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/Binance/BinanceBrokerage.cs:line 465 at QuantConnect.Brokerages.Binance.BinanceBrokerage.Subscribe(IEnumerable`1 symbols) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/Binance/BinanceBrokerage.cs:line 411 at QuantConnect.Brokerages.BaseWebsocketsBrokerage.<.ctor>b__8_0(Object sender, EventArgs args) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/BaseWebsocketsBrokerage.cs:line 92 at QuantConnect.Brokerages.WebSocketClientWrapper.OnOpen() in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 177 at QuantConnect.Brokerages.WebSocketClientWrapper.HandleConnection(CancellationTokenSource connectionCts) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Brokerages/WebSocketClientWrapper.cs:line 197 2021-05-14T18:45:43.5327412Z TRACE:: WebSocketClientWrapper.HandleConnection(wss://stream.binance.com:9443/ws/19DhJEnxuXgsjWgsgnwxFB8vw62IwuN9MKHSFb187wAZyzWlBNyRCsXg6WHX): Connecting... 2021-05-14T18:45:44.3212115Z TRACE:: Brokerage.OnMessage(): Warning - Code: InvalidTickType - Quote tick type not supported, no history returned 2021-05-14T18:45:44.3316804Z TRACE:: WebSocketClientWrapper.OnOpen(): Connection opened (IsOpen:True, State:Open): wss://stream.binance.com:9443/ws/19DhJEnxuXgsjWgsgnwxFB8vw62IwuN9MKHSFb187wAZyzWlBNyRCsXg6WHX 2021-05-14T18:45:44.3317129Z TRACE:: BaseWebsocketsBrokerage(): WebSocket.Open. SubscribingJasper van Merle
Hi Henry,
A few hours ago we shipped a change to the Binance brokerage to stop it from hitting a rate limit when you subscribe to a lot of symbols. Just like before, you can run the lean live command with the --update flag to update to the latest version.
Henry111
Hi, Jasper
Thanks very much to fix this rate limit issue of Binance, it seems working now.
When I run the live trading with Binance, now I can only see 2 Errors appear at the very beginning of the log file. I guess the error can be ignored since the algorithm running fine. Right?
log.txt:2021-05-23T12:30:12.9284769Z ERROR:: LiveTradingResultHandler.Update(): Algorithm not yet initialized.
log.txt:2021-05-23T12:32:02.2721940Z ERROR:: Brokerage Warning: Quote tick type not supported, no history returned
Jasper van Merle
Hi Henry,
The first error is harmless, the result handler simply tries to update itself a bit too early if LEAN takes longer than 3 seconds to initialize.
The second error I cannot reproduce locally. Can you explain when this error happens exactly? Hopefully that makes it possible to figure out where the error is coming from.
Henry111
Hi, Jasper
The 2nd error raised right after all the data subscription finished (I subscribed over 200 coins) and the OnData function run 1st time (look at below ‘count is 1’ mean the 1st time OnData begin to run every minute).
Actually only first ‘Quote tick type not supported, no history returned’ appears as en Error while rest appear as ‘Brokerage Warning’. My algorithm still working even the ‘Quote’ data missing. I think that is because my algorithm only use the ‘Trade’ data not ‘Quote’ data.
021-05-24T11:25:30.7452418Z TRACE:: Send: {"method":"SUBSCRIBE","params":["slpusdt@trade","slpusdt@bookTicker"],"id":220}
2021-05-24T11:25:30.7455621Z TRACE:: DataManager.AddSubscription(): Added SLPUSDT,SLPUSDT,Minute,QuoteBar,Quote,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:30.7457639Z TRACE:: DataManager.AddSubscription(): Added SLPUSDT,SLPUSDT,Minute,TradeBar,Trade,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:30.7462279Z TRACE:: EventBasedDataQueueHandlerSubscriptionManager.Subscribe(): SHIBUSDT
2021-05-24T11:25:30.9973693Z TRACE:: Send: {"method":"SUBSCRIBE","params":["shibusdt@trade","shibusdt@bookTicker"],"id":221}
2021-05-24T11:25:30.9976504Z TRACE:: DataManager.AddSubscription(): Added SHIBUSDT,SHIBUSDT,Minute,TradeBar,Trade,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:30.9978468Z TRACE:: DataManager.AddSubscription(): Added SHIBUSDT,SHIBUSDT,Minute,QuoteBar,Quote,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:30.9982626Z TRACE:: EventBasedDataQueueHandlerSubscriptionManager.Subscribe(): ICPUSDT
2021-05-24T11:25:31.2525240Z TRACE:: Send: {"method":"SUBSCRIBE","params":["icpusdt@trade","icpusdt@bookTicker"],"id":222}
2021-05-24T11:25:31.2527698Z TRACE:: DataManager.AddSubscription(): Added ICPUSDT,ICPUSDT,Minute,TradeBar,Trade,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:31.2529370Z TRACE:: DataManager.AddSubscription(): Added ICPUSDT,ICPUSDT,Minute,QuoteBar,Quote,Adjusted. Start: 5/24/2021 11:24:35 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:31.4025864Z TRACE:: DataManager.AddSubscription(): Added BTCUSDT,BTCUSDT,Minute,TradeBar,Trade,Adjusted,Internal. Start: 5/24/2021 11:23:00 AM. End: 12/31/2050 12:00:00 AM
2021-05-24T11:25:31.4027197Z TRACE:: UniverseSelection.AddPendingInternalDataFeeds(): Adding internal benchmark data feed BTCUSDT,BTCUSDT,Minute,TradeBar,Trade,Adjusted,Internal
2021-05-24T11:25:31.5265252Z TRACE:: Debug: Binance account base currency: USD
Changing account currency from USD to USDT...
2021-05-24T11:25:31.5813018Z TRACE:: Brokerage.OnMessage(): Warning - Code: InvalidTickType - Quote tick type not supported, no history returned
2021-05-24T11:25:34.4782844Z TRACE:: Isolator.ExecuteWithTimeLimit(): Used: 13, Sample: 20, App: 306, CurrentTimeStepElapsed: 00:02.000
2021-05-24T11:25:34.8022191Z TRACE:: Brokerage.OnMessage(): Warning - Code: InvalidTickType - Quote tick type not supported, no history returned
2021-05-24T11:26:06.5821213Z TRACE:: Debug: begin time: 2021-05-24 11:25:31.448005
count is 1
begin to collect history data
2021-05-24T11:26:06.5840494Z ERROR:: Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Brokerage Warning: Quote tick type not supported, no history returned
Jasper van Merle
Hi Henry,
I managed to reproduce the warning. As long as your algorithm doesn't try to access the non-existent quote data on the returned historic data you can safely ignore the warnings.
Henry111
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!