Code Monkey home page Code Monkey logo

Comments (12)

gribunin avatar gribunin commented on June 29, 2024 1

As I said it was probably IqFeed who sent the bad data. I do have requested tickers in my logs, but they receive good replies when being requested at the moment. I think it was something going on IqFeed side exactly at that moment (Jan 27, 5:35 PM EST), because the service continue to crash after automatic restart several times.

Nevertheless we must be somehow prepared for such situation (bad data from the vendor) and have an ability to handle it gracefuly. I am going to make a fix in a day or so, can file it as a PR.

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

@gribunin do you remember the ticker? Are you able to reproduce?

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

@gribunin absolutely this is bad data from the vendor. I dont want to change the types as already mention in another discussion. What are you suggesting ? Using TryParse instead like we do for streaming data? If it doesnt parse properly we need to be aware in other to drop the bad data.

from iqfeed.csharpapiclient.

gribunin avatar gribunin commented on June 29, 2024

I am suggesting to have a global try/catch in SocketClient.ProcessReceive, also add an event handler OnException to SocketClient, pass the caught exception object to this handler. Then subscribe to this event handler (OnException) in GetMessagesAsync and rethrow the exception passed to this handler there.

This way, the calls to lookupClient.Historical.GetHistoryTickDatapointsAsync and other API methods wrapped to try/catch will catch these exceptions.

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

I am suggesting to have a global try/catch in SocketClient.ProcessReceive, also add an event handler OnException to SocketClient, pass the caught exception object to this handler. Then subscribe to this event handler (OnException) in GetMessagesAsync and rethrow the exception passed to this handler there.

This way, the calls to lookupClient.Historical.GetHistoryTickDatapointsAsync and other API methods wrapped to try/catch will catch these exceptions.

not sure I like this solution. Maybe converting all Parse to TryParse makes more sense to me.

from iqfeed.csharpapiclient.

gribunin avatar gribunin commented on June 29, 2024

If convert Parse to TryParse what is going to be done when TryParse fails? The calling method will throw an exception?

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

If convert Parse to TryParse what is going to be done when TryParse fails? The calling method will throw an exception?

not at all.... TryParse doesnt throw.

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

@gribunin please., lets start with this first. create a PR converting double.Parse DateTime.ParseExact int.Parse
like we do in UpdateSummaryMessage

from iqfeed.csharpapiclient.

gribunin avatar gribunin commented on June 29, 2024

I see what you mean. Do you think its a correct approach to swallow bad data from iqfeed and just return zeros in the fields which couldnt be parsed? How will a client know that its not a correct TickMessage and that actually bad data has been received?

from iqfeed.csharpapiclient.

gribunin avatar gribunin commented on June 29, 2024

Added a pull request (#97) with my idea to catch exceptions and marshal them to the caller context. This way the caller can catch the situation when IqFeed returned bad data, handle this situation as the caller needs. The thrown exception also provides additional information about what exactly failed to be parsed as long as context information (request, received message -- same as in other IQFeedExceptions).

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

@gribunin I'm about to push a slightly enhanced version as well. I'll add you as a reviewer.

from iqfeed.csharpapiclient.

mathpaquette avatar mathpaquette commented on June 29, 2024

@gribunin please check my PR.

from iqfeed.csharpapiclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.