getOrderType (SDK Trading)
getOrderType is a Fintechee API to get the order type(long or short) of the specific pending order or open trade.
- If the parameter is a pending order, then you get the order type(long or short) of the pending order that you sent.
- If the parameter is a open trade, then you get the order type(long or short) of the open trade that has been executed.
number
getOrderType(orderOrTrade) ⇒ EA SDK This function gets the order type(buy or sell) of the specific pending order or open trade. Phase (this API's scope): onTick | deinit
Kind: global function
Returns: number
- order type(ORDER_TYPE.OP_BUY or ORDER_TYPE.OP_SELL).
Param | Type | Description |
---|---|---|
orderOrTrade | object | specific pending order or open trade |
getOrderType (SDK Trading)
registerEA(
"test_api",
"An EA to test APIs",
[],
function (context) { // Init()
},
function (context) { // Deinit()
},
function (context) { // OnTick()
var length = getPendingOrdersListLength(context)
for (var i = 0; i < length; i++) {
var pendingOrder = getPendingOrder(context, i)
if (pendingOrder != null) {
var type = getOrderType(pendingOrder)
}
}
length = getOpenTradesListLength(context)
for (var i = 0; i < length; i++) {
var openTrade = getOpenTrade(context, i)
if (openTrade != null) {
var type = getOrderType(openTrade)
}
}
})