Not getting response from tick history in binary-live-api

Hello All,
Need help on this below is my code but not getting tick hostory

**var ws = require('ws');
var LiveApi = require('binary-live-api').LiveApi;
var express = require('express');
var app = express();
var api = new LiveApi({ websocket: ws,appId:33050 });
api.authorize('zOlTaOJH7vhVNfN');

async function main(){
await api.authorize('zOlTaOJH7vhVNfN');
api.subscribeToBalance();

api.events.on('balance', function(data) {
    console.log(data);
});

api.getTickHistory("R_100", { end: 'latest', count: 10,"style": "ticks", "subscribe": 1 });
api.events.on("ticks", async (res) => {
    console.log(res);
});

}

main();**

Tagged:

Comments

  • The api returns 10 ticks as you specified in your request like:

    let ticks = api.getTickHistory("R_100", { end: 'latest', count: 10,"style": "ticks", "subscribe": 1 });
    

    You also don't need async in the callback function.

    You should delete that api token from your account, leaving it exposed makes your account vulnerable.

Sign In or Register to comment.