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

Support updated JSON format in Schwab Equity Award parser #467

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

thibwk
Copy link
Contributor

@thibwk thibwk commented Jan 20, 2024

Schwab have now updated their website to:

  • allow the whole history of Equity Awards account to be downloaded (previously only the last 4 years were made available)
  • via a simple Export button, in an updated JSON format (and CSV and XML).

This PR updates the Schwab Equity Award parser to work with this updated format (while still supporting the previous one).

@thibwk thibwk force-pushed the schwab-updated-equity-award-json branch from 2fc6ba6 to e7b281a Compare January 20, 2024 22:40
@thibwk thibwk force-pushed the schwab-updated-equity-award-json branch from e7b281a to 1ae9942 Compare January 20, 2024 22:42
else:
raise ParsingError(
file, f'Parsing for action {row["action"]} is not implemented!'
file, f"Parsing for action {row[names.action]} is not implemented!"
)

currency = "USD"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: a few lines below (line 311+ in the new code/241+ in the old code - I can't add a comment there directly sadly) the _normalize_split() function seems to assume that the data is about Alphabet shares. I think some check on the stock symbol might be prudent to avoid accidentally scaling some other stock's values according to the Alphabet split, in cases where the user happens to also use Schwab as broker for employer-issued equity.

Copy link
Contributor Author

@thibwk thibwk Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right, that's for Alphabet's stock split. I am not sure if Schwab gives the same data format as parsed by this code for other accounts than the Google Equity Awards ones which can only have GOOG and GOOGL.
But I agree it'd be better to also check on the stock ticker name to be safe.

Not directly relevant to this PR though.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equity awards accounts and this JSON format are not unique to GOOG/GOOGL stocks, but I think this JSON format may be unique to equity awards accounts.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great actually to have some JSON/CSV file in resources with information about splits to have general support for them instead of hardcoding a specific one directly in the code.

@vmartinv
Copy link
Collaborator

To me it seems we have two parsers for the same thing, in schwab.py there's _read_schwab_awards which parses the csv format of this new export (instead of json). If they are equivalent I'd rather have the csv format.

@thibwk
Copy link
Contributor Author

thibwk commented Jan 22, 2024

To me it seems we have two parsers for the same thing, in schwab.py there's _read_schwab_awards which parses the csv format of this new export (instead of json). If they are equivalent I'd rather have the csv format.

Fair question, but the new CSV file format that Google employees get on their Equity Awards Account appear to have a different format, not supported by this parser.
e.g. the headers I see is:

Date	Action	Symbol	Description	Quantity	FeesAndCommissions	DisbursementElection	Amount	AwardDate	AwardId	VestDate	VestFairMarketValue	Type	Shares	SalePrice	SubscriptionDate	SubscriptionFairMarketValue	PurchaseDate	PurchasePrice	PurchaseFairMarketValue	DispositionType	GrantId	GrossProceeds

That doesn't seem to match

.

In other words, Schwab seems to export data in different formats for different types of accounts?

@m01
Copy link

m01 commented Jan 22, 2024

In other words, Schwab seems to export data in different formats for different types of accounts?

I thought the CSV parser was for "normal" individual brokerage accounts, and the equity awards JSON parser was for equity awards accounts.

@vmartinv
Copy link
Collaborator

That doesn't seem to match

No, that’s just the normal transaction parser. There are two parsers in schwab.py, the award parser is in the function ‘_read_schwab_awards’

@vmartinv
Copy link
Collaborator

vmartinv commented Jan 22, 2024

Also note that the csv parser for Schwab (both of them) are being fixed in #459

@KapJI KapJI added the feature New feature or request label Jan 29, 2024
@KapJI
Copy link
Owner

KapJI commented Jan 29, 2024

Thanks for finding how to export more data!

@KapJI KapJI merged commit 325a7ea into KapJI:main Jan 29, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants