agusalex / ghostfolio-sync

Sync Ghostfolio with IBKR
34 stars 9 forks source link

Issue when running container #20

Closed Trefex closed 4 months ago

Trefex commented 4 months ago

Hi,

I tried your container, i rebuilt it for ARM, and I receive following error.

Not sure how to proceed?

Many thanks, T


[sysadmin@rocky-4gb-fsn1-rc-1 ghostfolio-sync]$ podman run -e GHOST_TOKEN=$GHOST_TOKEN -e IBKR_TOKEN=$IBKR_TOKEN -e IBKR_QUERY=$IBKR_QUERY localhost/trefex/ghostfolio-sync
[2024-07-07 22:10:00] Starting ghostfolio-sync Docker...
[2024-07-07 22:10:00] Crontab Not Present running one time now
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 115, in parse_data_element
    attrs = dict(
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 116, in <genexpr>
    parse_element_attr(Class, k, v)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 156, in parse_element_attr
    Type = Class.__annotations__[name]
KeyError: 'issuerCountryCode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/app/src/main.py", line 22, in <module>
    ghost.sync_ibkr()
  File "/usr/app/src/SyncIBKR.py", line 71, in sync_ibkr
    query: FlexQueryResponse = parser.parse(response)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 53, in parse
    parsed = parse_element(root)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 85, in parse_element
    return parse_data_element(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 80, in parse_element
    return parse_element_container(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 83, in parse_element
    return parse_element_container(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 121, in parse_data_element
    raise FlexParserError(msg)
ibflex.parser.FlexParserError: Trade has no attribute 'issuerCountryCode'
[2024-07-07 22:10:07] Starting sync
[2024-07-07 22:10:07] Fetching Query
[2024-07-07 22:10:07] Parsing Query```
agusalex commented 4 months ago

Hey @Trefex thats probably because IBKR keeps adding fields to their API. I just updated the IBflex lib, try rebuilding from scratch now.

Trefex commented 4 months ago

@agusalex Nice!!

After re-running, now it fails again


[2024-07-08 13:42:40] Crontab Not Present running one time now
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 115, in parse_data_element
    attrs = dict(
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 116, in <genexpr>
    parse_element_attr(Class, k, v)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 156, in parse_element_attr
    Type = Class.__annotations__[name]
KeyError: 'rtn'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/app/src/main.py", line 23, in <module>
    ghost.sync_ibkr()
  File "/usr/app/src/SyncIBKR.py", line 72, in sync_ibkr
    query: FlexQueryResponse = parser.parse(response)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 53, in parse
    parsed = parse_element(root)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 85, in parse_element
    return parse_data_element(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 80, in parse_element
    return parse_element_container(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in parse_data_element
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 125, in <dictcomp>
    contained_elements = {child.tag: parse_element(child) for child in elem}
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 83, in parse_element
    return parse_element_container(elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in parse_element_container
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 101, in <genexpr>
    instances = tuple(parse_data_element(child) for child in elem)
  File "/usr/local/lib/python3.9/site-packages/ibflex/parser.py", line 121, in parse_data_element
    raise FlexParserError(msg)
ibflex.parser.FlexParserError: Trade has no attribute 'rtn'```
agusalex commented 4 months ago

Yes but different error! one step closer. Added rtn now to the model, try again please!

agusalex commented 4 months ago

This is the repo where I update the models, feel free to fork that repo and play with the model on your own if it keeps on failing https://github.com/agusalex/ibflex https://github.com/agusalex/ibflex/commit/fb32fc570b135e2bd1bacd894a7e732d39737c73

You just need to point the requirements.txt on ghostfolio-sync to your own fork. When its ready open a PR and let me know so we can merge it.