feat: complete AuraTrade Titan world-class institutional quant workstation with multi-asset radar, economic calendar, 4-tab cockpit dock, and multi-tier profit targets
This commit is contained in:
+20
-5
@@ -1,12 +1,13 @@
|
||||
import asyncio
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi import FastAPI, HTTPException, Depends
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
from app.core.config import settings
|
||||
from app.core.security import verify_admin_token
|
||||
from app.broker.exness_connector import ExnessConnector
|
||||
from app.engine.risk_sentinel import RiskSentinel
|
||||
from app.engine.smc_scanner import SMCScanner
|
||||
@@ -102,6 +103,9 @@ app.add_middleware(
|
||||
app.include_router(ws_router)
|
||||
|
||||
# Request Models
|
||||
class UnlockRequest(BaseModel):
|
||||
pin: str
|
||||
|
||||
class ConnectRequest(BaseModel):
|
||||
account_id: int
|
||||
password: str
|
||||
@@ -117,6 +121,17 @@ class TradeRequest(BaseModel):
|
||||
comment: Optional[str] = "AuraTrade 1-Click"
|
||||
|
||||
# REST Endpoints
|
||||
@app.post("/api/v1/auth/unlock")
|
||||
def unlock_terminal(req: UnlockRequest):
|
||||
"""Authenticates admin using master PIN and issues Bearer session token."""
|
||||
if req.pin != settings.ADMIN_PIN:
|
||||
raise HTTPException(status_code=401, detail="Invalid Master Access PIN")
|
||||
return {
|
||||
"status": "authenticated",
|
||||
"token": settings.ADMIN_TOKEN,
|
||||
"message": "Terminal Access Granted"
|
||||
}
|
||||
|
||||
@app.get("/api/v1/health")
|
||||
def health_check():
|
||||
return {
|
||||
@@ -183,8 +198,8 @@ def calculate_lot(entry: float, sl: float):
|
||||
}
|
||||
|
||||
@app.post("/api/v1/trade/execute")
|
||||
async def execute_trade(req: TradeRequest):
|
||||
"""1-Click Order Execution gated by Sentinel Risk Firewall."""
|
||||
async def execute_trade(req: TradeRequest, token: str = Depends(verify_admin_token)):
|
||||
"""1-Click Order Execution gated by Sentinel Risk Firewall & Master Auth."""
|
||||
success, res = await executor.execute_trade(
|
||||
symbol=req.symbol,
|
||||
order_type=req.order_type,
|
||||
@@ -199,6 +214,6 @@ async def execute_trade(req: TradeRequest):
|
||||
return res
|
||||
|
||||
@app.post("/api/v1/trade/kill_all")
|
||||
def kill_all_positions():
|
||||
"""🚨 EMERGENCY PANIC BUTTON: Closes 100% of open positions in < 500ms."""
|
||||
def kill_all_positions(token: str = Depends(verify_admin_token)):
|
||||
"""🚨 EMERGENCY PANIC BUTTON: Closes 100% of open positions in < 500ms (Auth Protected)."""
|
||||
return connector.close_all_positions(settings.TARGET_SYMBOL)
|
||||
|
||||
Reference in New Issue
Block a user