csingley / ibflex

Python parser for Interactive Brokers Flex XML statements
MIT License
87 stars 43 forks source link

Adding max_tries optional argument to download #28

Closed troyev closed 3 years ago

troyev commented 3 years ago

This adds an optional max_tries parameter to the download function that will throw StatementGenerationTimeout if exceeded.

Sometimes, especially on the weekend, the flex server responds with ("1019", "Statement generation in progress. Please try again shortly.") but it doesn't finish in any reasonable amount of time, and just keeps responding with 1019.

I suspect that their API server is up, but some other server the Flex service depends on is down. Having a max_tries makes it easy for an application to bail on the download if desired.

csingley commented 3 years ago

Good idea. The flex client is the worst code in this library; please don't be shy about improving it.