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: 'isin' #74

Closed aljazm closed 10 months ago

aljazm commented 1 year ago

Zdravo, nikako ne morem preko tega:

C:\Users\aljaz\Documents\IB_2021\2023>ib_edavki FURS_v1_2020.xml FURS_v1_2021.xml FURS_v1_2022.xml FURS_v1_2023.xml Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\aljaz\AppData\Local\Programs\Python\Python311\Scripts\ib_edavki.exe__main__.py", line 7, in File "C:\Users\aljaz\AppData\Local\Programs\Python\Python311\Lib\site-packages\ib_edavki.py", line 325, in main trade["symbol"], trade["isin"], trade["tradeDate"]


KeyError: 'isin'

Hvala, Aljaz
dlisjak commented 1 year ago

Isto tukaj... Obstaja rešitev?

EDIT: Problem je, ker so nekatere vrednosti v XML file-u prazne. Odstrani te securityje ven z file-a in pozeni ponovno.

ctrl + f: isin=""

good luck

jamsix commented 1 year ago

This is probably a https://github.com/jamsix/ib-edavki/pull/69 regression bug. @nikegp do you have time to take a look?

IB reports generated in 2021 or prior don't have ISINs.

nikegp commented 1 year ago

Generated in 2020 or generated now for year 2020?

jamsix commented 1 year ago

Reports generated in 2021 or before don't have isin. They only have conid (IB's internal unique security ID) and symbol (unfortunately not unique). Generating them now for past years adds isin, but that might not be possible if you switched brokers, etc (as is in my case). An ideal algorithm would be such that matches securites from different years using the following order of precedence:

jamsix commented 1 year ago

@aljazm @dlisjak can you guys try again with the latest version? @nikegp has replaced isin with conid which should be present in reports going all the way back to at least 2017 as per my experience.

aljazm commented 1 year ago

I am still getting the isin error. I generated all the files for past years on the same day (this year). Deleting isin="" lines resolves the issue and generates the FURS files.

C:\Users\aljaz\Documents\IB_2021\2023>pip install --upgrade git+https://github.com/jamsix/ib-edavki.git Collecting git+https://github.com/jamsix/ib-edavki.git Cloning https://github.com/jamsix/ib-edavki.git to c:\users\aljaz\appdata\local\temp\pip-req-build-e3li4iat Running command git clone --filter=blob:none --quiet https://github.com/jamsix/ib-edavki.git 'C:\Users\aljaz\AppData\Local\Temp\pip-req-build-e3li4iat' Resolved https://github.com/jamsix/ib-edavki.git to commit b70dd54ada952b7a8b4c9f13c8e82832eda78e93 Preparing metadata (setup.py) ... done

C:\Users\aljaz\Documents\IB_2021\2023>ib_edavki FURS_v1_2020.xml FURS_v1_2021.xml FURS_v1_2022.xml FURS_v1_2023.xml Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\aljaz\AppData\Local\Programs\Python\Python311\Scripts\ib_edavki.exe__main__.py", line 7, in File "C:\Users\aljaz\AppData\Local\Programs\Python\Python311\Lib\site-packages\ib_edavki.py", line 325, in main trade["symbol"], trade["isin"], trade["tradeDate"]


KeyError: 'isin'
nikegp commented 1 year ago

@aljazm the latest version doesn't have isin key on line 325 https://github.com/jamsix/ib-edavki/blob/master/ib_edavki.py#L325 so you're still using the old one.