Quick Start
🚀 Quick Start
Follow these steps to set up Signal.Engine, configure your environment, and execute your first autonomous market scan.
1. Prerequisites
Ensure you have the following installed:
- Python 3.9+
- Node.js & npm (for the visual dashboard)
- Alpaca Paper Trading Account (for API keys)
2. Installation
Clone the repository and install both backend and frontend dependencies.
Backend Setup:
git clone https://github.com/Junni007/AI-Trading-Agent.git
cd AI-Trading-Agent
pip install -r requirements.txt
Frontend Setup:
cd frontend
npm install
cd ..
3. Environment Configuration
Create a .env file in the root directory to store your Alpaca credentials. This allows the agent to fetch live data and simulate trades.
# Alpaca API Credentials
APCA_API_KEY_ID="your_paper_key_here"
APCA_API_SECRET_KEY="your_paper_secret_here"
APCA_API_BASE_URL="https://paper-api.alpaca.markets"
4. Launch the System
Signal.Engine consists of a Brain (API) and an Observatory (UI).
Step A: Start the Backend API
The backend initializes the Hybrid Brain (LSTM + PPO) and the Simulation Engine.
# From the project root
python -m src.api.main
- API URL:
http://localhost:8000 - Key Endpoint:
/api/scan(Triggers the agent to analyze the market)
Step B: Start the Dashboard
In a new terminal, launch the React-based visualizer to monitor signals in real-time.
cd frontend
npm run dev
- Dashboard URL:
http://localhost:5173(or the port provided by Vite)
5. Execute Trading Commands
You can also run the agent via the command line for specific symbols without the full UI.
Dry Run (Inference Only): Verify the model logic and data fetching for a specific ticker without placing orders.
python -m src.trader_alpaca --symbol RELIANCE.NS --qty 1
Live Paper Trading:
Enable the --live flag to allow the agent to execute Buy/Sell/Hold orders autonomously on your Alpaca paper account.
python -m src.trader_alpaca --symbol RELIANCE.NS --qty 1 --live
🛠Troubleshooting Common Issues
| Issue | Solution |
| :--- | :--- |
| Model weights missing | Ensure best_ppo.ckpt exists in /checkpoints and final_sft_model.pth is in /checkpoints_sft. |
| Alpaca 403 Forbidden | Double-check your .env keys and ensure you are using the paper-api URL for testing. |
| CORS Errors | If the frontend cannot reach the API, ensure the FastAPI server is running on localhost:8000. |
| Nifty 500 Data | The system defaults to Indian markets. For S&P 500, update the ticker utility settings in src/ticker_utils.py. |