Skip to content

Commit

Permalink
Fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
rlan committed Oct 13, 2024
1 parent c60e2f0 commit c987a55
Show file tree
Hide file tree
Showing 34 changed files with 38 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ After conversion, this [step-by-step guide](./guide/README.md) creates a new por

<figure>
<img
src="https://github.com/rlan/convert-csv-schwab2pp/raw/main/guide/img/100.jpg"
src="https://github.com/rlan/convert-csv-schwab2pp/raw/main/guide/img/100.png"
alt="Guide step 100">
<figcaption>After importing the converted example CSV</figcaption>
</figure>
Expand Down
13 changes: 12 additions & 1 deletion convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@


# A Charles Scwab CSV starts with a prefix and a suffix row
# Prefix: "Transactions for account...
# Prefix: "Transactions for account..."
# Suffix: "Transactions Total"
# They are ignored.
df = pd.read_csv(args.schwab_csv, skiprows=1, skipfooter=1, engine="python")

# Convert dates to datetime objects
Expand Down Expand Up @@ -70,6 +71,13 @@ def remove_currency(text: str):
df["Transaction Currency"] = transaction_currency

# Convert Action to Type
"""
"Deposit/Removal (or withdrawal): Depositing or withdrawing funds will
respectively increase or decrease the value of a deposit account."
Ref: https://help.portfolio-performance.info/en/reference/transaction/
So a Schwab "Wire Sent" is a PP "Removal".
"""
action_to_type = {
"NRA Tax Adj": "Taxes",
"Credit Interest": "Interest",
Expand All @@ -80,6 +88,7 @@ def remove_currency(text: str):
"Buy": "Buy",
"Sell": "Sell",
"Wire Received": "Deposit",
"Wire Sent": "Removal",
"Advisor Fee": "Fees",
"Reinvest Dividend": "Dividend",
"Reinvest Shares": "Buy",
Expand All @@ -105,6 +114,8 @@ def convert_security_name(data: str):
return ""
elif data.startswith("WIRED FUNDS RECEIVED"):
return ""
elif data.startswith("WIRED FUNDS DISBURSED"):
return ""
else:
return data

Expand Down
1 change: 1 addition & 0 deletions example.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"Transactions for account ...000 as of 09/27/2022 02:03:53 AM ET"
"Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount"
"01/01/2024","Wire Sent","","WIRED FUNDS DISBURSED","","","","-$100.00"
"12/29/2021","NRA Withholding","BNDX","VANGUARD TOTAL INTERNATIONAL BND ETF","","","","-$0.14"
"12/29/2021","Short Term Cap Gain","BNDX","VANGUARD TOTAL INTERNATIONAL BND ETF","","","","$0.48"
"12/29/2021","Long Term Cap Gain","BNDX","VANGUARD TOTAL INTERNATIONAL BND ETF","","","","$29.21"
Expand Down
1 change: 1 addition & 0 deletions example_out.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Date,Note,Ticker Symbol,Security Name,Shares,Fees,Value,Transaction Currency,Type
2024-01-01,Wire Sent,,,,,-100.00,USD,Removal
2021-12-29,NRA Withholding,BNDX,VANGUARD TOTAL INTERNATIONAL BND ETF,,,-0.14,USD,Taxes
2021-12-29,Short Term Cap Gain,BNDX,VANGUARD TOTAL INTERNATIONAL BND ETF,,,0.48,USD,Dividend
2021-12-29,Long Term Cap Gain,BNDX,VANGUARD TOTAL INTERNATIONAL BND ETF,,,29.21,USD,Dividend
Expand Down
45 changes: 23 additions & 22 deletions guide/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A step-by-step guide

This guide will create a new portfolio file in Portfolio Performance (PP) and import a converted CSV file.
This guide will create a new portfolio file in Portfolio Performance (PP) and import a converted CSV file. Screen capturse are from PP 0.71.2 (October 2024).

1. Download a transcations CSV file from your Charles Schwab account, say, ```example.csv```.
2. Convert the CSV. [README](../README.md) for convert.py.
Expand All @@ -11,60 +11,61 @@ python3 convert.py example.csv -p example_out.csv

3. Open Portfolio Performance and click on "Create a new file".

![Create a new file](img/010.jpg "Click on Create a new file")
![Create a new file](img/010.png "Click on Create a new file")

4. Select "USD (United States Dollar)" for currency.

![USD (United States Dollar)](img/020.jpg "Select 'USD (United States Dollar)' for currency.")
![USD (United States Dollar)](img/020.png "Select 'USD (United States Dollar)' for currency.")

5. Type "Securities" for Securities Account and "Deposit" for Reference Account. Then click on "Add" button.

![Securities and Deposit accounts](img/030.jpg)
![Securities and Deposit accounts](img/030.png)

6. Click on "Finish" button.

![Finish](img/040.jpg)
![Clikd on Finish](img/040.png)

7. Import the converted CSV. Go to File menu, Import, CSV files (comma-seperated values) and select ```example_out.csv```.

![Setup online retirieval of securities quotes](img/050.jpg)
![File menu, Import, CSV files](img/050.png)

8. Click on "Next" button.

![Click on "Next" button](img/060.jpg)
![Click on "Next" button](img/060.png)

9. Note that "Deposit" is chosen as the Cash Account and "Securities" as the Securities Account. These two names where entered in a previous step. Click on "Finish" button.

![Click on "Finish" button](img/070.jpg)
![Click on "Finish" button](img/070.png)

10. Now we are going to setup online retrieval of securities quotes for the securities in the account.
10. Click on "OK" button.

1. To have online quotes, we need to access an online service via its API key. FinnHub, among others, are supported by PP. Create an account on [Finnhub](https://finnhub.io/) and get your API key.
![Click on "OK" button](img/080.png)

2. Enter this API key at Preferences, API Keys, Finnhub, Finnhub API Key. You only need to enter an API key once. New portfolio files created in PP will be able to use it.

![Finnhub API key](img/080.jpg)

11. Now we are going to activate online quotes for securities that exist in the account.
11. Now we are going to retrieve historial quotes for securities that exist in the account.

1. Select "All Securities" from the tree menu on the left panel.

![Select "All Securities"](img/090.jpg)
![Select "All Securities"](img/090.png)

2. Right click on "VANGUARD TOTAL INTERNATIONAL BND ETF" and choose "Edit".

![Right click and choose Edit](img/091.jpg)
![Right click and choose Edit](img/091.png)

3. Select "Historical Quotes" tab.

![Select Historical Quotes tab](img/092.jpg)
![Select Historical Quotes tab](img/092.png)

4. Choose "Yahoo" from the Provider dropdown list.

![Choose Yahoo from the Provider dropdown list](img/093.png)

4. Choose "Finnhub" from the Provider drop list. Historical prices will then be retrieved. Then click on "OK" button.
5. Historical quotes will be retrieved. Then click on "OK" button.

![Choose Finnhub from the Provider drop list](img/093.jpg)
![Historical quotes retrieved](img/094.png)
![Chart of historical quotes](img/095.png)

5. Repeat this for other securities in the account. Note that this only needs to be done once for each new securities in the account. For example, repeat this when a new security is purchased. PP will retrieve historical prices automatically or you can manually do so via Online menu, Update Quotes.
6. Repeat this for other securities in the account. Note that this only needs to be done once for each new securities in the account. For example, repeat this when a new security is purchased. PP will retrieve historical quotes automatically or you can manually do so via Online menu, Update Quotes.

12. Verify. Select "All transcations" from the tree menu on the left panel. Import complete.

![Select All transactions](img/100.jpg)
![Select All transactions](img/100.png)
Binary file removed guide/img/010.jpg
Binary file not shown.
Binary file added guide/img/010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/020.jpg
Binary file not shown.
Binary file added guide/img/020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/030.jpg
Binary file not shown.
Binary file added guide/img/030.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/040.jpg
Binary file not shown.
Binary file added guide/img/040.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added guide/img/041.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/050.jpg
Binary file not shown.
Binary file added guide/img/050.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/060.jpg
Binary file not shown.
Binary file added guide/img/060.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/070.jpg
Binary file not shown.
Binary file added guide/img/070.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/080.jpg
Binary file not shown.
Binary file added guide/img/080.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/090.jpg
Binary file not shown.
Binary file added guide/img/090.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/091.jpg
Binary file not shown.
Binary file added guide/img/091.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/092.jpg
Binary file not shown.
Binary file added guide/img/092.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed guide/img/093.jpg
Binary file not shown.
Binary file added guide/img/093.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added guide/img/094.png
Binary file added guide/img/095.png
Binary file removed guide/img/100.jpg
Diff not rendered.
Binary file added guide/img/100.png

0 comments on commit c987a55

Please sign in to comment.