Closed inventzia closed 3 years ago
Hello @inventzia thanks for reaching. I thought we do already, let me check. We're you able to use it or not? I personality tested this code before merging it.
Please give me update.
@inventzia did you figure out the unhandled message?
Looks strange to me..
hi, thanks for reaching back. A bit of context to help. I am using the compiled dll libs that I get here: https://www.nuget.org/packages/IQFeed.CSharpApiClient/2.5.1
instantiating and using them from python. The Level2MessageHandler in the switch statement has a default case which throws a generic unhelpful exception. If it is not too much trouble, if you could please print out the detailed message that is not handled there in the exception string and redeploy to nutmeg I would be able to find out what message is actually unhandled and we could take it from there?
hi @inventzia yes yes I was already getting this part. The thing I'm not getting is when do you get this message. Looks strange to me. Could you please share the snippet of code you are using? I need to know the exact sequence. Do you have a subscription to IQFeed L2? Let me do this improvement. I think this is something nice to have anyway. Lets figure this out. I might also involve IQFeed support into it.
hi, thanks for the quick response. The attached snippet produced the error above.
I am not sure our subscription for L2 is valid. We have one for L1 and Intervals. Could that exception have been generated in the case of missing permissions? (https://github.com/mathpaquette/IQFeed.CSharpApiClient/files/5666284/test_python_snippet.txt)
@inventzia yeah... you probably missing the error message... use this instead:
assembly_path = r"C:\DEV\src\python-iqfeed\lib"
import sys
sys.path.append(assembly_path)
import clr
clr.AddReference("IQFeed.CSharpApiClient")
from IQFeed.CSharpApiClient import IQFeedLauncher
IQFeedLauncher.Start()
from IQFeed.CSharpApiClient.Streaming.Level2 import Level2ClientFactory
import time
# Create Level2 client
level2Client = Level2ClientFactory.CreateNew()
# Level 2 handler function
def level2UpdateSummaryHandler(msg):
print(msg)
# Subscribe to Summary/Update events
level2Client.System += level2UpdateSummaryHandler
level2Client.Error += level2UpdateSummaryHandler
level2Client.Summary += level2UpdateSummaryHandler
level2Client.Update += level2UpdateSummaryHandler
# Connect
level2Client.Connect()
# Request streaming
level2Client.ReqWatch("AAPL")
# Wait 30 seconds
time.sleep(30)
im getting: Error: Account not authorized for Level II Type: CURRENT PROTOCOL, Message: S,CURRENT PROTOCOL,6.0,
hi, thanks for the clarification and the suggestion of adding the handler to the System listener. I have not seen that exception since. Do you think that in my original exception is explained by not having handled System messages? Many thanks and regards
Feel free to star the project if you find it useful :) thanks
Indeed well done and organized.
hi, I am trying to use this library as a way to get streaming L2 data from iqfeed via python as a dll. When I try to request watch on a Level2Client I get the error below. It would be good to escalate in the exception message the actual unhandled message as a string. Many thanks.
Unhandled Exception: System.Exception: Unknown type of level 2 message received. at IQFeed.CSharpApiClient.Streaming.Level2.Level2MessageHandler.ProcessMessages(Byte[] messageBytes, Int32 count) at IQFeed.CSharpApiClient.Extensions.EventExtensions.RaiseEvent[T](EventHandler`1 event, Object sender, T e) at IQFeed.CSharpApiClient.Socket.SocketClient.ProcessReceive(SocketAsyncEventArgs e) at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags) at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped pOVERLAP)