From 9c89c9da9ea20ace9ef04fb985174e0d63982424 Mon Sep 17 00:00:00 2001 From: Karl Hudgell Date: Mon, 20 Apr 2026 12:32:55 +0100 Subject: [PATCH] docs(readme): update documentation for --- README.md | 17 ++++++++++------- holdings.sample.csv | 6 ++---- price.py | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fad3ab3..2613962 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ Copy the sample file and add your own positions: cp holdings.sample.csv holdings.csv ``` -Format (`ticker,market,shares`): +Format (`name,ticker,market,shares`): ```csv -GGP,GB,100 -PAF,GB,200 -SVM,US,50 +Greatland Resources,GGP,GB,6 +Pan African Resources,PAF,GB,78 +Nvidia,NVDA,US,0.09761572 ``` Markets: `GB` for UK stocks, `US` for US-listed stocks. @@ -42,11 +42,14 @@ Output (JSON): ```json [ { + "name": "Greatland Resources", "ticker": "GGP", "market": "GB", - "shares": 100, - "price": 7.67, - "total_value": 767.0 + "shares": 6, + "currency": "GBP", + "price": 7.69, + "fx_rate": 1.0, + "total_value_gbp": 46.14 } ] ``` \ No newline at end of file diff --git a/holdings.sample.csv b/holdings.sample.csv index bb7507d..21a0d00 100644 --- a/holdings.sample.csv +++ b/holdings.sample.csv @@ -1,4 +1,2 @@ -GGP,GB,100 -PAF,GB,200 -SVM,US,50 -AAPL,US,3.6185 \ No newline at end of file +test1,GGP,GB,100 +test2,AAPL,US,3.6185 \ No newline at end of file diff --git a/price.py b/price.py index e287f05..9928813 100644 --- a/price.py +++ b/price.py @@ -39,10 +39,10 @@ holdings = [] with open(holdings_file) as f: reader = csv.reader(f) for row in reader: - ticker, market = row[0].strip(), row[1].strip() - shares = float(row[2].strip()) + name, ticker, market = row[0].strip(), row[1].strip(), row[2].strip() + shares = float(row[3].strip()) currency = get_currency(market) - holdings.append({"ticker": ticker, "market": market, "shares": shares, "currency": currency}) + holdings.append({"name": name, "ticker": ticker, "market": market, "shares": shares, "currency": currency}) unique_currencies = {h["currency"] for h in holdings if h["currency"] != "GBP"} for currency in unique_currencies: