docs(readme): update documentation for
This commit is contained in:
parent
ddec1e3683
commit
9c89c9da9e
17
README.md
17
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
|
||||
}
|
||||
]
|
||||
```
|
||||
@ -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
|
||||
|
6
price.py
6
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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user