Skip to content

Commit

Permalink
Merge pull request #17 from spotware/dev
Browse files Browse the repository at this point in the history
86
  • Loading branch information
ShKhannanov authored Jul 10, 2023
2 parents 90ecab9 + 5db5520 commit 73ab98f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
31 changes: 22 additions & 9 deletions OpenApiMessages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ message ProtoOANewOrderReq {
optional double stopPrice = 8; // Stop Price, can be specified for the STOP and the STOP_LIMIT orders only.
optional ProtoOATimeInForce timeInForce = 9 [default = GOOD_TILL_CANCEL]; // The specific order execution or expiration instruction - GOOD_TILL_DATE, GOOD_TILL_CANCEL, IMMEDIATE_OR_CANCEL, FILL_OR_KILL, MARKET_ON_OPEN.
optional int64 expirationTimestamp = 10; // The exact Order expiration time. Should be set for the Good Till Date orders.
optional double stopLoss = 11; // The absolute Stop Loss price (1.23456 for example). Not supported for the MARKET orders.
optional double takeProfit = 12; // The absolute Take Profit price (1.23456 for example). Unsupported for the MARKET orders.
optional double stopLoss = 11; // The absolute Stop Loss price (1.23456 for example). Not supported for MARKET orders; for these orders, please use relativeStopLoss.
optional double takeProfit = 12; // The absolute Take Profit price (1.23456 for example). Not supported for MARKET orders; for these orders, please use relativeTakeProfit.
optional string comment = 13; // User-specified comment. MaxLength = 512.
optional double baseSlippagePrice = 14; // Base price to calculate relative slippage price for MARKET_RANGE order.
optional int32 slippageInPoints = 15; // Slippage distance for MARKET_RANGE and STOP_LIMIT order.
optional string label = 16; // User-specified label. MaxLength = 100.
optional int64 positionId = 17; // Reference to the existing position if the Order is intended to modify it.
optional string clientOrderId = 18; // Optional user-specific clientOrderId (similar to FIX ClOrderID). MaxLength = 50.
optional int64 relativeStopLoss = 19; // Relative Stop Loss that can be specified instead of the absolute as one. Specified in 1/100000 of unit of a price. For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
optional int64 relativeTakeProfit = 20; // Relative Take Profit that can be specified instead of the absolute one. Specified in 1/100000 of unit of a price. For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional int64 relativeStopLoss = 19; // Used in MARKET orders only. Relative Stop Loss that can be specified instead of the absolute as one. Specified in 1/100000 of unit of a price. For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
optional int64 relativeTakeProfit = 20; // Used in MARKET orders only. Relative Take Profit that can be specified instead of the absolute one. Specified in 1/100000 of unit of a price. For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
optional bool guaranteedStopLoss = 21; // If TRUE then stopLoss is guaranteed. Available for the French Risk or the Guaranteed Stop Loss Accounts.
optional bool trailingStopLoss = 22; // If TRUE then the Stop Loss is Trailing.
optional ProtoOAOrderTriggerMethod stopTriggerMethod = 23 [default = TRADE]; // Trigger method for the STOP or the STOP_LIMIT pending order.
optional ProtoOAOrderTriggerMethod stopTriggerMethod = 23 [default = TRADE]; // Trigger method for the STOP or the STOP_LIMIT pending order. The default value is ProtoOAOrderTriggerMethod.TRADE.
}

/** Event that is sent following the successful order acceptance or execution by the server. Acts as response to the ProtoOANewOrderReq, ProtoOACancelOrderReq, ProtoOAAmendOrderReq, ProtoOAAmendPositionSLTPReq, ProtoOAClosePositionReq requests. Also, the event is sent when a Deposit/Withdrawal took place. */
Expand Down Expand Up @@ -298,6 +298,7 @@ message ProtoOAReconcileReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_RECONCILE_REQ];

required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
optional bool returnProtectionOrders = 3; // If TRUE, then current protection orders are returned separately, otherwise you can use position.stopLoss and position.takeProfit fields.
}

/** The response to the ProtoOAReconcileReq request. */
Expand Down Expand Up @@ -336,10 +337,10 @@ message ProtoOADealListRes {

required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOADeal deal = 3; // The list of the deals.
required bool hasMore = 4; // If TRUE then the response will provide more than 10000 deals.
required bool hasMore = 4; // If TRUE then the number of records by filter is larger than chunkSize, the response contains the number of records that is equal to chunkSize.
}

/** Request for getting Trader's closed orders filtered by timestamp */
/** Request for getting Trader's orders filtered by timestamp */
message ProtoOAOrderListReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_ORDER_LIST_REQ];

Expand All @@ -354,7 +355,7 @@ message ProtoOAOrderListRes {

required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOAOrder order = 3; // The list of the orders.
required bool hasMore = 4; // If TRUE then the response will provide more than 10000 orders.
required bool hasMore = 4; // If TRUE then the number of records by filter is larger than chunkSize, the response contains the number of records that is equal to chunkSize.
}

/** Request for getting the margin estimate. Can be used before sending a new order request. */
Expand Down Expand Up @@ -519,7 +520,7 @@ message ProtoOAGetTrendbarsReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_TRENDBARS_REQ];

required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
required int64 fromTimestamp = 3; // The exact time of starting the search in milliseconds. Must be bigger or equal to zero (1-1-1970). Validation: toTimestamp - fromTimestamp <= X, where X depends on series period: M1, M2, M3, M4, M5: 302400000 (5 weeks); M10, M15, M30, H1: 21168000000 (35 weeks), H4, H12, D1: 31622400000 (1 year); W1, MN1: 158112000000 (5 years).
required int64 fromTimestamp = 3; // The exact time of starting the search in milliseconds. Must be bigger or equal to zero (1-1-1970). Validation: toTimestamp - fromTimestamp <= X, where X depends on series period: M1, M2, M3, M4, M5: 3024000000 (5 weeks); M10, M15, M30, H1: 21168000000 (35 weeks), H4, H12, D1: 31622400000 (1 year); W1, MN1: 158112000000 (5 years).
required int64 toTimestamp = 4; // The exact time of finishing the search in milliseconds. Smaller or equal to 2147483646000 (19-1-2038).
required ProtoOATrendbarPeriod period = 5; // Specifies period of trend bar series (e.g. M1, M10, etc.).
required int64 symbolId = 6; // Unique identifier of the Symbol in cTrader platform.
Expand Down Expand Up @@ -778,4 +779,16 @@ message ProtoOADealOffsetListRes {
required int64 ctidTraderAccountId = 2; // Unique identifier of the trader's account. Used to match responses to trader's accounts.
repeated ProtoOADealOffset offsetBy = 3; // Deals which closed the specified deal.
repeated ProtoOADealOffset offsetting = 4; // Deals which were closed by the specified deal.
}

message ProtoOAGetPositionUnrealizedPnLReq {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_POSITION_UNREALIZED_PNL_REQ];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
}

message ProtoOAGetPositionUnrealizedPnLRes {
optional ProtoOAPayloadType payloadType = 1 [default = PROTO_OA_GET_POSITION_UNREALIZED_PNL_RES];
required int64 ctidTraderAccountId = 2; // The unique identifier of the trader's account in cTrader platform.
repeated ProtoOAPositionUnrealizedPnL positionUnrealizedPnL = 3; // Information about trader's positions' unrealized PnLs.
required uint32 moneyDigits = 4; // Specifies the exponent of various monetary values. E.g., moneyDigits = 8 should be interpreted as the value multiplied by 10^8 with the 'real' value equal to 10053099944 / 10^8 = 100.53099944. Affects positionUnrealizedPnL.grossUnrealizedPnL, positionUnrealizedPnL.netUnrealizedPnL.
}
16 changes: 15 additions & 1 deletion OpenApiModelMessages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ enum ProtoOAPayloadType {
PROTO_OA_ORDER_LIST_BY_POSITION_ID_RES = 2184;
PROTO_OA_DEAL_OFFSET_LIST_REQ = 2185;
PROTO_OA_DEAL_OFFSET_LIST_RES = 2186;
PROTO_OA_GET_POSITION_UNREALIZED_PNL_REQ = 2187;
PROTO_OA_GET_POSITION_UNREALIZED_PNL_RES = 2188;
}

/** Asset entity. */
Expand Down Expand Up @@ -133,7 +135,7 @@ message ProtoOASymbol {
optional int64 minCommission = 21 [deprecated = true]; // Minimum commission amount per trade. Use preciseMinCommission.
optional ProtoOAMinCommissionType minCommissionType = 22 [default = CURRENCY]; // Minimum commission Type. See ProtoOAMinCommissionType for details.
optional string minCommissionAsset = 23 [default = "USD"]; // Currency for minimum commission. (USD or quote currency).
optional int64 rolloverCommission = 24; // Amount of commission per trade for Shariah Compliant accounts in deposit currency (swapFree = TRUE).
optional int64 rolloverCommission = 24; // Administrative Fee, charged instead of Swaps if the Account is marked as a "Shariah Compliant (Swap Free)". The Administrative Fee is charged daily as USD per current open volume of Position in lots. The Account charged in the Deposit currency.
optional int32 skipRolloverDays = 25; // Initial period before the first rolloverCommission will be charged on the account.
optional string scheduleTimeZone = 26; // Time zone for the symbol trading intervals.
optional ProtoOATradingMode tradingMode = 27 [default = ENABLED]; // Rules for trading with the symbol. See ProtoOATradingMode for details.
Expand All @@ -149,6 +151,7 @@ message ProtoOASymbol {
optional int32 swapTime = 37; // Time in minutes from 00:00 (UTC) when intraday swaps are charged for the first time.
optional int32 skipSWAPPeriods = 38; // Count of swapPeriods before the first SWAP charge.
optional bool chargeSwapAtWeekends = 39; // If enabled, SWAP will be charged for all days of the week, including Saturday and Sunday.
optional string measurementUnits = 40; // Specifies the units in which the base Asset of the Symbol is denominated.
}

/** Lightweight symbol entity. */
Expand All @@ -160,6 +163,7 @@ message ProtoOALightSymbol {
optional int64 quoteAssetId = 5; // Quote asset.
optional int64 symbolCategoryId = 6; // Id of the symbol category used for symbols grouping.
optional string description = 7;
optional double sortingNumber = 8; // The number used for sorting Symbols in the UI (lowest number should appear at the top).
}

message ProtoOAArchivedSymbol {
Expand All @@ -174,6 +178,7 @@ message ProtoOASymbolCategory {
required int64 id = 1; // The unique identifier of the symbol category.
required int64 assetClassId = 2; // Link to the asset class. One asset class can have many symbol categories.
required string name = 3; // Category name.
optional double sortingNumber = 4; // The number used for sorting Symbol Categories in the UI (lowest number should appear at the top).
}

enum ProtoOADayOfWeek {
Expand Down Expand Up @@ -353,6 +358,8 @@ message ProtoOATradeData {
optional string label = 5; // Text label specified during order request.
optional bool guaranteedStopLoss = 6; // If TRUE then position/order stop loss is guaranteedStopLoss.
optional string comment = 7; // User-specified comment.
optional string measurementUnits = 8; // Specifies the units in which the Symbol is denominated.
optional uint64 closeTimestamp = 9; // The UNIX timestamp in milliseconds when a Position was closed
}

/** Trade order entity. */
Expand Down Expand Up @@ -595,6 +602,7 @@ message ProtoOACtidTraderAccount {
message ProtoOAAssetClass {
optional int64 id = 1; // Unique asset ID.
optional string name = 2; // Asset class name.
optional double sortingNumber = 3; // The number used for sorting Asset Classes in the UI (lowest number should appear at the top).
}

/** Depth of market entity. */
Expand Down Expand Up @@ -697,3 +705,9 @@ message ProtoOADynamicLeverageTier {
required int64 volume = 1; // Max USD volume (in cents) of the Open Position (per side) to apply specified leverage. Last tier's leverage is applied also to volume above specified.
required int32 leverage = 2; // Applied leverage.
}

message ProtoOAPositionUnrealizedPnL {
required int64 positionId = 1; // The position ID.
required int64 grossUnrealizedPnL = 2; // The gross unrealized PnL of the position denoted in the account deposit currency.
required int64 netUnrealizedPnL = 3; // The net unrealized PnL of the position denoted in the account deposit currency. It does not include potential closing commission.
}

0 comments on commit 73ab98f

Please sign in to comment.