### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ### ### ~~~~~~~~~~~~~ S P O T W A R E C O N N E C T A P I ~~~~~~~~~~~~~~~ ### ### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ### # ----------------------------------------------------------------------------- # Custom data types used in this schema: # ----------------------------------------------------------------------------- # monetary - used for fields that stores monetary data. Contains the monetary # amount in cents, penny, etc. (monetary_unit / 100). # Is represented using long (int64) data type. # Example: balance:100000, depositCurrency:USD => balance: 1000 USD # timestamp - used for fields that stores data/timestamp. Is defined as the # number of milliseconds that have elapsed since # midnight 1 January 1970 UTC. # ----------------------------------------------------------------------------- # Optional and required values: # ----------------------------------------------------------------------------- # Each object will have required fields that are expected to always have some # value and optional fields that could either be omitted from object or set to # null. In this schema all required fields are marked with "*" symbol. # MessageJson: error: ErrorJson # is present only in case of error data: Object # any type of data, see docs for each call # ----------------------------------------------------------------------------- CursorMessageJson: error: ErrorJson # is present only in case of error data: Array # any type of data, see docs for each call next: string # cursor id for next chunk if there is more data # ----------------------------------------------------------------------------- ErrorJson: * errorCode: string * description: string # ----------------------------------------------------------------------------- ProfileJson: * userId: long # unique user id nickname: string # null if PROFILE_NICKNAME permission is not granted email: string # null if PROFILE_EMAIL permission is not granted # ----------------------------------------------------------------------------- TradingAccountJson: * accountId: long # unique trading account id * accountNumber: long # broker specific trading account number * live: boolean # live or demo * brokerTitle: string # human readable broker name * brokerNameId: string # unique immutable broker string identifier * depositCurrency: string # USD, EUR, etc traderRegistrationTimestamp: timestamp # timestamp of trader account registration on cServer leverage: int # 1, 10, 50, 100, etc., null if not known balance: monetary # trading account balance, null if not known deleted: boolean # whether trading account was deleted by broker or not, could be null if not known # ----------------------------------------------------------------------------- DepositWithdrawResJson: * cashflowId: long # deposit/withdraw cashflow Id # ----------------------------------------------------------------------------- DepositWithdrawReqJson: * amount: monetary # amount to be deposit or withdraw # ----------------------------------------------------------------------------- TradingHistoryJson: * tradeId: long * symbolName: string * tradeSide: string # ["BUY"|"SELL"] * volume: monetary * commission: monetary * swap: monetary * profit: monetary # gross profit * balance: monetary * entryPrice: double * entryTimestamp: timestamp * closePrice: double * closeTimestamp: timestamp stopLoss : double takeProfit: double profitInPips: double comment: string channel: string label: string # ----------------------------------------------------------------------------- CashflowJson: * cashflowId: long * type: string # ["DEPOSIT"|"WITHDRAW"] * delta: monetary * balance: monetary * balanceVersion : long * changeTimestamp: timestamp # ----------------------------------------------------------------------------- PendingOrderJson: * orderId: long # API does NOT guarantee the uniqueness of this field. It is unique only within one account (accountId) * symbolName: string * orderType: string # ["LIMIT"|"STOP"] * tradeSide: string # ["BUY"|"SELL"] * price: double * volume: monetary stopLoss: double takeProfit: double * createTimestamp: timestamp expirationTimestamp: timestamp currentPrice: double # could be null if there are no prices for trader distanceInPips: double # if currentPrice is null then this field is also null comment: string channel: string label: string # ----------------------------------------------------------------------------- PositionJson: * positionId: long # API does NOT guarantee the uniqueness of this field. It is unique only within one account (accountId) * symbolName: string * tradeSide: string # ["BUY"|"SELL"] * volume: monetary * entryPrice: double * entryTimestamp: timestamp stopLoss: double takeProfit: double profit: monetary # gross profit, could be null if trader has no prices * commission: monetary * marginRate: double * swap: monetary currentPrice: double # null if no prices are present profitInPips: double # will also be null if no prices are present comment: string channel: string label: string # ----------------------------------------------------------------------------- SymbolJson: * symbolName: string * digits: int * pipPosition: int measurementUnits: string * baseAsset: string * quoteAsset: string * tradeEnabled: boolean * tickSize: double description: string * maxLeverage: int * minOrderVolume: monetary * minOrderStep: monetary * maxOrderVolume: monetary * swapLong: double * swapShort: double * threeDaysSwaps: string # ["MONDAY"|"TUESDAY"|"WEDNESDAY"|"THURSDAY"|"FRIDAY"|"SATURDAY"|"SUNDAY"] * assetClass: string # ----------------------------------------------------------------------------- TickDataJson: * timestamp: timestamp * tick: double # ----------------------------------------------------------------------------- TrendbarJson * timestamp: timestamp # timestamp of period start * high: double * low: double * open: double * close: double * volume: monetary # ----------------------------------------------------------------------------- DealJson * dealId : long * positionId : long * orderId : long * tradeSide : string # ["BUY"|"SELL"] * volume : monetary * filledVolume : monetary * symbolName : string commission : monetary executionPrice : double baseToUsdConversionRate : double marginRate : double channel : string label : string comment : string * createTimestamp : timestamp executionTimestamp : timestamp positionCloseDetails : PositionCloseDetailsJson # available only for closing deals # ----------------------------------------------------------------------------- PositionCloseDetailsJson * entryPrice : double * profit : monetary # gross profit * swap : monetary * commission : monetary * balance : monetary * balanceVersion : long comment : string stopLossPrice : double takeProfitPrice : double quoteToDepositConversionRate : double # null if no prices are present * closedVolume : monetary profitInPips : double # ----------------------------------------------------------------------------- CreateDemoTraderAccountReqJson * countryId : long; * phoneNumber : string; * leverage : int; # 1, 10, 50, 100, etc. balance : monetary; depositCurrency : string; # USD, EUR, etc password : string; # password in clear text accountType = string; # default HEDGED # -----------------------------------------------------------------------------