Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in expired short option position from Vanguard #105

Open
emin63 opened this issue Jul 19, 2020 · 3 comments
Open

Bug in expired short option position from Vanguard #105

emin63 opened this issue Jul 19, 2020 · 3 comments

Comments

@emin63
Copy link
Contributor

emin63 commented Jul 19, 2020

I think there is a bug in processing expired short option positions from Vanguard.

What happened is I sold 20 puts for $0.25 and they were assigned to me (i.e., the person who bought the puts exercised them early and sold me 2000 shares of stock). The buy of 2000 shares shows up correctly but the short puts never go away.

Below is an example of what ofxclient is downloading which ledger-autosync is having trouble parsing:

<INVTRAN><FITID>112283661<DTTRADE>20200430160000.000[-5:EST]
<DTSETTLE>20200501160000.000[-5:EST]<MEMO>SELL</INVTRAN>
<SECID><UNIQUEID>Z9713494Z<UNIQUEIDTYPE>CUSIP</SECID>
<UNITS>-20.0<UNITPRICE>0.25<COMMISSION>20.0<FEES>0.01
<TOTAL>479.99<SUBACCTSEC>CASH<SUBACCTFUND>CASH</INVSELL><OPTSELLTYPE>SELLTOCLOSE<SHPERCTRCT>0</SELLOPT>
... lots of random stuff
<OPTINFO>
  <SECINFO><SECID><UNIQUEID>Z9713494Z<UNIQUEIDTYPE>CUSIP</SECID>
  <SECNAME>PUT QEP RESOURCES INC $1<TICKER>Z9713494Z<MEMO>SELL</SECINFO>
  <OPTTYPE>PUT<STRIKEPRICE>0.0<DTEXPIRE>20200515160000[-5:EST]
  <SHPERCTRCT>0
</OPTINFO>

I end up seeing something like the following in the output:

2020/04/30=2020/05/01 SELL
    Vanguard:27467766                           -20.0 "Z9713494Z" @ $0.25
    ; ofxid: 15103.27467766.112283661
    Assets:Unknown                                          $5.00

which is the opening position where I sell the puts but the "Z9713494Z" position never gets closed out in the output of ledger-autosync.

I can't follow the python code very well but it seems like the second "Z9713494Z" transaction is ignored in converter.py.

This may well be a bug in Vanguard's OFX output but it seems odd that converter.py isn't even seeing the second "Z9713494Z" transaction.

@egh
Copy link
Owner

egh commented Jul 19, 2020

Probably we need to add something here:
https://github.com/egh/ledger-autosync/blob/master/ledgerautosync/converter.py#L487

To be honest that kind of transaction is beyond me. What output would you expect to see for this kind of transaction?

@emin63
Copy link
Contributor Author

emin63 commented Jul 19, 2020

To be honest that kind of transaction is beyond me.

Fair enough. Selling puts is often a stupid thing to do anyway so you could argue not supporting it is doing people a favor. :)

What output would you expect to see for this kind of transaction?

I want a transaction so that when the assignment happens the option position goes away. The first transaction below is what ledger-autosync produces for buying the stock (which is correct). The second transaction is what I manually added to fix things to note that the option position goes away.

2020/05/15=2020/05/19 BUY
    Vanguard Brokerage Account                      2000.0 QEP @ $1.0
    ; ofxid: 15103.27467766.586242039
    Assets:Unknown                                      -$2000.00

2020/05/15=2020/05/19 OPTION ASSIGNED
    Vanguard Brokerage Account                   20.00 "Z9713494Z" @ $0.0
    ; manual fix due to bug discussed in github issue 105 of ledger-autosync
    Assets:Unknown                                       $0.00

@egh
Copy link
Owner

egh commented Jul 19, 2020

Thanks for the example! Is the only information about the put available in the SECINFO part? Is there only the one sell transaction in the OFX file? I'm not sure if l-a is not getting enough information from the https://github.com/jseutter/ofxparse library, or if it just isn't doing the right thing with the data it's getting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants