How parambhatia2004/tradingbot works
TradingBot is a single-file automated 130/30 long-short equity bot using Alpaca’s paper-trading API. Its workflow waits for market open, periodically ranks a fixed stock universe by recent price change, derives long/short quantities from account equity and prices, then reconciles positions and submits market orders; near close it liquidates positions. The internal strategy, ranking, and order helpers are all implemented in tradingBot.py. The README additionally documents minute-based rebalancing; source excerpts show the loop and timing. There are no separate source modules.
Main entry points: tradingBot.py Bot runtime
Components 9
Strategy control
- Bot runtime
tradingBot.py - Market session
tradingBot.py - Strategy state
tradingBot.py
Portfolio selection
- Universe ranking
tradingBot.py - Market data
tradingBot.py - Position sizing
tradingBot.py
Trading execution
- Position reconciliation
tradingBot.py - Order helper
tradingBot.py
Other components
- Alpaca API
Connections 13
- Bot runtime → Market session: waits for open
tradingBot.py - Bot runtime → Position reconciliation: rebalances
tradingBot.py - Bot runtime → Alpaca API: checks session, cancels orders
tradingBot.py - Bot runtime → Order helper: liquidates near close
tradingBot.py - Market session → Alpaca API: checks market clock
tradingBot.py - Position reconciliation → Universe ranking: ranks portfolio
tradingBot.py - Universe ranking → Market data: gets price changes
tradingBot.py - Market data → Alpaca API: requests minute bars
tradingBot.py - Universe ranking → Position sizing: sets target quantities
tradingBot.py - Position sizing → Alpaca API: reads account and latest bars
tradingBot.py - Position reconciliation → Alpaca API: reads positions, cancels orders
tradingBot.py - Position reconciliation → Order helper: submits adjustments
tradingBot.py - Order helper → Alpaca API: submits market orders
tradingBot.py