How to get Complete pip size!! using binary-live-api?

Hi, I want to get the pips history and I see that the information it returns is incomplete, why is it?

this is the request I made in the binary api:

{
"ticks_history": "R_50",
"adjust_start_time": 1,
"count": 10,
"end": "latest",
"start": 1,
"style": "ticks"
}
and it returns the following:

  224.1247,
  224.1231,
  224.132,
  224.1504,
  224.1817

How can I make it return, the last digit of the complete pips including or rounded to zero, all pips with 4 decimals like this:

  224.1247,
  224.1231,
  224.1320,
  224.1504,
  224.1817

in this link : https://github.com/binary-com/binary-live-api/blob/master/demos/advanced/demo.js
use there is an example of binary-live-api:

api.events.on('history', function(response) {
console.log(response);
});
api.getTickHistory({symbol: 'frxUSDJPY', end: 'latest', count: 10});

and the final big question, how can I force it to show all pip history to 4 decimal places:

example:

221.15 ======> 221.1500
223.234 =====> 223.2340

Comments

  • Hi @Emsus369 if you are using JavaScript you can use the toFixed method so something like quote.toFixed(pip_size)
    as an example

    const number = 10.10;
    const pip_size = 4;
    console.log(number.toFixed(pip_size));
    

    I hope that helps
    Mike

  • ok thank so much, and how would I do it here:
    {
    "ticks_history": "R_50",
    "adjust_start_time": 1,
    "count": 10,
    "end": "latest",
    "start": 1,
    "style": "ticks"
    }

    or here with binary-live-api:

    api.getTickHistory("R_75", {
    end: "latest",
    count: 14,
    style: "ticks",
    subscribe: 1,
    });
    because I want to get the last 1000 digits of each tick

  • Tick History returns a pip size so just need to use that and apply to the History results.

    {
      "echo_req": {
        "adjust_start_time": 1,
        "count": 10,
        "end": "latest",
        "start": 1,
        "style": "ticks",
        "ticks_history": "R_50"
      },
      "history": {
        "prices": [
          219.3709,
          219.3207,
          219.3098,
          219.3,
          219.3248,
          219.3411,
          219.3298,
          219.3367,
          219.3281,
          219.3226
        ],
        "times": [
          1624917884,
          1624917886,
          1624917888,
          1624917890,
          1624917892,
          1624917894,
          1624917896,
          1624917898,
          1624917900,
          1624917902
        ]
      },
      "msg_type": "history",
      "pip_size": 4
    }
    
Sign In or Register to comment.