Skip to content

ibflex.client.download only appears to work after I manually log-in to IBKR account #116

Description

@cppt

Attempting to retrive a flex query for my IBKR account and when I run the below, I'm initially met with timeout errors seemingly due to lack of IBKR rresponse:

response = client.download(FLEX_TOKEN, QUERY_ID) 

> StatementGenerationTimeout                Traceback (most recent call last)
> Cell In[47], line 1
> ----> 1 response = client.download(FLEX_TOKEN, QUERY_ID)  
>       2 nav_df = parse_nav_data(response)
>       3 data_rows = nav_df.iloc[1::2, 0].tolist()    
> 
> File ~/.uv_envs/dev_312/lib/python3.12/site-packages/ibflex/client.py:123, in download(token, query_id, max_tries)
>     121     status = check_statement_response(response)
>     122     if max_tries and tries > max_tries:
> --> 123         raise StatementGenerationTimeout(
>     124             "Exceeded max number of tries while attempting download"
>     125         )
>     126 return response.content
> 
> StatementGenerationTimeout: Exceeded max number of tries while attempting download

In attempting to debug the last couple times, I've logged in to my account via web to check token, query id, etc, after which running the same now returns the query results. Is this an expected/needed step to take to use the client download method(s) or is there some other reason it appears to work this way?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions