Raunak

About

Username
Raunak
Joined
Visits
829
Last Active
Roles
Moderator
Points
89
Badges
7
  • Re: Apps without app_id are blocked now

    @Middleend you need to register your app as specified above. You cannot pass random app id in this.

  • Re: Picking up echo_req responses

    @Middleend why not do something like this

    ws.onopen = function(evt) {
        ws.send(JSON.stringify({ 
            "ticks_history": "frxGBPUSD","end": "latest","count": 86400,"style":"candles","granularity": 14400,"subscribe":1 })
        ); 
    }
    
    ws.onmessage = function(msg) {
        var data = JSON.parse(msg.data); 
    
        // categorised based on msg_type rather than data
        if (data["msg_type"] === "candles") {
            var arr1 = data["candles"].map(function(candles) {
                return {
                    day: moment(candles.epoch * 1000).format('DD/MM/YYYY'),
                    time: moment(candles.epoch * 1000).format('HH:MM:SS'),
                    open: candles.open,
                    high: candles.high,
                    low: candles.low,
                    close: candles.close
                };
            });
        } else if (data["msg_type"] === "ohlc") {
            var ohlc = data["ohlc"];
            // play with it, use it the way you want
        }
    }
    
  • Re: Picking up echo_req responses

    The problem with your code is that you are checking msg_type length for (var i = 0; i < data["msg_type"].length; i++) { rather than type of it.

    When you request ticks_history with subscribe first it returns candles from time to current time (if no end_time) with msg_type: candles then it will start streaming ohlc from there on hence change of msg_type

  • Re: Lagging Connection

    @Uyz I didn't get it? Where you don't see any answer? As of now there is no answer to this question?

    Can you please also explain by lagging connection what is the exact problem? Any call error you received?

  • Re: how to use json code in visual basic

    you need to parse json in language you are using, for vb search for parse json in vb