The AlphaPulse API provides RESTful endpoints to interact with the trading system. The API is built using FastAPI and provides secure access to trading data and operations.
All API endpoints (except health check) require authentication using an API key. Include the API key in the request header:
X-API-Key: your_api_key
http://localhost:18001
GET /health
Returns the API service status. No authentication required.
GET /api/v1/positions/metrics
Returns detailed metrics for all positions including:
- Spot positions
- Futures positions
- Net exposure
- Hedge ratios
GET /api/v1/positions/spot
Returns current spot positions.
GET /api/v1/positions/futures
Returns current futures positions.
The API uses environment variables for configuration:
# API Configuration
BYBIT_API_KEY=your_api_key
BYBIT_API_SECRET=your_api_secret
ALPHA_PULSE_BYBIT_TESTNET=true/false
# Logging
LOG_LEVEL=INFOFuture endpoints to be implemented:
-
Portfolio Analysis
- GET /api/v1/portfolio/analysis
- GET /api/v1/portfolio/metrics
- GET /api/v1/portfolio/performance
-
Hedging Operations
- POST /api/v1/hedging/analyze
- POST /api/v1/hedging/execute
- POST /api/v1/hedging/close
-
Risk Management
- GET /api/v1/risk/exposure
- GET /api/v1/risk/metrics
- GET /api/v1/risk/limits
-
Trading Operations
- POST /api/v1/trading/orders
- DELETE /api/v1/trading/orders/{id}
- GET /api/v1/trading/orders/status/{id}
To run the API server in development mode:
python src/scripts/run_api.pyThe server will start on port 18001 with auto-reload enabled for development.