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: VelozTrade API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: account description: Account management - name: instruments description: Market instruments and quotes - name: positions description: Open trading positions - name: orders description: Trade history and closed orders - name: pendingOrders description: Pending limit orders - name: watchlist description: User watchlist - name: dashboard description: Dashboard summary and stats - name: alerts description: Price alerts - name: fundsHistory description: Deposit and withdrawal history - name: social description: Social feed and trade ideas paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /account: get: operationId: getAccount tags: [account] summary: Get account info description: Returns current account balance, equity, margin, and P&L responses: "200": description: Account info content: application/json: schema: $ref: "#/components/schemas/Account" patch: operationId: updateAccount tags: [account] summary: Update account settings description: Update account type (demo/real) and KYC status requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AccountUpdate" responses: "200": description: Updated account content: application/json: schema: $ref: "#/components/schemas/Account" /account/equity-history: get: operationId: getEquityHistory tags: [account] summary: Get equity history description: Returns the user's real equity curve computed from closed orders responses: "200": description: Equity history data points content: application/json: schema: type: array items: $ref: "#/components/schemas/EquityPoint" /social/posts: get: operationId: listSocialPosts tags: [social] summary: List own social posts description: Returns the authenticated user's own trade idea posts responses: "200": description: List of social posts content: application/json: schema: type: array items: $ref: "#/components/schemas/SocialPost" post: operationId: createSocialPost tags: [social] summary: Create a trade idea post description: Publishes a new trade idea to the social feed requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SocialPostInput" responses: "201": description: Created post content: application/json: schema: $ref: "#/components/schemas/SocialPost" /deposit/crypto-history: get: operationId: listCryptoDepositHistory tags: [fundsHistory] summary: List on-chain crypto deposit history description: Returns all verified on-chain USDT deposits for the authenticated user, sorted newest first responses: "200": description: Crypto deposit history content: application/json: schema: type: array items: $ref: "#/components/schemas/CryptoDepositHistoryItem" /funds-history: get: operationId: listFundsHistory tags: [fundsHistory] summary: List deposit and withdrawal history description: Returns all deposit and withdrawal requests for the authenticated user, sorted newest first responses: "200": description: Funds history content: application/json: schema: type: array items: $ref: "#/components/schemas/FundsHistoryItem" /instruments: get: operationId: listInstruments tags: [instruments] summary: List trading instruments description: Returns all available trading instruments, filterable by type parameters: - name: type in: query required: false schema: type: string enum: [forex, crypto, stocks, commodities, indices] - name: search in: query required: false schema: type: string responses: "200": description: List of instruments content: application/json: schema: type: array items: $ref: "#/components/schemas/Instrument" /instruments/{symbol}/quote: get: operationId: getQuote tags: [instruments] summary: Get real-time quote description: Returns current bid/ask price and 24h change 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" "404": description: Symbol not found /candles: get: operationId: getCandles tags: [instruments] summary: Get OHLCV candles description: Returns historical candlestick data for a symbol parameters: - name: symbol in: query required: true schema: type: string - name: interval in: query required: false schema: type: string enum: ["1min", "5min", "15min", "30min", "1h", "4h", "1day", "1week"] default: "1h" - name: outputsize in: query required: false schema: type: integer default: 100 responses: "200": description: Candle data content: application/json: schema: type: array items: $ref: "#/components/schemas/Candle" /positions: get: operationId: listPositions tags: [positions] summary: List open positions description: Returns all currently open trading positions responses: "200": description: Open positions content: application/json: schema: type: array items: $ref: "#/components/schemas/Position" post: operationId: openPosition tags: [positions] summary: Open a new position description: Places a new buy or sell trade requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PositionInput" responses: "201": description: Position opened content: application/json: schema: $ref: "#/components/schemas/Position" "400": description: Invalid trade parameters /positions/{id}: get: operationId: getPosition tags: [positions] summary: Get position details parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Position details content: application/json: schema: $ref: "#/components/schemas/Position" "404": description: Position not found patch: operationId: updatePosition tags: [positions] summary: Modify position SL/TP parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PositionUpdate" responses: "200": description: Position updated content: application/json: schema: $ref: "#/components/schemas/Position" "404": description: Position not found delete: operationId: closePosition tags: [positions] summary: Close a position description: Closes an open trading position. Pass the closePrice the client observed to ensure zero-slippage execution. parameters: - name: id in: path required: true schema: type: integer requestBody: required: false content: application/json: schema: $ref: "#/components/schemas/ClosePositionInput" responses: "200": description: Position closed, returns closed order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Position not found /orders: get: operationId: listOrders tags: [orders] summary: List trade history description: Returns closed/historical trades ordered by close time desc parameters: - name: symbol in: query required: false schema: type: string - name: limit in: query required: false schema: type: integer default: 50 responses: "200": description: Trade history content: application/json: schema: type: array items: $ref: "#/components/schemas/Order" /orders/{id}/journal: patch: operationId: updateOrderJournal tags: [orders] summary: Update trade journal entry description: Attach or update notes, strategy tag, and sentiment rating on a closed trade parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/JournalInput" responses: "200": description: Updated order content: application/json: schema: $ref: "#/components/schemas/Order" "404": description: Order not found /pending-orders: get: operationId: listPendingOrders tags: [pendingOrders] summary: List pending limit orders description: Returns all pending limit orders for the authenticated user responses: "200": description: Pending orders content: application/json: schema: type: array items: $ref: "#/components/schemas/PendingOrder" post: operationId: createPendingOrder tags: [pendingOrders] summary: Place a pending limit order description: Creates a limit order that activates when the market price reaches the limit price requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PendingOrderInput" responses: "201": description: Pending order created content: application/json: schema: $ref: "#/components/schemas/PendingOrder" "400": description: Invalid order parameters /pending-orders/{id}: delete: operationId: cancelPendingOrder tags: [pendingOrders] summary: Cancel a pending order parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Cancelled "404": description: Pending order not found /watchlist: get: operationId: getWatchlist tags: [watchlist] summary: Get watchlist description: Returns all symbols in the user watchlist with current quotes responses: "200": description: Watchlist items content: application/json: schema: type: array items: $ref: "#/components/schemas/WatchlistItem" post: operationId: addToWatchlist tags: [watchlist] summary: Add symbol to watchlist requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WatchlistInput" responses: "201": description: Symbol added content: application/json: schema: $ref: "#/components/schemas/WatchlistItem" "400": description: Symbol already in watchlist /watchlist/{symbol}: delete: operationId: removeFromWatchlist tags: [watchlist] summary: Remove symbol from watchlist parameters: - name: symbol in: path required: true schema: type: string responses: "204": description: Removed "404": description: Symbol not in watchlist /dashboard/summary: get: operationId: getDashboardSummary tags: [dashboard] summary: Get dashboard summary description: Returns account stats, open position count, floating P&L, win rate, and top movers responses: "200": description: Dashboard summary content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /dashboard/activity: get: operationId: getDashboardActivity tags: [dashboard] summary: Recent trade activity description: Returns the 10 most recent trades and account events responses: "200": description: Recent activity content: application/json: schema: type: array items: $ref: "#/components/schemas/ActivityItem" /market/movers: get: operationId: getMarketMovers tags: [instruments] summary: Top market movers description: Returns top gainers and losers across all instruments responses: "200": description: Market movers content: application/json: schema: $ref: "#/components/schemas/MarketMovers" /alerts: get: operationId: listAlerts tags: [alerts] summary: List price alerts description: Returns all active and triggered alerts for the current user responses: "200": description: List of alerts content: application/json: schema: type: array items: $ref: "#/components/schemas/PriceAlert" post: operationId: createAlert tags: [alerts] summary: Create a price alert description: Set a price alert that fires when a symbol crosses the target price requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PriceAlertInput" responses: "201": description: Created alert content: application/json: schema: $ref: "#/components/schemas/PriceAlert" "400": description: Invalid input /alerts/{id}: delete: operationId: deleteAlert tags: [alerts] summary: Delete a price alert description: Remove an alert by ID parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Alert not found /leaderboard: get: operationId: getLeaderboard tags: [account] summary: Trader leaderboard description: Returns all traders ranked by total P&L percentage responses: "200": description: Ranked leaderboard content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" /alerts/{id}/trigger: patch: operationId: triggerAlert tags: [alerts] summary: Mark alert as triggered description: Called by the client when the WS price crosses the threshold parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Updated alert content: application/json: schema: $ref: "#/components/schemas/PriceAlert" "404": description: Alert not found components: schemas: HealthStatus: type: object properties: status: type: string required: - status Account: type: object required: [id, balance, equity, margin, freeMargin, marginLevel, floatingPnl, currency, leverage, accountType, kycStatus, demoBalance, isDemoMode] properties: id: type: integer balance: type: number demoBalance: type: number isDemoMode: type: boolean equity: type: number margin: type: number freeMargin: type: number marginLevel: type: number floatingPnl: type: number currency: type: string leverage: type: integer accountType: type: string enum: [real, silver, gold, platinum, vip] kycStatus: type: string enum: [unverified, pending, verified] AccountUpdate: type: object properties: isDemoMode: type: boolean kycStatus: type: string enum: [unverified, pending, verified] leverage: type: integer Instrument: type: object required: [symbol, name, type, category, pip, lotSize] properties: symbol: type: string name: type: string type: type: string enum: [forex, crypto, stocks, commodities, indices] category: type: string pip: type: number lotSize: type: number spread: type: ["number", "null"] currentPrice: type: ["number", "null"] changePercent: type: ["number", "null"] Quote: type: object required: [symbol, bid, ask, price, change, changePercent, timestamp] properties: symbol: type: string bid: type: number ask: type: number price: type: number change: type: number changePercent: type: number high: type: ["number", "null"] low: type: ["number", "null"] volume: type: ["number", "null"] timestamp: type: string Candle: type: object required: [datetime, open, high, low, close, volume] properties: datetime: type: string open: type: number high: type: number low: type: number close: type: number volume: type: number Position: type: object required: [id, symbol, type, direction, volume, openPrice, currentPrice, profit, swap, openTime, lotSize] properties: id: type: integer symbol: type: string symbolName: type: string type: type: string enum: [market] direction: type: string enum: [buy, sell] volume: type: number lotSize: type: number openPrice: type: number currentPrice: type: number stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] profit: type: number swap: type: number commission: type: number openTime: type: string PositionInput: type: object required: [symbol, direction, volume] properties: symbol: type: string direction: type: string enum: [buy, sell] volume: type: number stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] PositionUpdate: type: object properties: stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] Order: type: object required: [id, symbol, direction, volume, openPrice, closePrice, profit, openTime, closeTime] properties: id: type: integer symbol: type: string symbolName: type: string direction: type: string enum: [buy, sell] volume: type: number openPrice: type: number closePrice: type: number stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] profit: type: number swap: type: number commission: type: number openTime: type: string closeTime: type: string journalNote: type: ["string", "null"] strategyTag: type: ["string", "null"] sentimentRating: type: ["integer", "null"] JournalInput: type: object properties: journalNote: type: ["string", "null"] strategyTag: type: ["string", "null"] sentimentRating: type: ["integer", "null"] PendingOrder: type: object required: [id, symbol, direction, orderType, volume, limitPrice, marginReserved, status, createdAt] properties: id: type: integer symbol: type: string symbolName: type: string direction: type: string enum: [buy, sell] orderType: type: string enum: [buy_limit, sell_limit, buy_stop, sell_stop, buy_stop_limit, sell_stop_limit, trailing_stop] volume: type: number limitPrice: type: number stopPrice: type: ["number", "null"] trailingDistance: type: ["number", "null"] marginReserved: type: number stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] status: type: string enum: [pending, filled, cancelled] createdAt: type: string PendingOrderInput: type: object required: [symbol, direction, volume, limitPrice] properties: symbol: type: string direction: type: string enum: [buy, sell] orderType: type: string enum: [buy_limit, sell_limit, buy_stop, sell_stop, buy_stop_limit, sell_stop_limit, trailing_stop] volume: type: number limitPrice: type: number stopPrice: type: ["number", "null"] trailingDistance: type: ["number", "null"] stopLoss: type: ["number", "null"] takeProfit: type: ["number", "null"] WatchlistItem: type: object required: [symbol, name, type, price, changePercent, addedAt] properties: symbol: type: string name: type: string type: type: string price: type: ["number", "null"] change: type: ["number", "null"] changePercent: type: ["number", "null"] bid: type: ["number", "null"] ask: type: ["number", "null"] addedAt: type: string WatchlistInput: type: object required: [symbol] properties: symbol: type: string DashboardSummary: type: object required: [balance, equity, floatingPnl, openPositions, totalTrades, winRate, totalProfit, marginLevel] properties: balance: type: number equity: type: number floatingPnl: type: number openPositions: type: integer totalTrades: type: integer winRate: type: number totalProfit: type: number marginLevel: type: number todayPnl: type: number weekPnl: type: number ActivityItem: type: object required: [id, type, description, amount, timestamp] properties: id: type: integer type: type: string enum: [trade_open, trade_close, deposit, withdrawal] description: type: string symbol: type: ["string", "null"] amount: type: ["number", "null"] timestamp: type: string MarketMovers: type: object required: [gainers, losers] properties: gainers: type: array items: $ref: "#/components/schemas/Instrument" losers: type: array items: $ref: "#/components/schemas/Instrument" PriceAlert: type: object required: [id, symbol, targetPrice, condition, status, createdAt] properties: id: type: integer symbol: type: string targetPrice: type: number condition: type: string enum: [above, below] status: type: string enum: [active, triggered, cancelled] note: type: ["string", "null"] createdAt: type: string triggeredAt: type: ["string", "null"] PriceAlertInput: type: object required: [symbol, targetPrice, condition] properties: symbol: type: string targetPrice: type: number condition: type: string enum: [above, below] note: type: ["string", "null"] LeaderboardEntry: type: object required: [rank, userId, displayName, totalPnl, pnlPercent, totalTrades, winRate, startBalance, openPositions] properties: rank: type: integer userId: type: string displayName: type: string avatarUrl: type: ["string", "null"] totalPnl: type: number pnlPercent: type: number totalTrades: type: integer winRate: type: number startBalance: type: number openPositions: type: integer FundsHistoryItem: type: object required: [id, type, method, amount, status, date, ref] properties: id: type: integer type: type: string enum: [deposit, withdrawal] method: type: string amount: type: number status: type: string date: type: string ref: type: string CryptoDepositHistoryItem: type: object required: [id, txHash, fromWallet, chainId, network, amountUsdt, creditedAt, explorerUrl] properties: id: type: integer txHash: type: string fromWallet: type: string chainId: type: integer network: type: string amountUsdt: type: number creditedAt: type: string explorerUrl: type: string EquityPoint: type: object required: [date, equity] properties: date: type: string equity: type: number SocialPost: type: object required: [id, clerkUserId, content, createdAt] properties: id: type: integer clerkUserId: type: string content: type: string symbol: type: ["string", "null"] createdAt: type: string ClosePositionInput: type: object properties: closePrice: type: number description: The bid/ask price the client saw when the user clicked Close. Used for zero-slippage execution. SocialPostInput: type: object required: [content] properties: content: type: string symbol: type: ["string", "null"]