- Add tier field to User model for plan detection (free/normal/pro)
- Create AVE Cloud API client with all Data API endpoints:
- Token search (GET /v2/tokens)
- Batch prices (POST /v2/tokens/price)
- Token details (GET /v2/tokens/{id})
- Kline data (GET /v2/klines/token/{id})
- Trending tokens (GET /v2/tokens/trending)
- Token risk (GET /v2/contracts/{id})
- Add Trading API endpoints:
- Chain wallet quote (POST /v1/chain/quote)
- Chain wallet swap (POST /v1/chain/swap)
- Add tier gating with upsell messaging for Pro features
- Handle rate limiting gracefully with 429 responses
- Add Pydantic schemas for AVE API requests/responses
Fixes #11
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from slowapi import Limiter
|
|
from slowapi.util import get_remote_address
|
|
from .api import auth, bots, backtest, simulate, config, ave
|
|
from .core.limiter import limiter
|
|
|
|
app = FastAPI(
|
|
title="Randebu Trading Bot API",
|
|
description="AI-powered trading bot platform API",
|
|
version="0.1.0",
|
|
)
|
|
|
|
app.state.limiter = limiter
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
|
|
app.include_router(bots.router, prefix="/api/bots", tags=["bots"])
|
|
app.include_router(backtest.router, prefix="/api", tags=["backtest"])
|
|
app.include_router(simulate.router, prefix="/api", tags=["simulate"])
|
|
app.include_router(config.router, prefix="/api/config", tags=["config"])
|
|
app.include_router(ave.router, prefix="/api/ave", tags=["ave"])
|
|
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {"status": "ok", "message": "Randebu Trading Bot API"}
|
|
|
|
|
|
@app.get("/health")
|
|
def health():
|
|
return {"status": "healthy"}
|