Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip bad lines #13

Open
mzaja opened this issue Nov 13, 2022 · 2 comments
Open

Skip bad lines #13

mzaja opened this issue Nov 13, 2022 · 2 comments

Comments

@mzaja
Copy link

mzaja commented Nov 13, 2022

I tried using this module on manually collected data using betfairlightweight. The problem is that my files contain market book data as the first line of the file (which is necessary to obtain selection's names). I thought that the parser will just skip over the unrecognized line and perhaps warn about it, but instead it crashes and burns.

Would it be possible to update it parses so that it skips over unrecognized lines instead of tapping out? If that behaviour is desired, how about adding a skip_bad_lines option to give end users a choice? I would imagine I am not the only person in this situation.

@tarb
Copy link
Owner

tarb commented Nov 17, 2022

Sorry about the slow reply I've been a bit busy. I agree that this sounds like a good idea and something I should implement - in the mean time tho you should be able to bypass this by reading in the file as bytes, searching and slicing it at the first new line, and then passing the remainder into bfd.File(path, byte_slice_minus_first_line). Happy to offer more help if you need

@mzaja
Copy link
Author

mzaja commented Nov 18, 2022

Hey, no problem :). Yes, that is exactly what I did. Since I also capture both at* and bdat* data, I used the same adapter to filter out bdat* lines which are not supported.

I also noticed that the parser bombs out on "initialClk", "conflateMs", "heartbeatMs" and "ct" fields, which are sent when a subscription is made, together with the initial image (https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Exchange+Stream+API#ExchangeStreamAPI-Subscription/SubscriptionMessage). They may also be sent on re-subscription, I do not know. In any case, you may want to prevent the parser erroring on those fields as well, since manually captured stream data will likely contain those fields on the first line (unless manually removed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants