55 lines
932 B
Markdown
55 lines
932 B
Markdown
# Freetrade Portfolio Tracker
|
|
|
|
Fetches live stock prices from Freetrade and calculates portfolio holdings values.
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
python -m venv venv
|
|
venv\Scripts\activate # Windows
|
|
source venv/bin/activate # Linux/Mac
|
|
|
|
pip install requests beautifulsoup4
|
|
```
|
|
|
|
## Usage
|
|
|
|
Copy the sample file and add your own positions:
|
|
|
|
```bash
|
|
cp holdings.sample.csv holdings.csv
|
|
```
|
|
|
|
Format (`name,ticker,market,shares`):
|
|
|
|
```csv
|
|
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.
|
|
|
|
Run:
|
|
|
|
```bash
|
|
python price.py # uses holdings.csv by default
|
|
python price.py my_portfolio.csv # custom file
|
|
```
|
|
|
|
Output (JSON):
|
|
|
|
```json
|
|
[
|
|
{
|
|
"name": "Greatland Resources",
|
|
"ticker": "GGP",
|
|
"market": "GB",
|
|
"shares": 6,
|
|
"currency": "GBP",
|
|
"price": 7.69,
|
|
"fx_rate": 1.0,
|
|
"total_value_gbp": 46.14
|
|
}
|
|
]
|
|
``` |