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
|
cp holdings.sample.csv holdings.csv
|
||||||
```
|
```
|
||||||
|
|
||||||
Format (`ticker,market,shares`):
|
Format (`name,ticker,market,shares`):
|
||||||
|
|
||||||
```csv
|
```csv
|
||||||
GGP,GB,100
|
Greatland Resources,GGP,GB,6
|
||||||
PAF,GB,200
|
Pan African Resources,PAF,GB,78
|
||||||
SVM,US,50
|
Nvidia,NVDA,US,0.09761572
|
||||||
```
|
```
|
||||||
|
|
||||||
Markets: `GB` for UK stocks, `US` for US-listed stocks.
|
Markets: `GB` for UK stocks, `US` for US-listed stocks.
|
||||||
@ -42,11 +42,14 @@ Output (JSON):
|
|||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"name": "Greatland Resources",
|
||||||
"ticker": "GGP",
|
"ticker": "GGP",
|
||||||
"market": "GB",
|
"market": "GB",
|
||||||
"shares": 100,
|
"shares": 6,
|
||||||
"price": 7.67,
|
"currency": "GBP",
|
||||||
"total_value": 767.0
|
"price": 7.69,
|
||||||
|
"fx_rate": 1.0,
|
||||||
|
"total_value_gbp": 46.14
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -1,4 +1,2 @@
|
|||||||
GGP,GB,100
|
test1,GGP,GB,100
|
||||||
PAF,GB,200
|
test2,AAPL,US,3.6185
|
||||||
SVM,US,50
|
|
||||||
AAPL,US,3.6185
|
|
||||||
|
6
price.py
6
price.py
@ -39,10 +39,10 @@ holdings = []
|
|||||||
with open(holdings_file) as f:
|
with open(holdings_file) as f:
|
||||||
reader = csv.reader(f)
|
reader = csv.reader(f)
|
||||||
for row in reader:
|
for row in reader:
|
||||||
ticker, market = row[0].strip(), row[1].strip()
|
name, ticker, market = row[0].strip(), row[1].strip(), row[2].strip()
|
||||||
shares = float(row[2].strip())
|
shares = float(row[3].strip())
|
||||||
currency = get_currency(market)
|
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"}
|
unique_currencies = {h["currency"] for h in holdings if h["currency"] != "GBP"}
|
||||||
for currency in unique_currencies:
|
for currency in unique_currencies:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user