openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Trading Platform API - Professional financial analysis and trading system servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: market description: Market data and quotes - name: historical description: Historical OHLCV data - name: analysis description: Technical analysis engine - name: alerts description: Price and signal alerts - name: settings description: User settings and preferences - name: auth description: Authentication and session management - name: backtest description: Strategy backtesting - name: watchlist description: Symbol watchlist management paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /market/symbols: get: operationId: getSymbols tags: [market] summary: Get available symbols list parameters: - name: category in: query schema: type: string enum: [forex, metals, indices, crypto, all] default: all responses: "200": description: Symbols list content: application/json: schema: $ref: "#/components/schemas/SymbolsResponse" /market/quote/{symbol}: get: operationId: getQuote tags: [market] summary: Get current quote for a symbol parameters: - name: symbol in: path required: true schema: type: string responses: "200": description: Current quote content: application/json: schema: $ref: "#/components/schemas/Quote" /market/quotes: get: operationId: getMultipleQuotes tags: [market] summary: Get quotes for multiple symbols parameters: - name: symbols in: query required: true schema: type: string description: Comma-separated list of symbols responses: "200": description: Multiple quotes content: application/json: schema: $ref: "#/components/schemas/MultipleQuotesResponse" /market/overview: get: operationId: getMarketOverview tags: [market] summary: Get market overview summary responses: "200": description: Market overview content: application/json: schema: $ref: "#/components/schemas/MarketOverview" /historical/{symbol}: get: operationId: getHistoricalData tags: [historical] summary: Get historical OHLCV data parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string enum: [1m, 3m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M] - name: from in: query schema: type: string description: ISO date string - name: to in: query schema: type: string description: ISO date string - name: limit in: query schema: type: integer default: 500 maximum: 5000 responses: "200": description: Historical OHLCV data content: application/json: schema: $ref: "#/components/schemas/HistoricalResponse" /analysis/{symbol}: post: operationId: analyzeSymbol tags: [analysis] summary: Run full technical analysis on a symbol parameters: - name: symbol in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnalysisRequest" responses: "200": description: Full analysis result content: application/json: schema: $ref: "#/components/schemas/AnalysisResult" /analysis/{symbol}/indicators: get: operationId: getIndicators tags: [analysis] summary: Get indicator values for a symbol parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string - name: indicators in: query schema: type: string description: Comma-separated list of indicator names responses: "200": description: Indicator values content: application/json: schema: $ref: "#/components/schemas/IndicatorsResponse" /analysis/{symbol}/signals: get: operationId: getSignals tags: [analysis] summary: Get active trading signals for a symbol parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string - name: mode in: query schema: type: string enum: [scalping, intraday, swing, trend, reversal, institutional, conservative, aggressive] responses: "200": description: Trading signals content: application/json: schema: $ref: "#/components/schemas/SignalsResponse" /analysis/{symbol}/patterns: get: operationId: getCandlePatterns tags: [analysis] summary: Detect candlestick patterns parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string responses: "200": description: Detected patterns content: application/json: schema: $ref: "#/components/schemas/PatternsResponse" /analysis/{symbol}/support-resistance: get: operationId: getSupportResistance tags: [analysis] summary: Get support and resistance levels parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string responses: "200": description: Support and resistance levels content: application/json: schema: $ref: "#/components/schemas/SupportResistanceResponse" /analysis/{symbol}/summary: get: operationId: getAnalysisSummary tags: [analysis] summary: Get quick analysis summary table parameters: - name: symbol in: path required: true schema: type: string - name: timeframe in: query required: true schema: type: string - name: mode in: query schema: type: string responses: "200": description: Analysis summary content: application/json: schema: $ref: "#/components/schemas/AnalysisSummary" /alerts: get: operationId: getAlerts tags: [alerts] summary: Get all alerts responses: "200": description: List of alerts content: application/json: schema: $ref: "#/components/schemas/AlertsResponse" post: operationId: createAlert tags: [alerts] summary: Create a new alert requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateAlertBody" responses: "201": description: Created alert content: application/json: schema: $ref: "#/components/schemas/Alert" /alerts/{id}: delete: operationId: deleteAlert tags: [alerts] summary: Delete an alert parameters: - name: id in: path required: true schema: type: string responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/DeleteResponse" /alerts/{id}/toggle: patch: operationId: toggleAlert tags: [alerts] summary: Toggle alert active state parameters: - name: id in: path required: true schema: type: string responses: "200": description: Updated alert content: application/json: schema: $ref: "#/components/schemas/Alert" /settings: get: operationId: getSettings tags: [settings] summary: Get user settings responses: "200": description: User settings content: application/json: schema: $ref: "#/components/schemas/UserSettings" put: operationId: updateSettings tags: [settings] summary: Update user settings requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateSettingsBody" responses: "200": description: Updated settings content: application/json: schema: $ref: "#/components/schemas/UserSettings" /auth/connect: post: operationId: connectBroker tags: [auth] summary: Connect to broker (Demo or Live) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ConnectBrokerBody" responses: "200": description: Connection result content: application/json: schema: $ref: "#/components/schemas/ConnectionStatus" /auth/disconnect: post: operationId: disconnectBroker tags: [auth] summary: Disconnect from broker responses: "200": description: Disconnected content: application/json: schema: $ref: "#/components/schemas/ConnectionStatus" /auth/status: get: operationId: getConnectionStatus tags: [auth] summary: Get current broker connection status responses: "200": description: Connection status content: application/json: schema: $ref: "#/components/schemas/ConnectionStatus" /watchlist: get: operationId: getWatchlist tags: [watchlist] summary: Get user watchlist responses: "200": description: Watchlist content: application/json: schema: $ref: "#/components/schemas/WatchlistResponse" post: operationId: addToWatchlist tags: [watchlist] summary: Add symbol to watchlist requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddWatchlistBody" responses: "201": description: Added content: application/json: schema: $ref: "#/components/schemas/WatchlistItem" /watchlist/{symbol}: delete: operationId: removeFromWatchlist tags: [watchlist] summary: Remove symbol from watchlist parameters: - name: symbol in: path required: true schema: type: string responses: "200": description: Removed content: application/json: schema: $ref: "#/components/schemas/DeleteResponse" /backtest/{symbol}: post: operationId: runBacktest tags: [backtest] summary: Run strategy backtest parameters: - name: symbol in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BacktestRequest" responses: "200": description: Backtest result content: application/json: schema: $ref: "#/components/schemas/BacktestResult" components: schemas: HealthStatus: type: object properties: status: type: string websocket: type: string dataFeed: type: string required: [status] Symbol: type: object properties: symbol: type: string name: type: string category: type: string pip: type: number digits: type: integer tradingHours: type: string required: [symbol, name, category] SymbolsResponse: type: object properties: symbols: type: array items: $ref: "#/components/schemas/Symbol" total: type: integer required: [symbols, total] Quote: type: object properties: symbol: type: string bid: type: number ask: type: number last: type: number open: type: number high: type: number low: type: number close: type: number change: type: number changePercent: type: number volume: type: number timestamp: type: integer source: type: string required: [symbol, bid, ask, last, timestamp] MultipleQuotesResponse: type: object properties: quotes: type: array items: $ref: "#/components/schemas/Quote" timestamp: type: integer required: [quotes, timestamp] MarketOverview: type: object properties: trending: type: array items: $ref: "#/components/schemas/Quote" gainers: type: array items: $ref: "#/components/schemas/Quote" losers: type: array items: $ref: "#/components/schemas/Quote" timestamp: type: integer required: [trending, gainers, losers, timestamp] Candle: type: object properties: time: type: integer description: Unix timestamp in seconds open: type: number high: type: number low: type: number close: type: number volume: type: number required: [time, open, high, low, close] HistoricalResponse: type: object properties: symbol: type: string timeframe: type: string candles: type: array items: $ref: "#/components/schemas/Candle" from: type: integer to: type: integer count: type: integer source: type: string required: [symbol, timeframe, candles, count] AnalysisRequest: type: object properties: timeframe: type: string mode: type: string enum: [scalping, intraday, swing, trend, reversal, institutional, conservative, aggressive] default: swing indicators: type: array items: type: string sensitivity: type: number minimum: 0 maximum: 1 default: 0.5 includeMultiTimeframe: type: boolean default: true required: [timeframe] TradeSignal: type: object properties: type: type: string enum: [BUY, SELL, NEUTRAL, WAIT, HIGH_RISK] entry: type: number stopLoss: type: number takeProfit1: type: number takeProfit2: type: number takeProfit3: type: number riskReward: type: number confidence: type: number reason: type: string supportingFactors: type: array items: type: string opposingFactors: type: array items: type: string invalidationConditions: type: array items: type: string confirmationConditions: type: array items: type: string alternativeScenario: type: string reversalProbability: type: number strength: type: string enum: [strong, moderate, weak] required: [type, confidence, reason] IndicatorResult: type: object properties: name: type: string type: type: string status: type: string enum: [bullish, bearish, neutral] value: type: number signal: type: string confidence: type: number successRate: type: number reason: type: string weight: type: number timeframe: type: string entryPoint: type: number required: [name, type, status, confidence, reason] Zone: type: object properties: price: type: number strength: type: number type: type: string label: type: string required: [price, strength, type] AnalysisResult: type: object properties: symbol: type: string timeframe: type: string mode: type: string timestamp: type: integer trend: type: string enum: [bullish, bearish, neutral, ranging] trendStrength: type: number currentState: type: string signal: $ref: "#/components/schemas/TradeSignal" indicators: type: array items: $ref: "#/components/schemas/IndicatorResult" patterns: type: array items: type: string supportLevels: type: array items: $ref: "#/components/schemas/Zone" resistanceLevels: type: array items: $ref: "#/components/schemas/Zone" liquidityZones: type: array items: $ref: "#/components/schemas/Zone" demandZones: type: array items: $ref: "#/components/schemas/Zone" supplyZones: type: array items: $ref: "#/components/schemas/Zone" fibonacci: type: object properties: levels: type: array items: type: object properties: ratio: type: number price: type: number required: [ratio, price] multiTimeframe: type: object additionalProperties: type: string overallRating: type: string overallConfidence: type: number marketNotes: type: string buySignals: type: integer sellSignals: type: integer neutralSignals: type: integer required: [symbol, timeframe, timestamp, trend, signal, overallConfidence] IndicatorsResponse: type: object properties: symbol: type: string timeframe: type: string indicators: type: array items: $ref: "#/components/schemas/IndicatorResult" timestamp: type: integer required: [symbol, timeframe, indicators, timestamp] SignalsResponse: type: object properties: symbol: type: string timeframe: type: string mode: type: string signals: type: array items: $ref: "#/components/schemas/TradeSignal" timestamp: type: integer buyCount: type: integer sellCount: type: integer neutralCount: type: integer required: [symbol, timeframe, signals, timestamp] Pattern: type: object properties: name: type: string type: type: string enum: [bullish, bearish, neutral] confidence: type: number candles: type: integer description: type: string priceImpact: type: string required: [name, type, confidence] PatternsResponse: type: object properties: symbol: type: string timeframe: type: string patterns: type: array items: $ref: "#/components/schemas/Pattern" timestamp: type: integer required: [symbol, timeframe, patterns, timestamp] SupportResistanceResponse: type: object properties: symbol: type: string timeframe: type: string support: type: array items: $ref: "#/components/schemas/Zone" resistance: type: array items: $ref: "#/components/schemas/Zone" pivots: type: object properties: pp: type: number r1: type: number r2: type: number r3: type: number s1: type: number s2: type: number s3: type: number timestamp: type: integer required: [symbol, timeframe, support, resistance, timestamp] AnalysisSummaryRow: type: object properties: id: type: string name: type: string type: type: string status: type: string signal: type: string currentPrice: type: number entryPoint: type: number confidence: type: number successRate: type: number reason: type: string timeframe: type: string symbol: type: string required: [id, name, type, status, signal, confidence, reason, timeframe, symbol] AnalysisSummary: type: object properties: symbol: type: string timeframe: type: string mode: type: string rows: type: array items: $ref: "#/components/schemas/AnalysisSummaryRow" buyCount: type: integer sellCount: type: integer neutralCount: type: integer pendingCount: type: integer strongSetups: type: integer weakSetups: type: integer topConfidence: type: number topFactor: type: string timestamp: type: integer required: [symbol, timeframe, rows, buyCount, sellCount, neutralCount, timestamp] Alert: type: object properties: id: type: string symbol: type: string type: type: string enum: [price, signal, pattern, breakout, liquidity] condition: type: string value: type: number message: type: string active: type: boolean triggered: type: boolean triggeredAt: type: integer createdAt: type: integer timeframe: type: string required: [id, symbol, type, condition, active, triggered, createdAt] AlertsResponse: type: object properties: alerts: type: array items: $ref: "#/components/schemas/Alert" total: type: integer active: type: integer triggered: type: integer required: [alerts, total, active, triggered] CreateAlertBody: type: object properties: symbol: type: string type: type: string enum: [price, signal, pattern, breakout, liquidity] condition: type: string value: type: number message: type: string timeframe: type: string required: [symbol, type, condition] DeleteResponse: type: object properties: success: type: boolean message: type: string required: [success] UserSettings: type: object properties: language: type: string enum: [ar, en] default: ar theme: type: string enum: [dark, light, medium] default: dark tradingMode: type: string default: swing signalStyle: type: string enum: [instant, pending, confirmatory, conservative, aggressive] default: confirmatory symbol: type: string default: XAUUSD timeframe: type: string default: 1h analysisStrength: type: number default: 0.7 sensitivity: type: number default: 0.5 riskLevel: type: string enum: [low, medium, high] default: medium activeIndicators: type: array items: type: string activeStrategies: type: array items: type: string overlaysEnabled: type: boolean default: true alertsEnabled: type: boolean default: true visualAnalysis: type: boolean default: true smartAnalysis: type: boolean default: true liveStream: type: boolean default: true historicalBackfill: type: boolean default: true dataSource: type: string default: dukascopy required: [language, theme, tradingMode, symbol, timeframe] UpdateSettingsBody: type: object properties: language: type: string theme: type: string tradingMode: type: string signalStyle: type: string symbol: type: string timeframe: type: string analysisStrength: type: number sensitivity: type: number riskLevel: type: string activeIndicators: type: array items: type: string activeStrategies: type: array items: type: string overlaysEnabled: type: boolean alertsEnabled: type: boolean visualAnalysis: type: boolean smartAnalysis: type: boolean liveStream: type: boolean historicalBackfill: type: boolean dataSource: type: string ConnectBrokerBody: type: object properties: username: type: string password: type: string accountType: type: string enum: [demo, live] pin: type: string required: [username, password, accountType] ConnectionStatus: type: object properties: connected: type: boolean accountType: type: string username: type: string broker: type: string lastConnected: type: integer symbols: type: integer streamActive: type: boolean errorMessage: type: string dataFeedStatus: type: string enum: [live, delayed, disconnected, demo] required: [connected] WatchlistItem: type: object properties: symbol: type: string name: type: string addedAt: type: integer quote: $ref: "#/components/schemas/Quote" required: [symbol, addedAt] WatchlistResponse: type: object properties: items: type: array items: $ref: "#/components/schemas/WatchlistItem" total: type: integer required: [items, total] AddWatchlistBody: type: object properties: symbol: type: string required: [symbol] BacktestRequest: type: object properties: timeframe: type: string strategy: type: string mode: type: string from: type: string to: type: string initialCapital: type: number default: 10000 riskPerTrade: type: number default: 0.02 spread: type: number slippage: type: number parameters: type: object required: [timeframe, strategy] BacktestTrade: type: object properties: id: type: integer type: type: string entryTime: type: integer exitTime: type: integer entryPrice: type: number exitPrice: type: number stopLoss: type: number takeProfit: type: number pnl: type: number pnlPercent: type: number reason: type: string required: [id, type, entryTime, entryPrice, pnl] BacktestResult: type: object properties: symbol: type: string timeframe: type: string strategy: type: string from: type: integer to: type: integer totalTrades: type: integer winningTrades: type: integer losingTrades: type: integer winRate: type: number profitFactor: type: number totalReturn: type: number totalReturnPercent: type: number maxDrawdown: type: number maxDrawdownPercent: type: number avgRR: type: number sharpeRatio: type: number trades: type: array items: $ref: "#/components/schemas/BacktestTrade" equityCurve: type: array items: type: object properties: time: type: integer equity: type: number required: [time, equity] required: [symbol, timeframe, strategy, totalTrades, winRate, profitFactor, totalReturn]