# fit A TypeScript trading bot built on the Alpaca paper trading API. It runs pluggable strategies that use indicators to generate buy/sell signals. ## How it works 1. The **Bot** waits for market open via the Alpaca clock API 2. It runs all registered **Strategies** concurrently, each with its own capital allocation 3. Each strategy uses **Indicators** to evaluate market conditions and returns buy/sell **Signals** 4. The **Executor** processes the signals 5. The bot loops hourly, waiting for the next market open ## Setup Requires an [Alpaca](https://alpaca.markets/) paper trading account. Create a `.env` file in the project root: ``` ALPACA_KEY_ID=your_key_id ALPACA_SECRET_KEY=your_secret_key ``` Install dependencies: ``` npm install ``` ## Running ```sh # Build and run npm run build npm start # Development (auto-reload) npm run dev # Docker docker build -t fit . docker run --env-file .env fit ``` ## Testing and linting ```sh npm test npm run lint ``` ## Project structure ``` src/ index.ts # Entry point, main loop alpaca.ts # Alpaca API client wrapper bot.ts # Orchestrator, runs strategies each day executor.ts # Executes signals from strategies indicator.ts # Indicator interface strategy.ts # Strategy/Signal interfaces trading.ts # Utilities (wait, market open, etc.) momentum-indicator.ts # Samples QQQ direction after open momentum-strategy.ts # Trades TQQQ/SQQQ based on momentum ```