laroche/tastyworks-pnl

KeyError: 'xxxxxx'

Opened this issue · 1 comments

I am getting the following error while processing the transactions:

(tastytrade) ➜  tastyworks-pnl git:(main) python3 tw-pnl.py --assume-individual-stock --tax-output=2023 --output-csv=tastyworks-tax-2023.csv ~/Downloads/tastytrade_transactions_history_x5WX66849_240101_to_241029.csv
Assignment/Exercise for a long option, please move pnl on next line to stock:
Traceback (most recent call last):
  File "/Users/nharalahalli/workspace_nd/tastyworks-pnl/tw-pnl.py", line 1418, in <module>
    main(sys.argv[1:])
  File "/Users/nharalahalli/workspace_nd/tastyworks-pnl/tw-pnl.py", line 1415, in main
    check(all_wk, output_summary, output_csv, output_excel, tax_output, show, verbose, debug)
  File "/Users/nharalahalli/workspace_nd/tastyworks-pnl/tw-pnl.py", line 1103, in check
    (tsubcode in ('Expiration', 'Exercise', 'Assignment', 'Cash Settled Assignment', 'Cash Settled Exercise') and not fifos_islong(fifos, asset))):
                                                                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nharalahalli/workspace_nd/tastyworks-pnl/tw-pnl.py", line 408, in fifos_islong
    return fifos[asset][0][2] > 0
           ~~~~~^^^^^^^
KeyError: 'SPXW  240119C04825000 C4825 24-01-19'

I can send the input data via email.