docs(readme): update documentation for

This commit is contained in:
Karl Hudgell 2026-04-20 12:32:55 +01:00
parent ddec1e3683
commit 9c89c9da9e
3 changed files with 15 additions and 14 deletions

View File

@ -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
}
]
```

View File

@ -1,4 +1,2 @@
GGP,GB,100
PAF,GB,200
SVM,US,50
AAPL,US,3.6185
test1,GGP,GB,100
test2,AAPL,US,3.6185
1 test1 GGP GB 100
2 test2 PAF AAPL GB US 200 3.6185
SVM US 50
AAPL US 3.6185

View File

@ -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: