REST API for fintech platforms and wealth management tools automating portfolio rebalancing calculations. Accepts current portfolio holdings as JSON with target allocation percentages, calculates required buy and sell orders to restore target weights within a specified drift tolerance, considers tax lot efficiency for US taxable accounts, accounts for trade fees and minimum lot sizes, and returns an optimised rebalancing order set with estimated tax impact. Supports stocks, ETFs, bonds, REITs, and cash positions. Handles portfolios from USD 10000 to USD 10 million. Processes rebalancing calculation in under 200ms. Integrates with Alpaca, Tradier, and Interactive Brokers APIs for automated order execution.
- Full REST API
# 1. Install dependencies
pip install -r requirements.txt
# 2. Configure environment
cp .env.example .env
# Edit .env with your settings
# 3. Run locally
uvicorn main:app --reload --port 8000
# 4. View interactive docs
open http://localhost:8000/docs# Build and run
docker compose up -d
# Check health
curl http://localhost:8000/healthGet a token first:
curl -X POST "http://localhost:8000/auth/token?username=admin&password=admin123"Use the token in subsequent requests:
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8000/items| Method | Path | Description |
|---|---|---|
| GET | /health |
System health |
| POST | /auth/token |
Get JWT token |
| GET | /items |
List all items |
| POST | /items |
Create item |
| GET | /items/{id} |
Get item |
| PATCH | /items/{id} |
Update item |
| DELETE | /items/{id} |
Delete item |
| GET | /stats |
API statistics |
Full interactive docs: http://localhost:8000/docs
| Endpoint | Limit |
|---|---|
/auth/token |
10/minute |
GET /items |
60/minute |
POST /items |
30/minute |
DELETE /items |
20/minute |
pip install pytest httpx
pytest tests/ -v- Change
SECRET_KEYin.envbefore deploying - Replace in-memory
_dbwith a real database - Add proper user management to
auth.py - Configure
ALLOWED_ORIGINSfor CORS - Use Nginx/Traefik as reverse proxy
MIT
| Feature | Free | Pro |
|---|---|---|
| 100 requests/day | Yes | Yes |
| Standard endpoints | Yes | Yes |
| JSON responses | Yes | Yes |
| Unlimited requests | - | Yes |
| Premium endpoints | - | Yes |
| Batch processing | - | Yes |
| Webhook notifications | - | Yes |
| SLA guarantee | - | Yes |
| Priority support | - | Yes |
Get the full version with all premium features, priority support, and lifetime updates.