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