getBrokerName (SDK Trading)
getBrokerName is a Fintechee API to get the broker name of the specific pending order or open trade.
- If the parameter is a pending order, then you get the broker name of the pending order that you sent.
- If the parameter is a open trade, then you get the broker name of the open trade that has been executed.
string
getBrokerName(orderOrTrade) ⇒ EA SDK This function gets the broker name of the specific pending order or open trade. Phase (this API's scope): onTick | deinit
Kind: global function
Returns: string
- broker name.
Param | Type | Description |
---|---|---|
orderOrTrade | object | specific pending order or open trade |
getBrokerName (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 brokerName = getBrokerName(pendingOrder)
}
}
length = getOpenTradesListLength(context)
for (var i = 0; i < length; i++) {
var openTrade = getOpenTrade(context, i)
if (openTrade != null) {
var brokerName = getBrokerName(openTrade)
}
}
})