jamsix / ib-edavki

Skripta, ki prevede XML poročilo trgovalnih poslov v platformi InteractiveBrokers v XML format primeren za uvoz v obrazce Doh-KDVP, D-IFI, Doh-Div in Doh-Obr v eDavkih Finančne uprave.
MIT License
173 stars 57 forks source link

KeyError: 'assetType' #82

Closed pronebird closed 1 year ago

pronebird commented 1 year ago

Breaks down with the following error:

Traceback (most recent call last):
  File "/usr/local/bin/ib-edavki", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/ib_edavki.py", line 570, in main
    if trade["assetType"] == "normal" and trade["positionType"] == "long":
KeyError: 'assetType'

I looked into it and it seems that it doesn't know the FXCFD type which is basically a CFD on currency, i.e GBP.USD or EUR.USD.

jamsix commented 1 year ago

Yes, should be easy, just add FXCFD to these 3 lines:

https://github.com/jamsix/ib-edavki/blob/233acbbcf6d96e058f6306e39f12a897aac2ad6d/ib_edavki.py#L20 https://github.com/jamsix/ib-edavki/blob/233acbbcf6d96e058f6306e39f12a897aac2ad6d/ib_edavki.py#L909 https://github.com/jamsix/ib-edavki/blob/233acbbcf6d96e058f6306e39f12a897aac2ad6d/ib_edavki.py#L997

Will you do the PR?

pronebird commented 1 year ago

@jamsix thanks, figured that out. PR: https://github.com/jamsix/ib-edavki/pull/83