PyTradingBot is a python based trading bot API.
PyTradingBot is a python based trading bot API based on FinViz screener fields, and Yahoo finance.
pip install PyTradingBotInitiate - IDE
from pytradingbot.server import start
if __name__ == '__main__':
start()Initiate - CLI
pytradingbot startUse
pytradingbot --helpfor usage instructions.
Build
docker build -t pytradingbot .Run
docker run --name pytradingbot -p 5005:5005 -e PORT=5005 pytradingbotAll environment variables are optional.
API basics
- PORT: API port. Defaults to 8080
- LOG_LEVEL: Log level for the API server. Defaults to
DEBUG - SCAN_COOLDOWN_SECONDS: Cooldown time before requesting another scan. Defaults to 60
Authentication
- USERNAME: Username to protect the server with authentication.
- PASSWORD: Password to protect the server with authentication.
Notification setup
- TELEGRAM_BOT_TOKEN: Telegram bot token to notify the user.
- TELEGRAM_CHAT_IDS: Comma separated list of chat IDs to notify.
To get the chat ID, message the bot on Telegram and run the command:
curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates" \ | jq '.result[].message.chat.id'
The API runs a background async scheduler that triggers scans automatically (EST) and stores each run in the existing sqlite DB.
- Pre-Market (04:00-09:30): every 15 minutes
- Market Open (09:30-10:30): every 5 minutes
- Mid Day (10:30-14:00): every 30 minutes
- Power Hour (14:00-16:00): every 5 minutes
- After Hours (16:00-20:00): once at 16:15
You can override these rules from the Dashboard Schedule tab, or through:
GET /scheduleto read current/default configPOST /scheduleto save overrides
Requirement
python -m pip install gitverseUsage
gitverse-release reverse -f release_notes.rst -t 'Release Notes'pre-commit will ensure linting
Requirement
python -m pip install pre-commitUsage
pre-commit run --all-fileshttps://pypi.org/project/PyTradingBot/
ยฉ Vignesh Rao
Licensed under the MIT License