How areed1192/python-trading-robot works
Project type and purpose
• This is a Python library (“Python Trading Robot”) that provides a set of abstractions and utilities for building algorithmic trading bots against the TD Ameritrade API.
• Its main responsibilities are:
• Managing authentication and session state with the broker’s API
• Streaming and storing real-time and historical market data
• Computing technical indicators
• Modeling a portfolio and computing risk metrics
• Defining and executing complex order types (with take-profit, stop-loss, etc.)
File structure
• Top-level:
• .github/, LICENSE, CI workflows → project maintenance & continuous analysis
• config/ → configuration template & helper for writing config files
• pyrobot/ → core library package
• data/ → sample data responses (for testing or offline simulations)
• samples/ → example scripts showing how to use the library
• tests/ → unit tests for each major module
• setup.py → packaging metadata and dependencies
• Inside pyrobot/ you have clearly separated modules:
• robot.py → orchestrator, authentication, API session management
• stock_frame.py → in-memory data store for ticks & history
• indicators.py → indicator definitions and updating logic
• portfolio.py → portfolio state and risk-metric calculations
• trades.py & order_status.py → trade-object model and order status retrieval
README for additional insights
• Confirms core objects: PyRobot (the main entry point), Portfolio, Trade, StockFrame, Indicator
• Describes TD Ameritrade credentials & state persistence to a JSON file on disk
• Sample usage is entirely programmatic—no web UI or database