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
119 stars 540 forks source link

Does this still work? #23

Open MadOne199 opened 7 years ago

MadOne199 commented 7 years ago

Hi, I am new to Python but have programmed in other languages. I tried the following code in a new document run in TextWrangler - using this code:-

from iqoptionapi.api import IQOptionAPI api = IQOptionAPI("iqoption.com", "username", "password") api.connect() balance = api.profile.balance print balance api.setactives([1, 2]) api.getcandles(1,1) data = api.candles.candles_data print api.candles.candles_data

It runs okay but I get None from both print commands? But I notice that if I leave username as "username" and password as "password", it still runs okay, so is there a way to determine if it actually did connect correctly?

I installed as per the instructions, but my code is a new file created on my desktop - does that matter? Does the code need to be within the installed files path?

I obviously changed the username to my email, and password to my password. Are HTML special characters handled in passwords?

I tried opening an account at IqOption using a password without special characters, but the same result. I then tried testing the wss address of wss://iqoption.com/echo/websocket at the site - https://www.websocket.org/echo.html, and that seems to connect via the site.

I am trying to understand how this API works. It is a hobby - learning to program - I have made practical programs in Java to trade on the iqOption platform, but the price stream I used is not good enough and results in loses. Ideally I want to understand how the HTTP and WSS connections work in terms of command structure, but as I cannot get this simple program to work it seems a long long way off.

Can anyone please confirm whether this API still works. I am wondering if IqOption moved their api? And if it does work, can you see what I have done wrong?

HubSpace2000 commented 7 years ago

i confirm that the api work well , but im not using python

first you need to login to get SSID from cookie

https://iqoption.com/api/login

https://iqoption.com/api/appinit https://iqoption.com/api/getprofile

after you get you SSID u can open a websocket connection to this url wss://eu.iqoption.com/echo/{randomnumber}/{randomnumber}/websocket and send your SSID {"msg": "15d742a302e7b7278h97440d3c81a4a3", "name": "ssid"}

then you will find your way since you connected to websocket :)

google chrome WS dev tool help a lot (with iqoption browser application ) and also charleproxy (activate ssl proxy)

good luck!

MadOne199 commented 7 years ago

Thanks very much. I did get the API working within a few hours of my post by using a few delays after connect etc. I added 'Import time' and used 'time.sleep(5)' at various points. It may not be pretty or ideal, but at least it gave me an output. I spent a few hours at codecademy learning python, so as to try and follow the commands path lol. As my main interest is how does it work?, how are commands formatted? what is a websocket lol? etc. Your post is very helpful and points the way forward - Thanks again.

HubSpace2000 commented 7 years ago

Here is the full source code of the last API of IQOption APK decompiled in java https://ufile.io/0tjmd check MySocketHandler.java and other files for have a better view :) cant do better :)

MadOne199 commented 7 years ago

Thanks again Dude. I must admit the only thing I have deciphered from that last post so far was the use of org.json (JSONObject) within the websocket, but it sure helped. So far - in Java I have managed to login to http.../api/login, get the ssid from the cookie headers and login to the api via a webosocket.

For the websocket I used JSONObject; //ws.sendText({"msg": "15d742a302e7b7278h97440d3c81a4a3", "name": "ssid"}); JSONObject obj = new JSONObject(); obj.put("name", "ssid"); obj.put("msg", "15d742a302e7b7278h97440d3c81a4a3");

String message = obj.toString(); ws.sendText(message);

Now for the fun bit, I cannot get any further commands accepted such as setActives. The singularly most helpful item so far has been the login format {"msg": "15d742a302e7b7278h97440d3c81a4a3", "name": "ssid"}, as without it I would never have got this far. I have not yet looked at al the references you gave such as google chrome WS dev tool, but am sure I will investigate. I had never even heard of a websocket before finding this API, which is really good and has changed the way I write code, so as to trace its path better. I am in awe of people that can write this stuff without days of google searches for how to. Thanks so much.

HubSpace2000 commented 7 years ago

{"msg": {"actives": [1]}, "name": "setActives"} you can refer to constant.py in the python source for get the PAIR id

Aiacos commented 7 years ago

I also have trouble connecting; print api.connect() -> return None

How i can login?

MadOne199 commented 7 years ago

It works

Ensure you read the requirements etc of the wiki page - as directed by the readme file of this api.

https://github.com/n1nj4z33/iqoptionapi/wiki

try the code below (between the ---- lines), save as as yourfilename.py and run in something like textwrangler. change the values for yourUsername and yourPassword to your real login values before running it.


import time from iqoptionapi.api import IQOptionAPI

api = IQOptionAPI("iqoption.com", "yourUsername", "yourPassword")

api.connect() time.sleep(5)

balance = api.profile.balance time.sleep(5) print balance

api.setactives([1, 2]) time.sleep(5)

api.getcandles(1,1) time.sleep(5) data = api.candles.candles_data print api.candles.candles_data


The expected return will be balance, followed by candlesdata for example 2100.86 [[146439834, 1119940, 1118740, 1118320, 1143240], and more of the same....

I later cut the sleep time to 1 etc... eg . time.sleep(1), where needed. It was a bit of try it and see what happens..

Hope it works - it does for me. It is just a start, with plenty more to learn, but the previously answered issues of this api will help if you read them. this is just how i got it started .... good luck

redmiix24 commented 6 years ago

GUys please use the below code for sending socket and you will get your balance info, candlessss THanks to me of course hahaha

Please get your cookie from google chrome . filter iqoption then look for ssid , copy the content and replace below

import urllib3 import time from iqoptionapi.api import IQOptionAPI from websocket import create_connection import json ws = create_connection("wss://iqoption.com/echo/{randomnumber}/{randomnumber}/websocket") print "Sending 'Cookie'..." ws.send("{'msg': 'MY COOKIE ID', 'name': 'ssid'}") print "Sent" print "Reeiving..." result = ws.recv() print "Received '%s'" % result

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) api = IQOptionAPI("iqoption.com", "email_address", "Password") api.connect() time.sleep(5) balance = api.profile.balance time.sleep(5) print balance api.setactives([1, 2]) time.sleep(5) api.getcandles(1,1) time.sleep(5) data = api.candles.candles_data print api.candles.candles_data

-------------------------------------------- Output should be ------------------------------------------------

Sending 'Cookie... Sent Reeiving... Received 'o' 30949.73 [[1506790640, 1181630, 1181630, 1181630, 1181630], [1506790641, 1181630, 1181630, 1181630, 1181630], [1506790642, 1181630, 1181630, 1181630, 1181630], [1506790643, 1181630, 0, 1181630, 1181630]]

iQBotProject commented 6 years ago

hi @HubSpace2000 files not exist in https://ufile.io/0tjmd please if you can give an other working link

HubSpace2000 commented 6 years ago

go download the APK and rename it as zip , unzip it and read source code

iQBotProject commented 6 years ago

Awesome @HubSpace2000 i try to do this see the image iq apk

i see in folders but i don't know wher i can find the api i need to uncode classes.dex and classes2.dex ?? plz help me

redmiix24 commented 6 years ago

@yesamine I think there is no need to burn your head with those APKs and python, socket will be detected and blocked by them. I developed mine with C# https://www.youtube.com/watch?v=aqjqVWU3XSk

HubSpace2000 commented 6 years ago

dont listen to this guy there is no problem with the websocket , he just want to sell his shitty bot also Yesamine , you need to be more curious when you open folders/files you not far

iQBotProject commented 6 years ago

@HubSpace2000 i know hhh and i dont have money and iam a developper i work as a developper to get money (built thing to people to get paid) and im good in .net robots now its the time to built same code to be rich @HubSpace2000 if you want to work with each other that's will be fantastic and shorten the time too and effort

iQBotProject commented 6 years ago

i just want give you some advice @freeost thanks i see the video but i dont like your robots is not god in trading and slow and sow limit first i think to built a robot like that but the api is so powerful you will lose your money with this robot you need to think about a goooood strategie (combine indicators or get signial from other place or ....) somthing can realy work good and let you make wining and dont forget the money management because its a robot and you will go out and make robot work all day then if you wont to buy it you need to recorde a good video that you win all time and a biiiig amount in your account ( practice or real no problem ) dont forget the themplat robot style and hide all data box

thanks

HubSpace2000 commented 6 years ago

i dont have to work with people sorry , also u should check into asset folder and check all files it is what i mean , the api is there u just need to search......

iQBotProject commented 6 years ago

ok3 thanks please i need to contact you privat

thank you @HubSpace2000

RickyGlobal9 commented 6 years ago

@freeost What the shit you are doing man, here we are to solve the issues on someone programs not to sell or promote any product. If you can't share your code then plz SHUT YOUR MOUTH UP!

longErste commented 6 years ago

This doesn't seems to work anymore

MightyMaxSaviorOfTheUniverse commented 4 years ago

@yesamine @HubSpace2000

I see IQoptions changed something about their buy order which means the API I was using is now no longer working.

Since you two were discussing how to read the source code of the API, I was hoping you could let me know exactly how to pin point the changes to the Ws socket buy order.

We can work on it together, or if you have no interest in that please just give me enough information for me to figure it out for myself

Thank you in advance!

RickyGlobal9 commented 4 years ago

Hi i am getting lot's of messages regarding "iq api is not working" or changed, so decided to make you understand why i am not continuing this thread.

I realized, that iqoption haven't provided their trading api officially for people till the time. So if you are using their unofficial api then BEWARE because...

Iqoption flushes their inbound connection's rules time-to-time, that means your dedicated time on your project using their api becomes worthless, so my opinion is do something which is legal in all manner.

Best of luck

On Tue, Dec 10, 2019 at 1:04 PM MightyMaxSaviorOfTheUniverse < notifications@github.com> wrote:

@yesamine https://github.com/yesamine @HubSpace2000 https://github.com/HubSpace2000

I see IQoptions changed something about their buy order which means the API I was using is now no longer working.

Since you two were discussing how to read the source code of the API, I was hoping you could let me know exactly how to pin point the changes to the Ws socket buy order.

We can work on it together, or if you have no interest in that please just give me enough information for me to figure it out for myself

Thank you in advance!

โ€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/n1nj4z33/iqoptionapi/issues/23?email_source=notifications&email_token=ACORVB7XKQVCKKSZHQ3KXFDQX5A7NA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGOIFLA#issuecomment-563905196, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVB4K4TGX7ADB72KUZITQX5A7NANCNFSM4DK74Y4A .

MightyMaxSaviorOfTheUniverse commented 4 years ago

@SiliconDare

One does not simply give up on their hopes and dreams.

I started working on this program on March the 28th and it has been working since then till December the 2th this month. Surely it isn't a lot of work to fix this problem every 7 months?

Even if it requires a lot on your part, please please give me enough information so that I can put in the work to further my ambitions myself. Furthermore if I start making money off this program I don't see why I wouldn't employ your services if it means I'll make money in the process, given that this problem is likely to occur again.

Think of this as an investment in your future. It might not pay right now but it is a passive opportunity to earn money off my driven determination to make money myself.

I've been trying desperately to get this program working myself but it seems like I just don't understand enough to get it working on my own. I've managed to find out the problem, instead of sending a WS message IQoptions has changed to a XHR message. This message is as follows


POST /api/v1/events HTTP/1.1
Host: event.iqoption.com
Connection: keep-alive
Content-Length: 1191
X-Action: bulk
Origin: https://iqoption.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.0.12335 Safari/537.36
Content-Type: application/json
Accept: */*
DNT: 1
Referer: https://iqoption.com/traderoom
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6

Request payload
[{"category":"button_pressed","name":"chart_change-settings","value":8.0,"user_id":000000000,"group_id":195,"platform_id":9,"app_version":"1632.5.2413.release","device_id":"000000000000000000000000000000000","time":1576073009117,"technical_logs":false,"parameters":{"candle_size":"5","new_asset_id":"8","new_candle_size":"1"}},{"category":"button_pressed","name":"traderoom_deal-call","value":1.0,"user_id":47492459,"group_id":195,"platform_id":9,"app_version":"1632.5.2413.release","device_id":"0000000000000000000000000000000","time":1576073011337,"parameters":{"asset_id":"8","balance_type":"4","expiration_time":"1576073040","instrument_type":"turbo","leverage_value":"1","order_type":"market"}},

{"category":"system","name":"binary-options_open-time","user_id":47492459,"group_id":195,"platform_id":9,"app_version":"1632.5.2413.release","device_id":"000000000000000000","duration":541,"time":1576073011333,"parameters":{"country_id":180,"id":5933356658}},

{"category":"system","name":"app_resize","user_id":00000000,"group_id":195,"platform_id":9,"app_version":"1632.5.2413.release","device_id":"00000000000000000000000000000","parameters":{"width":581.0,"height":659.0}}]```
RickyGlobal9 commented 4 years ago

@MightyMaxSaviorOfTheUniverse The thread is still alive you can join this #https://github.com/MongkonEiadon/IqOption.Net

Buy back

`var client = new IqOptionApi("emailaddress", "password");

//begin connect if(await client.ConnectAsync()){

//get user profile var profile = await client.GetProfileAsync();

// open order EurUsd in smallest period (1min) var exp = DateTime.Now.AddMinutes(1); var buyResult = await api.BuyAsync(ActivePair.EURUSD, 1, OrderDirection.Call, exp);

// get candles data var candles = await api.GetCandlesAsync(ActivePair.EURUSD, TimeFrame.Min1, 100, DateTimeOffset.Now); _logger.LogInformation($"CandleCollections received {candles.Count}");

// subscribe to pair to get real-time data for tf1min and tf5min var streamMin1 = await api.SubscribeRealtimeDataAsync(ActivePair.EURUSD, TimeFrame.Min1); var streamMin5 = await api.SubscribeRealtimeDataAsync(ActivePair.EURUSD, TimeFrame.Min5);

streamMin5.Merge(streamMin1) .Subscribe(candleInfo => { _logger.LogInformation($"Now {ActivePair.EURUSD} {candleInfo.TimeFrame} : Bid={candleInfo.Bid}\t Ask={candleInfo.Ask}\t"); });

// after this line no-more realtime data for min5 print on console await api.UnSubscribeRealtimeData(ActivePair.EURUSD, TimeFrame.Min5);

}`

MightyMaxSaviorOfTheUniverse commented 4 years ago

@SiliconDare

I'm so close to the solution now. I decided to write the new buy order in XHR using its new url, and I've gotten all the way to the point that there is only a formatting issue.

Still have no idea how to set up the format correctly but from my understanding of the research I did, it just matter of converting the request data from a string into a list or some other format type

b'{"code":400,"errors":"Invalid value of X-Action header. Allowed values: \\"single\\", \\"bulk\\""}'

Any ideas?

redmiix24 commented 4 years ago

@SiliconDare can you share your code so we can provide the solution?

MightyMaxSaviorOfTheUniverse commented 4 years ago

@SiliconDare can you share your code so we can provide the solution?

Here is is. I shared it on another forum and forgot to share it here.


headers = [  {'Host': 'event.iqoption.com'},
             {'Connection': 'keep-alive'},
             {'Content-Length': '1191'},
             {'X-Action': 'bulk'},
             {'Origin': 'https://iqoption.com'},
             {'User-Agent': 'ozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML}, like Gecko) Chrome/57.0.0.12335 Safari/537.36'},
             {'Content-Type': 'application/json'},
             {'Accept': '*/*'},
             {'DNT': '1'},
             {'Referer': 'https://iqoption.com/traderoom'},
             {'Accept-Encoding': 'gzip}, deflate}, br'},
             {'Accept-Language': 'en-GB},en-US;q=0.8},en;q=0.6'},
             {}
            ]
body = {'category':'button_pressed',
             'name':'traderoom_deal-call',
             'value':'1',
             'user_id':'My User ID Not Sharing',
             'group_id':'195',
             'platform_id':'9',
             'app_version':'1632.5.2413.release',
             'device_id':'MyID Im Not SHARING THIS',
             'time':'11',
             'parameters':[{
                 'asset_id':'2',
                 'balance_type':'4',
                 'expiration_time':'111',
                 'instrument_type':'turbo',
                 'leverage_value':'1',
                 'order_type':'market'
                 }]}
e=0
    while(e!=len(headers):
    r = requests.post(url, data=body, headers=headers[e])
    print(r.content)
    e=e+1```
MightyMaxSaviorOfTheUniverse commented 4 years ago

Well I found out how to replicate the Http Iqotions trading rooms result, the problem is that it doesn't place a bet which probably means there is some other mechanism that is required for trading

I'm totally out of ideas so I'm leaving it up to you guys to brain storm a solution

Replication of the trade room results;


body="[{\"category\":\"button_pressed\",\"name\":\"traderoom_deal-call\",\"value\":341.0,\"user_id\":4******9,\"group_id\":195,\"platform_id\":9,\"app_version\":\"1632.5.2413.release\",\"device_id\":\"2********5\",\"time\":1575886437787,\"parameters\":{\"asset_id\":\"6\",\"balance_type\":\"4\",\"expiration_time\":\"1575886500\",\"instrument_type\":\"digital-option\",\"leverage_value\":\"1\",\"order_type\":\"market\",\"spot_strike\":\"1\"}}]"

headers = {  'Host': 'event.iqoption.com',
             'Connection': 'keep-alive',
             'Content-Length': '1191',
             'X-Action': 'bulk',
             'Origin': 'https://iqoption.com',
             'User-Agent': 'ozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML}, like Gecko) Chrome/57.0.0.12335 Safari/537.36',
             'Content-Type': 'application/json',
             'Accept': '*/*',
             'DNT': '1',
             'Referer': 'https://iqoption.com/traderoom',
             'Accept-Encoding': 'gzip}, deflate}, br',
             'Accept-Language': 'en-GB},en-US;q=0.8},en;q=0.6',
            }
url = 'https://event.iqoption.com/api/v1/events'
r = requests.post(url, data=body, headers=headers)
print(r.content)

>>> Result: b'[{"code":200,"errors":[]}]' (This means the bet was successfully bet only nothing happens as far as actually trade results show)

This probably means that the Java Script runs the execution of buying or some other medium, I'm unsure. I'm just going to use my prediction program to continue to make money until you guys find the solution.

If I had enough money I would just pay someone... fuck it I don't have enough bloody money!
redmiix24 commented 4 years ago

@MightyMaxSaviorOfTheUniverse
@SiliconDare

only expiration time is not taken into consideration although its showing in my output

input

import requests
import json
import urllib3
import time
from websocket import create_connection

def get_expiration_time(self, duration):
    exp = time.time()
    if duration >= 1 and duration <= 5:
        #option = 3 #"turbo"
        # Round to next full minute
        # datetime.datetime.now().second>30
        if (exp % 60) > 30:
            exp = exp - (exp % 60) + 60*(duration+1)
            print int(exp)
        else:
            exp = exp - (exp % 60)+60*(duration)
            print int(exp)

ws = create_connection("wss://iqoption.com/echo/{randomnumber}/{randomnumber}/websocket")
result = ws.recv()
data = json.loads(result)
get_expiration_time(data["msg"],1)

url = 'https://event.iqoption.com/api/v1/events'

headers = {  'Host': 'event.iqoption.com',
             'Connection': 'keep-alive',
             'Content-Length': '1191',
             'X-Action': 'single',
             'Origin': 'https://iqoption.com',
             'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36',
             'Content-Type': 'application/json',
             'Accept': '*/*',
             'DNT': '1',
             'Referer': 'https://iqoption.com/traderoom',
             'Accept-Encoding': 'gzip}, deflate}, br',
             'Accept-Language': 'en-GB},en-US;q=0.8},en;q=0.6',
}              

payload =   {
    "category": "button_pressed",
    "name": "traderoom_deal-call",
    "value": 50,
    "user_id": XXXXXX,
    "group_id": XXX,
    "platform_id": 9,
    "app_version": "1632.5.2413.release",
    "device_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "time": data["msg"],
    "parameters": {
      "asset_id": "77",
      "balance_type": "4",
      "expiration_time": get_expiration_time(data["msg"],1),
      "instrument_type": "turbo",
      "leverage_value": "1",
      "order_type": "market"
    }
  }

print payload

r = requests.post(url, data=json.dumps(payload), headers=headers)
print(r.content)

output

time : 1576312653177
expiration_time : 1576312740

{'category': 'button_pressed', 'platform_id': 9, 'app_version': '1632.5.2413.release', 'user_id': XXXXX, 'name': 'traderoom_deal-call', 'parameters': {'asset_id': '77', 'instrument_type': 'turbo', 'order_type': 'market', 'leverage_value': '1', 'balance_type': '4', 'expiration_time': None}, 'time': 1576312653177, 'group_id': XXX, 'value': 50, 'device_id': 'XXXXXXXXXXXXXXXXXXXXXXXXXX'}
{"code":200,"errors":[]}

as you can see 'expiration_time': None

anyone can try a fix ?

RickyGlobal9 commented 4 years ago

Whats is your data["msg"] here, is it the correct epoch value you are sending for "time" based on your expiration?

On Sat, Dec 14, 2019, 4:36 PM SamBee notifications@github.com wrote:

@MightyMaxSaviorOfTheUniverse https://github.com/MightyMaxSaviorOfTheUniverse @SiliconDare https://github.com/SiliconDare

only expiration time is not taken into consideration although its showing in my output

input

import requests import json import urllib3 import time from websocket import create_connection

def get_expiration_time(self, duration): exp = time.time() if duration >= 1 and duration <= 5:

option = 3 #"turbo"

    # Round to next full minute
    # datetime.datetime.now().second>30
    if (exp % 60) > 30:
        exp = exp - (exp % 60) + 60*(duration+1)
        print int(exp)
    else:
        exp = exp - (exp % 60)+60*(duration)
        print int(exp)

ws = create_connection("wss://iqoption.com/echo/{randomnumber}/{randomnumber}/websocket http://iqoption.com/echo/%7Brandomnumber%7D/%7Brandomnumber%7D/websocket") result = ws.recv() data = json.loads(result) get_expiration_time(data["msg"],1)

url = 'https://event.iqoption.com/api/v1/events'

headers = { 'Host': 'event.iqoption.com', 'Connection': 'keep-alive', 'Content-Length': '1191', 'X-Action': 'single', 'Origin': 'https://iqoption.com', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', 'Content-Type': 'application/json', 'Accept': '/', 'DNT': '1', 'Referer': 'https://iqoption.com/traderoom', 'Accept-Encoding': 'gzip}, deflate}, br', 'Accept-Language': 'en-GB},en-US;q=0.8},en;q=0.6', }

payload = { "category": "button_pressed", "name": "traderoom_deal-call", "value": 50, "user_id": XXXXXX, "group_id": XXX, "platform_id": 9, "app_version": "1632.5.2413.release", "device_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "time": data["msg"], "parameters": { "asset_id": "77", "balance_type": "4", "expiration_time": get_expiration_time(data["msg"],1), "instrument_type": "turbo", "leverage_value": "1", "order_type": "market" } }

print payload

r = requests.post(url, data=json.dumps(payload), headers=headers) print(r.content)

output

time : 1576312653177 expiration_time : 1576312740

{'category': 'button_pressed', 'platform_id': 9, 'app_version': '1632.5.2413.release', 'user_id': XXXXX, 'name': 'traderoom_deal-call', 'parameters': {'asset_id': '77', 'instrument_type': 'turbo', 'order_type': 'market', 'leverage_value': '1', 'balance_type': '4', 'expiration_time': None}, 'time': 1576312653177, 'group_id': XXX, 'value': 50, 'device_id': 'XXXXXXXXXXXXXXXXXXXXXXXXXX'} {"code":200,"errors":[]}

as you can see 'expiration_time': None

anyone can try a fix ?

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/n1nj4z33/iqoptionapi/issues/23?email_source=notifications&email_token=ACORVB4LRZ2FQRCE2REBDR3QYS43RA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4AEGA#issuecomment-565707288, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVB726OOYHT4XKSZQ7FLQYS43RANCNFSM4DK74Y4A .

redmiix24 commented 4 years ago

@SiliconDare I'm getting the time epoch based on the socket response and parsing it to get the time.

redmiix24 commented 4 years ago

@SiliconDare I have fixed the expiration time issue and run the code but nothing executed on the platform. So I'm back to the API project and troubleshooting. In a way or another it seems that I will probably develop my own socket code according to the trading platform requirements maybe better than trying to fix somebody's ๐Ÿ˜‚ code lol

RickyGlobal9 commented 4 years ago

That's good dude but expending time on such api which is unofficial doesn't make sense atleast to me.

On Sun, Dec 15, 2019, 12:35 AM SamBee notifications@github.com wrote:

@SiliconDare https://github.com/SiliconDare I have fixed the expiration time issue and run the code but nothing executed on the platform. So I'm back to the API project and troubleshooting. In a way or another it seems that I will probably develop my own socket code according to the trading platform requirements maybe better than trying to fix somebody's ๐Ÿ˜‚ code lol

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/n1nj4z33/iqoptionapi/issues/23?email_source=notifications&email_token=ACORVB4JPY4DB2ADTJ2S6ODQYUU6LA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4I7AY#issuecomment-565743491, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVB56C4EGPJH5I3IVY6DQYUU6LANCNFSM4DK74Y4A .

redmiix24 commented 4 years ago

@SiliconDare I remember when iqoption had their own robot and you could just copy paste someone strategy, we were making a hell lot of money then all of the sudden they decided to close it because of technical imbalance wink wink, so it's obvious what was happening

MightyMaxSaviorOfTheUniverse commented 4 years ago

@redmiix24

IQoptions changed the expiration time from 1m to 2m, did you try a 15m expiration time or something that isn't the shortest time? If I get time today I'll try to do the same.

The disappointing thing about this new method is the fact that you can no longer get the result of the bet. Meaning your program will not be able to determine a win or a loss

Any ideas for that approach? It would help a lot if I could tell if I'm winning or losing money

Thanks again for working on this... I thought I was the only one for a while

MightyMaxSaviorOfTheUniverse commented 4 years ago

That's good dude but expending time on such api which is unofficial doesn't make sense atleast to me. โ€ฆ On Sun, Dec 15, 2019, 12:35 AM SamBee @.***> wrote: @SiliconDare https://github.com/SiliconDare I have fixed the expiration time issue and run the code but nothing executed on the platform. So I'm back to the API project and troubleshooting. In a way or another it seems that I will probably develop my own socket code according to the trading platform requirements maybe better than trying to fix somebody's code lol โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#23?email_source=notifications&email_token=ACORVB4JPY4DB2ADTJ2S6ODQYUU6LA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4I7AY#issuecomment-565743491>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVB56C4EGPJH5I3IVY6DQYUU6LANCNFSM4DK74Y4A .

If they are changing it once every 7 months... I don't mind paying some IT guy to make me an api if I'm making millions inbetween

redmiix24 commented 4 years ago

@MightyMaxSaviorOfTheUniverse no I haven't tried 15 Min yet but I believe its not going to work. I will try to fix the websocket first otherwise I will make other solutions

This is the API error ERROR:root:**warning** buy late 30 sec

OldFlame2323 commented 4 years ago

@redmiix24

What code did you use to get a response from the server? No matter what request I send to the XHR server. I always get a response of error(200) unless I use the wrong format which sends a format error message.

Could you provide your code for communicating with the server, because you seem to have made some progress I hope to add on to... If you don't mind :)

Thank you. Cheers :D

redmiix24 commented 4 years ago

@OldFlame2323 it's written above, I think you are not mentioning your user_id and group_id you can get those parameters by going to the traderoom and execute call or put then inspect All XHR requests in Chrome browser and you will get your user_id and group_id ...etc Let me know what happened please

MightyMaxSaviorOfTheUniverse commented 4 years ago

@redmiix24

I tried using my user ID and group ID, as well as my device ID... but I keep getting the error(200)

Please give us a paste example of what you did differently, excluding your user ID because that probably would affect your account

RickyGlobal9 commented 4 years ago

Hah ha, 200 is not an error code. Response code 200 means api responded with no error, meaning you achieved it...

On Wed, Dec 18, 2019, 10:24 PM MightyMaxSaviorOfTheUniverse < notifications@github.com> wrote:

@redmiix24 https://github.com/redmiix24

I tried using my user ID and group ID, as well as my device ID... but I keep getting the error(200)

Please give us a paste example of what you did differently, excluding your user ID because that probably would affect your account

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/n1nj4z33/iqoptionapi/issues/23?email_source=notifications&email_token=ACORVB7PPCQ34FCSVZRFSOLQZJITZA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHGYVMQ#issuecomment-567118514, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVB4NAUJE5QEPONU5GQTQZJITZANCNFSM4DK74Y4A .

MightyMaxSaviorOfTheUniverse commented 4 years ago

@redmiix24

...but then why didn't it buy anything?

Does this mean there is some special command we just aren't seeing?

This is disappointing, it only took 15 days to get this far so I was really hoping this would be a solution

here is my response from the server:

b'[{"code":200,"errors":[]}]

pavilion20bw commented 4 years ago

Thanks everyone for trying so hard. @SiliconDare what's your email address?

MightyMaxSaviorOfTheUniverse commented 4 years ago

@pavilion20bw That sounds like quitter talk, don't stop trying just yet. The first time I made this api(my own one) it took me three months. This program only stopped working on the 2nd December, we have only been working on this for 18 days, we will succeed just keep on throwing in ideas and working on the project.

@redmiix24 @SiliconDare

I think the server response of 'b'[{"code":200,"errors":[]}]' means that the request was received without any errors, but even so it could be being blocked by some hidden criteria. Lets continue to play around with the information we send the server to see if that will resolve the problem. That is what I'm working on today and I would appreciate any assistance you do from your side of the world. It is amazing how much you guys have helped me already.

Lets keep on battling this beast!

MightyMaxSaviorOfTheUniverse commented 4 years ago

I think I may have found the problem.

The server is expecting the request to come in RAW text format (Plain text) but the header is demanding json/app. Is there any way to force the content of the header to accept any format

As you can see here, directly extracted from how the web traderoom handles buy orders, that the request is filled with symbols that python automatically ignores or removes from strings. If however you put the little r before the string (r"raw format accepts symbols /'/""/") then the server rejects your text

{\"category\":\"button_pressed\",\"name\":\"traderoom_deal-call\",\"value\":1.0,\"user_id\":______,\"group_id\":195,\"platform_id\":9,\"app_version\":\"1632.5.2413.release\",\"device_id\":\"_____\",\"time\":1575886039315,\"parameters\":{\"asset_id\":\"6\",\"balance_type\":\"4\",\"expiration_time\":\"1575886080\",\"instrument_type\":\"digital-option\",\"leverage_value\":\"1\",\"order_type\":\"market\",\"spot_strike\":\"1\"}}

Any ideas?

MightyMaxSaviorOfTheUniverse commented 4 years ago

Ok I figured out something else.

Remember how we discovered that the request is expected in plain text format? Now I see that the header is expected in list format and we are sending it as an item.

How might we preserver the header as


            {
              "name": "X-Action",
              "value": "bulk"
            },
            {
              "name": "Origin",
              "value": "https://iqoption.com"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Host",
              "value": "event.iqoption.com"
            },
            {
              "name": "Accept-Language",
              "value": "en-GB,en-US;q=0.8,en;q=0.6"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.0.12335 Safari/537.36"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Referer",
              "value": "https://iqoption.com/traderoom"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Content-Length",
              "value": "1567"
            },
            {
              "name": "DNT",
              "value": "1"
            }
          ]```

And still have python accept it without throwing an exception? I've been battling with this for days without any luck, any clues?
dwighthalpert commented 4 years ago

One thing I've been noticing about these xhr request is that they don't have a authentication mechanism, surely "user_id" and "device_id" is something but I don't think they play a part in authentication. My bet is that these xhr request and websocket connection both make up for a success call, when inspect the messages of the ws in chrome dev tool, you can see it does send this frame to the server

{"name": "sendMessage", "request_id": "215", "msg": {"name": "binary-options.open-option", "version": "1.0", "body": {"user_balance_id": 262936171, "active_id": 76, "option_type_id": 3, "direction": "call", "expired": 1576941840, "refund_value": 0, "price": 80.23, "value": 1105420, "profit_percent": 83}}}

@redmiix24 @MightyMaxSaviorOfTheUniverse

EDIT: dont worry about my "user_balance_id" it's just a dummy account

redmiix24 commented 4 years ago

@dwighthalpert @MightyMaxSaviorOfTheUniverse @HubSpace2000

Honestly after troubleshooting alot and after trying both ws and xhr I found out 2 things.

The iqoption stable library developed by @Lu-Yi-Hsun has error in the file expiration.py which is giving the error "late call by 30 seconds". I tried to subtract some time from the function by 30 seconds and troubleshooted again but the call didn't work. So seemingly those Russians who are working in iqoption they made a mix between xhr and ws to validate the "call" or the "pressed button".

Note : I also played with xhr and gave it correct parameters but didn't execute anything. We need to think about this project differently

Will put more update soon

Thank you all

RickyGlobal9 commented 4 years ago

I am not responding but am following this thread. I don't know why but seems the thread is not moving in correct direction, possibly you are in an endless track.

You really do not need to mesh with device_id/xhr headers, the clue is inside iq's buying architecture it's same as any financial institution works a) Send proposal requests b) If accepted then buy contract

Hope this will give you rough idea

I am not a python developer but if needed i can share my experience in either c# or nodejs whatever you all guys prefer.

On Sat, Dec 21, 2019, 9:03 PM SamBee notifications@github.com wrote:

@dwighthalpert https://github.com/dwighthalpert @MightyMaxSaviorOfTheUniverse https://github.com/MightyMaxSaviorOfTheUniverse @HubSpace2000 https://github.com/HubSpace2000

Honestly after troubleshooting alot and after trying both ws and xhr I found out 2 things.

The iqoption stable library developed by

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/n1nj4z33/iqoptionapi/issues/23?email_source=notifications&email_token=ACORVB5KTMUOF67GK34HTGLQZYZONA5CNFSM4DK74Y4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHO6FRA#issuecomment-568189636, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACORVBYEMZMI5XKZ5ESMBY3QZYZONANCNFSM4DK74Y4A .

redmiix24 commented 4 years ago

@SiliconDare I do c# only at work. Is your library executing calls ? Can you tell us?

RickyGlobal9 commented 4 years ago

@SiliconDare I do c# only at work. Is your library executing calls ? Can you tell us?

๐Ÿ™Œ wait wait! Just work around what i said above atleast this year, definitely this thread will close soon. If not then finally i'll share my nodejs or c# code...