n1nj4z33 / iqoptionapi

IQ Option API 4.x (Python 2.7) The project is obsolete and is not supported because of problems with access to IQ Options in Russia
120 stars 545 forks source link

How to fetch active PAIR ? #22

Open HubSpace2000 opened 7 years ago

HubSpace2000 commented 7 years ago

Hello , i would like to know how to fetch the active PAIR instead of call them because IQOption always change the active PAIR time to time so it would be nice for my need to load only active one any hints or demo json please ? thanks you

HubSpace2000 commented 7 years ago

nope , look like there is no much help around...

HubSpace2000 commented 7 years ago

my project is Csharp application, my bot working very well good luck!

frxncisjoseph commented 7 years ago

What do you mean by active pair? Do you mean the assets currently available to trade or trades you currently have open positions with?

MadOne199 commented 7 years ago

You will see a link in the issue - How can i get the Profit % return of an active? - to json.txt Get that file as I will refer to it

Basically you need to init_all as explained there (api method)

You will get a response such as shown from the file you got from the link.

Looking at a section of that file, for active 1; "actives": { "1": {

You will see the following, which gives an enabled true or false for the bet_close_time If "enabled": false then it is not active If you see "enabled": true then it is active Now all you have to do is get that value. Good luck.

          "exp_time": 60,
          "bet_close_time": {
            "1493421900": {
              "enabled": false,
              "title": false
            },
            "1493421960": {
              "enabled": false,
              "title": false
            },

In this example the exp_time : 60, so that comes under turbo and is basically incremented by 60 seconds for each entry. so the first is the 1 minute trade, the second 2 minutes - up to 5 minute trade

Later on you will see under the binary, exp_time : 900, this is 900 secs or 15 minutes

This may help or confuse?? Any response from the websocket is in JSON format (profit percentage = 100 - commission) = percentage of active The following can be traced from the json.txt information In Java, to get the current percentage for active 1 (EURUSD) I use;

arryIntForexPairsTurboPercent[1] = 100 - objt.getJSONObject("msg").getJSONObject("result").getJSONObject("turbo").getJSONObject("actives").getJSONObject("1").getJSONObject("option").getJSONObject("profit").getInt("commission");

You need to do similar for the enabled values that you want. Sorry I haven't done it yet, though I recognise it is needed. I originally looked for anything trading at over 88%, but did get an unexpected 88% for Facebook one night - that was not active for another day or so. I need to prevent trading on anything like that.

One thing to note is that if you set actives to [1,2] and later set actives to [3,4], it will get newChartData responses for 1,2,3 and 4. It does not reset the first set actives, but simply adds more actives where applicable.