- Python 3.9+
- Dependencies:
pandas,requests,pyyaml,yfinance,python-dotenv - Email Configuration: Gmail App Password required in
.env. - News Sentiment (Optional): Local fallback scoring is built in (no external LLM key required).
- AI Trading Bot:
- preferred path: remote trained-model inference endpoint in
.envor GitHub secrets - fallback path: local distilled manager if the full runtime is unavailable
- preferred path: remote trained-model inference endpoint in
- Move the
trading_botfolder to your desired location (e.g., home folder). pip install -r requirements.txt.- Fill in your email credentials in
.env. - Create
.envfrom the template and paste your keys:cp .env.example .env
- AI trading endpoint:
TRAINED_MODEL_INFERENCE_URLpoints the AI trading bot at the hosted trained-model service.TRAINED_MODEL_API_KEYoptionally protects that endpoint.TWELVEDATA_API_KEYSshould come from env or GitHub secrets only.- Do not commit
.env(it is gitignored).
The bot runs automatically in GitHub Actions on a schedule:
- Scheduled runs: Configured in
.github/workflows/daily_trading_bot.ymlto trigger daily. - Workflow Steps:
- Checks conditions and runs
main.py(Price/News Ingest -> Features -> Backtest). - Sends Daily Email Report (combined pipeline + backtest details).
- Checks conditions and runs
Use the backtesting engine for historical runs and PineScript-ready strategy configuration.
- Runner:
python3 backtesting_runner.py backtest - Config:
backtesting/config.yaml - Dependencies:
backtesting/requirements.txt
Note: PineScript translation is a placeholder; set strategy.type: pine with a script path when ready.
- State: Positions are tracked in
data/trading_bot.db. - Learning: Adaptations are saved in
meta_learner_state.json.
- No Email: Verify
SENDER_EMAILandSENDER_PASSWORDin.env. - No Data: Ensure internet connection is active (Wi-Fi check).
- AI Strategy Not Trading:
- If the trained-model endpoint call fails, the workflow should retry via the distilled fallback path.
- Check
AI Backend SelectedandAI Router Reasonin the AI email/report. - Check that
TRAINED_MODEL_INFERENCE_URLis set and the hosted service is healthy when the full runtime is selected.