52 lines
792 B
Markdown
52 lines
792 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 (`ticker,market,shares`):
|
||
|
|
|
||
|
|
```csv
|
||
|
|
GGP,GB,100
|
||
|
|
PAF,GB,200
|
||
|
|
SVM,US,50
|
||
|
|
```
|
||
|
|
|
||
|
|
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
|
||
|
|
[
|
||
|
|
{
|
||
|
|
"ticker": "GGP",
|
||
|
|
"market": "GB",
|
||
|
|
"shares": 100,
|
||
|
|
"price": 7.67,
|
||
|
|
"total_value": 767.0
|
||
|
|
}
|
||
|
|
]
|
||
|
|
```
|