getBid (SDK Trading)
getBid is a Fintechee API to get the current bid of the specific instrument(symbol). This API should be called in the onTick or deinit callback function. You need to input the broker name, the account ID, the symbol name as the parameters. Before you call this function, you need to call the getQuotes function to subscribe the streaming quotes in the init callback function.
number
getBid(context, brokerName, accountId, symbolName) ⇒ EA SDK This function gets the bid of the specific symbol. Phase (this API's scope): onTick | deinit
Kind: global function
Returns: number
- bid.
Param | Type | Description |
---|---|---|
context | object | the name should be the same with the name of parameter of onTickFunction |
brokerName | string | broker name |
accountId | string | account ID |
symbolName | string | symbol name |
getBid (SDK Trading)
registerEA(
"test_api",
"An EA to test APIs",
[],
function (context) { // Init()
var account = getAccount(context, 0)
var brokerName = getBrokerNameOfAccount(account)
var accountId = getAccountIdOfAccount(account)
var symbolName = "EUR/USD"
getQuotes (context, brokerName, accountId, symbolName)
},
function (context) { // Deinit()
},
function (context) { // OnTick()
var bid = getBid(context, brokerName, accountId, symbolName)
})