FinLab is collection of python scripts for fast trading idea testing, wrangling with financial data. etc...
py -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
data.py
CLI download and store market data in parquet format.
CLI format:
py -m data <ticker> <start_date> <end_date> [<interval>]
Example of usage :
py -m data SPY 2021-01-01 2021-12-31
Download data automatically stored in \data
subdirectory.
Use downloaded data in you code:
data = pd.read_parquet(r"..\data\SPY_2021-01-01_2021-12-31_1d.parquet")
Small plot.py
do this job with plotly lib.
py -m plot data\SPY_2021-01-01_2021-12-31_1d.parquet
Script for experiments live in lab
folder
The name of the script is 000 index.
to run script:
py -m 001
Consider to add next sentence to your prompt
< strategy description place here>
Task:
- Develop a trading strategy.
- Implement a backtesting script in Python.
- Use the Plotly library for data visualization.
Assumptions:
- Historical market data is already available locally.
- You can load SPY's daily historical data (from 2021-01-01 to 2021-12-31) using:
data = pd.read_parquet(r"..\data\SPY_2021-01-01_2021-12-31_1d.parquet")