GithubHelp home page GithubHelp logo

iqoptionapi's Introduction

iqoptionapi's People

Contributors

freenetwork avatar gobbluth avatar jacekv avatar jafferwilson avatar kgteixeira avatar lu-yi-hsun avatar n1nj4z33 avatar niltonmelox avatar perryawesome avatar renatokeys avatar tejado avatar warwertt123 avatar zidokobik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iqoptionapi's Issues

Cannot connect due to 2-way authentication

Hello @Lu-Yi-Hsun,
I have faced the following issue. My account has 2 way verification due to security reasons. I got the following error log:

ERROR:root:**error** connect() fail
DEBUG:iqoptionapi.api:https://auth.iqoption.com/api/v1.0/login
DEBUG:iqoptionapi.api:<Response [429]>
DEBUG:iqoptionapi.api:{"data":{"ttl":3428},"errors":[{"code":301,"title":"Login limit exceeded"}]}
DEBUG:iqoptionapi.api:{'Connection': 'keep-alive', 'Content-Type': 'application/json; charset=utf-8', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Content-Type, YourOwnHeader', 'Date': 'Tue, 06 Nov 2018 09:53:30 GMT', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE', 'Content-Length': '76', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true'}
DEBUG:iqoptionapi.api:<RequestsCookieJar[]>
ERROR:root:**error** connect() fail
DEBUG:iqoptionapi.api:https://auth.iqoption.com/api/v1.0/login

Please let me know what I can do for that?

cant get canldes

Here my code to get candles_data:
api.get_candles(1, 60, 1, api.api.timesync.server_timestamp)

But it failed
Log: fail get_candles need reconnect

Can it be used to get interactive binary trade?

Hello @Lu-Yi-Hsun ,
I was going through the API, found it fascinating. I have seen that you have build the API on top of other repository. I have check it too. You repository is more simple to understand then his.
Well, I have a question regarding your api. You see this software or bot: https://github.com/n1nj4z33/iq-bot is created by the same person and it give live and interactive automated trading experience and also connect with MT.
I wanted to know whether your API can give the same trading experience, or is just a connection? Please let me know if you have any such bot build on top of your API.

Or
Is it possible that I can see my applied bet on the screen or something please? That will help me a lot.

Information on candle data

@Lu-Yi-Hsun

I did not understand the meaning of some candle data fields:

{'id': 160345,
'from': 1522886640,
'at': 1522886700047986247,
'to': 1522886700,
'open': 1.228845,
'close': 1.228875,
'min': 1.228835,
'max': 1.228875,
'volume': 0},

Is the "at" row a timestamp expressed in nanoseconds? What exactly is it for?
What about the "from" and "to" rows?

Thank you very much!

Login retry

Hello,

My IP is banned to half hour because I make a typo in my login data. The script immediately try again and again the login with my wrong, misstyped data, therefore exist this issue.

How can I disable the automatic login loop, if logging in is failed? (to prevent the next ban)

image

image

image

start_candles_stream

how to parse this dict in usable candles?
i dont understand how to dict is work? how can i get
______________ from________ min_______max_____close____ open
candle[1] [1524731626, 1.21747, 1.21748, 1.21747, 1.21748]
candle[2] [1524731626, 1.21747, 1.21748, 1.21747, 1.21748]
candle[3] [1524731626, 1.21747, 1.21748, 1.21747, 1.21748]

and now i can work like candle[1][1] > candle[1][4]
or candle[1][1] + candle[1][4] = sum/2
or something like that.

if i tray
a = (I_want_money.thread_collect_realtime)
----------a is dict
b=a.values()
----------then b is list
c=b[0]
--------- c is dict

get_candles(self,count,ACTIVES) need add time.

at now you get candles 1s ???
if i need a minute 60s i need change funkcion?
is this is right?
maybe need rewrite this funkcion and add timeframe for candles .
like 1 =1s 60s = 1m etc...

Check Win

Hello,

is it possible to edit api:
I_want_money.check_win() like I_want_money.check_win("EURUSD")?

because i need to check win in a multiple bet

Thanks in advance!

failed to get login

I just tried login and its not working as it should can anyone please help me in this regard what is wrong i am doing

here is code 馃憤

from iqoptionapi.stable_api import IQ_Option
import time
print("login...")
import logging
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
I_want_money=IQ_Option("email here","Password here")

and here is error that i am getting. thanks in advance

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

===== RESTART: C:\Users\e9les\Desktop\iqapi\iqoptionapi-master\login.py =====
login...
2018-11-07 16:55:15,088 https://auth.iqoption.com/api/v1.0/login
2018-11-07 16:55:15,088 Starting new HTTPS connection (1): auth.iqoption.com:443
2018-11-07 16:55:16,019 https://auth.iqoption.com:443 "POST /api/v1.0/login HTTP/1.1" 200 52
2018-11-07 16:55:16,066 <Response [200]>
2018-11-07 16:55:16,066 {"data":{"ssid":"1789e23f67b2655e97fe93d87d9dc3ee"}}
2018-11-07 16:55:16,066 {'Server': 'nginx', 'Date': 'Wed, 07 Nov 2018 11:55:14 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '52', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Content-Type, YourOwnHeader', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Origin': '', 'Set-Cookie': 'ssid=1789e23f67b2655e97fe93d87d9dc3ee; Path=/; Domain=iqoption.com; Max-Age=2592000; Secure', 'Strict-Transport-Security': 'max-age=15555600', 'X-Content-Type-Options': 'nosniff'}
2018-11-07 16:55:16,066 <RequestsCookieJar[<Cookie ssid=1789e23f67b2655e97fe93d87d9dc3ee for .iqoption.com/>]>
2018-11-07 16:55:16,082 error connect() fail
2018-11-07 16:55:17,084 https://auth.iqoption.com/api/v1.0/login
2018-11-07 16:55:17,084 Starting new HTTPS connection (1): auth.iqoption.com:443
2018-11-07 16:55:17,846 https://auth.iqoption.com:443 "POST /api/v1.0/login HTTP/1.1" 200 52
2018-11-07 16:55:17,846 <Response [200]>
2018-11-07 16:55:17,846 {"data":{"ssid":"157e8b9fe6ad27b076325f8a56926e16"}}
2018-11-07 16:55:17,846 {'Server': 'nginx', 'Date': 'Wed, 07 Nov 2018 11:55:16 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '52', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Content-Type, YourOwnHeader', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Origin': '
', 'Set-Cookie': 'ssid=157e8b9fe6ad27b076325f8a56926e16; Path=/; Domain=iqoption.com; Max-Age=2592000; Secure', 'Strict-Transport-Security': 'max-age=15555600', 'X-Content-Type-Options': 'nosniff'}
2018-11-07 16:55:17,862 <RequestsCookieJar[<Cookie ssid=157e8b9fe6ad27b076325f8a56926e16 for .iqoption.com/>]>
2018-11-07 16:55:17,862 error connect() fail
2018-11-07 16:55:18,870 https://auth.iqoption.com/api/v1.0/login
2018-11-07 16:55:18,870 Starting new HTTPS connection (1): auth.iqoption.com:443

How to make a sale?

Hello, I would like to ask if there is a possibility that you can implement the sales service, to indicate that the low is the price and thus have the 2 options buying and selling. Can it be done now as is the API?

image

API on Windows

Hello guys,

someone can help me to use this api on windows?

Thanks

Trading on forex market

Hey,

as far as I can see, the API doesn't include the possibility to trade on the forex market but only options.
Is there a special reason why the API calls for trading forex are not implemented (yet)? Otherwise I would like to support the implementation!

Cheers!

get candles as array.

great idea. i like candles as array but this not work.

candles = I_want_money.get_candles_as_array("EURUSD",60,3) 

File "C:\Python27\lib\site-packages\iqoptionapi-0.5-py2.7.egg\iqoptionapi\stable_api.py", line 101, in get_candles_as_array
    candles=self.get_candles(count,ACTIVES,interval)
TypeError: get_candles() takes exactly 5 arguments (4 given)

Fail to get results

Hello Lu-Yi-Hsun, my tests often fail to get results.
Error log: 'Check_win time late 120sec'

ERROR:root:**error** get_candles need reconnect

Hey Hi @Lu-Yi-Hsun , Most of the time while fetching 1min candle it raising

ERROR:root:**error** get_candles need reconnect .

Because of re-connection i'm missing some 1min candles .Is there anything that i need to add in my code to increase the connection buffer. Here is my code .

from iqoptionapi.stable_api import IQ_Option
import datetime
import time
import subprocess
import pymysql
import json
import string
import sys
import logging
I_want_money=IQ_Option("user","password")
goal=sys.argv[1]
pt=I_want_money.get_candles(goal,60,2,time.time())
x=json.dumps(pt[0])
y=json.dumps(pt[1])

create a sample bot

hey man would be nice if you created a simple sample bot that trades on patterns

Not able to get the tick values

Hello Lu,
Thank you for sharing the reference of your repository. Can you tell me how I can get the tick values of the iqoption in realtime and connect the api with MT5 for analysis?

get remaining time

Hi,
how to get the remaining time in seconds of an asset?
https://iqoptionapi.readthedocs.io/en/latest/iqoptionapi.ws.objects.html#module-iqoptionapi.ws.objects.timesync
https://github.com/Lu-Yi-Hsun/iqoptionapi/blob/master/iqoptionapi/ws/objects/timesync.py

TimeSync have that options defined already, but how to access it from the main api (iqoptionapi.stable_api.IQ_Option)

edit: I'm not sure that that expiration_datetime reffers to the asset remaining purchase time, but worth to include it.

get_position_history not working

Hello @Lu-Yi-Hsun ,
I have tried to capture the trade history using the api. But I received this:

>>> I_want_money.get_positions_history("forex")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'IQ_Option' object has no attribute 'get_positions_history'

I am using Python 3.5, Windows 10 Home Edition. and the latest version of your api.

>>> IQ_Option.__version__
'2.1.3'

Please let me know what is the problem.
Also I would like to know how I can access the bet position/price of the binary? Where exactly my bet is placed?

How to set expiration time?

Hello, what files control the expiration time of a buy order?
How can I choose the expiration to buy? (1min.. 3min.. 5min.. 15min...)

[UPDATE 1]
You can set the expiration time on timesync.py but it works just to 5min or less, we still need a way to buy bigger expirations (> 5min).

[UPDATE 2]
is possible to buy bigger expiration times changing the stable_api.py to "binary" instead of "turbo".

Error when try buy no OTC active

Hi, someone having the following problem? Working when active is OTC.

Im try: api.buy(100, "EURUSD", "call", 1, False) so I get the follow message
No se puede crear la opci贸n (de bienes)

LOG:

...
2018-06-08 23:26:02:DEBUG: {"msg": {"direction": "call", "price": 50, "act": 1, "exp": 1528511220, "time": 1528511160, "type": "turbo"}, "name": "buyV2"}
2018-06-08 23:26:02:DEBUG: {"name":"timeSync","msg":1528511162577}
2018-06-08 23:26:03:DEBUG: {"name":"buyComplete","request_id":"","msg":{"isSuccessful":false,"message":["No se puede crear la opci贸n (de bienes)"],"result":{}}}

Reconnect doesnt work

@Lu-Yi-Hsun hello my friend...
reconnect doesnt work for me...
do you know is it possible to check if connection work?
Because i want to add this control... if connection doesnt work i want to reboot my script...
do you know if i can do that?

Thanks

error

\websocket_app.py", line 333, in _callback
callback(*args)

readme.

I think you must change readme and need update it with your new options.

How can i get multi option candles?

Hello ALL,
I want to get candles of EURUSD and USDTRY. But I only recived candles data of EURUSD. this is my code:

from iqoptionapi.stable_api import IQ_Option
import os
import time
I_want_money=IQ_Option("email","pass")

goal="EURUSD"
print("get candles")
print(I_want_money.get_candles(goal,60,111,time.time()))

goal="USDTRY"
print("get candles")
print(I_want_money.get_candles(goal,60,111,time.time()))

Thank you for your help!!!

Getting only 1000 candles.

I have tried the following way to collect the dataset, but got only 1000 candles and no more.

>>> data = pd.DataFrame(I_want_money.get_candles(goal,60,70000, time.time()))
>>> data["at"] = pd.to_datetime(data["at"], format ='%Y.%m.%d %H:%M')
>>> data.to_csv("candles.csv",index=False)

Please help me.

Sample buy

@Lu-Yi-Hsun
i have a error when

coding=utf-8

from iqoptionapi.stable_api import IQ_Option
import logging
import time
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
I_want_money=IQ_Option("email","pass")
goal="EURUSD"
print("get candles")
print(I_want_money.get_candles(goal,60,111,time.time()))
Money=1
ACTIVES="EURUSD"
ACTION="call"
expirations_mode=1
force_buy= "True"
I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode,force_buy)

Why ?
TypeError: buy() takes exactly 4 arguments (6 given)

get_poisition_history

anyone can help me i to get the position history in binary option or maybe all the instrument_type thanks and advance

installation a bot on ubuntu

hello @Lu-Yi-Hsun , i have a problem with installation,
after installation ubuntu i run this comand
sudo apt-get update sudo apt-get install build-essential libxml2-dev ncurses-dev sudo apt-get install python-software-properties sudo apt-get install apache2 sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt sudo apt-get install php5-curl sudo apt-get install phpmyadmin sudo apt-get install python-pip python-dev libmysqlclient-dev sudo apt-get install python-websocket sudo apt-get install python-httplib2 sudo apt-get install git sudo apt-get install pylint pip install websocket-client pip install iqoptionapi pip install requests pip install mysqlclient
but when run a code i receive this error

2018-09-12 16:37:17,231 _ssl.c:335: No root certificates specified for verification of other-side certificates.
2018-09-12 16:37:17,231 Websocket connection closed.

why ?

403 Forbidden nginx

Since yesterday I have been getting this error:

DEBUG:iqoptionapi.api:{'Server': 'nginx', 'Content-Length': '162', 'Date': 'Thu, 03 May 2018 04:51:55 GMT', 'Content-Type': 'text/html', 'Connection': 'keep-alive'}
DEBUG:iqoptionapi.api:<RequestsCookieJar[]>
ERROR:root:fail connect()
DEBUG:iqoptionapi.api:https://iqoption.com/api/login
DEBUG:iqoptionapi.api:<Response [403]>
DEBUG:iqoptionapi.api:

<title>403 Forbidden</title>

403 Forbidden


nginx

I can not connect to the iqoption api
Could you help me with this?

Multiple buy (call/put) not possible?

Hi

My code runs through a loop, making decisions and call the call/put if needed. It works for the first few times, but then reports the socket is closed. The call/put goes through, it just seems the socket connection is lost. Can this be forced to stay open for multiple buy transactions?

Part of my code(in a loop) is calling the transaction like this:

      trade_Amount = 1.2
      trade_ACTIVES = 'EURUSD'
      trade_ACTION= 'call'
      expirations_mode = 1
      force_buy = "True"
      trade_accepted, trade_id = IQ.buy(trade_Amount,
                                       trade_ACTIVES,
                                       trade_ACTION,
                                       expirations_mode,
                                       force_buy)

ERROR:root:error buy error...
DEBUG:iqoptionapi.ws.client:Websocket connection closed.
DEBUG:iqoptionapi.api:https://auth.iqoption.com/api/v1.0/login
DEBUG:iqoptionapi.api:<Response [200]>
DEBUG:iqoptionapi.api:{"data":{"ssid":"39550a949ca93cbbd672f58a0eaaaddc"}}
DEBUG:iqoptionapi.api:{'Server': 'nginx', 'Date': 'Mon, 11 Jun 2018 17:27:33 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '52', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Content-Type, YourOwnHeader', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Set-Cookie': 'ssid=39550a949ca93cbbd672f58a0eaaaddc; Path=/; Domain=iqoption.com; Max-Age=2592000', 'Strict-Transport-Security': 'max-age=15555600', 'X-Content-Type-Options': 'nosniff'}
DEBUG:iqoptionapi.api:<RequestsCookieJar[<Cookie ssid=39550a949ca93cbbd672f58a0eaaaddc for .iqoption.com/>]>
DEBUG:iqoptionapi.api:https://iqoption.com/api/getprofile
DEBUG:iqoptionapi.api:<Response [200]>

ERROR:root:error buy error...
DEBUG:iqoptionapi.ws.client:Websocket connection closed.
DEBUG:iqoptionapi.api:https://auth.iqoption.com/api/v1.0/login
DEBUG:iqoptionapi.api:<Response [200]>
DEBUG:iqoptionapi.api:{"data":{"ssid":"39550a949ca93cbbd672f58a0eaaaddc"}}
DEBUG:iqoptionapi.api:{'Server': 'nginx', 'Date': 'Mon, 11 Jun 2018 17:27:33 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '52', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Content-Type, YourOwnHeader', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Origin': '*', 'Set-Cookie': 'ssid=39550a949ca93cbbd672f58a0eaaaddc; Path=/; Domain=iqoption.com; Max-Age=2592000', 'Strict-Transport-Security': 'max-age=15555600', 'X-Content-Type-Options': 'nosniff'}
DEBUG:iqoptionapi.api:<RequestsCookieJar[<Cookie ssid=39550a949ca93cbbd672f58a0eaaaddc for .iqoption.com/>]>
DEBUG:iqoptionapi.api:https://iqoption.com/api/getprofile
DEBUG:iqoptionapi.api:<Response [200]>

Options Profits

Hello @Lu-Yi-Hsun
I was looking for a way to get the options potential profit.
such as
image
and
image

I was thinking that it maybe
I_want_money.get_all_profit()
is that correct?

Because I am getting inconsistency with the values of that function.
For Example:
I am getting this returned
{'EURJPY': 0.79, 'GBPUSD': 0.76, 'GOOGLE': 0.65, 'AUDJPY': 0.75, u'GBPNZD': 0.76, 'USDCAD': 0.78, 'APPLE': 0.65, u'EURCHF': 0.72, 'EURUSD': 0.76, 'GBPJPY': 0.8, 'USDSGD': 0.69, 'EURNZD': 0.76, 'NZDUSD-OTC': 0.89, 'USDCHF': 0.7, 'USDCHF-OTC': 0.89, 'EURUSD-OTC': 0.9, 'EURCAD': 0.79, 'GBPAUD': 0.81, 'AUDUSD': 0.76, 'AMAZON': 0.67, 'AUDCAD': 0.81, 'GBPCAD': 0.78, 'AUDCAD-OTC': 0.89, 'EURGBP': 0.77, 'CADCHF': 0.83, 'ALIBABA': 0.65, 'USDJPY': 0.75, 'EURGBP-OTC': 0.89, 'EURAUD': 0.75}
but when I look at iqoptions
I get
image

image

This is obvioulsy not inconsistent in all of them, but it is questionable
Why is it doing this?

Log freezing console.

Hello, I'm trying to log the connection but the IDLE freezes, i've added the log to list so I can see how big the log message is:
image

As you can see, some log messages has more than 100k characters, when saving the messages into a txt there is a: {"name":"api_option_init_all_result","msg":{"isSuccessful":true...
After this message, console receives a lot of active messages, that i believe that makes it freeze.

Does anyone know how can I stop the api from initiating the actives?

How to get strikes and payout data of Digital Options?

Hello All,

I need to develop application for iqoption.com for digital options and i need to know if there is some sample source code using the iqoption API for getting strikes and payout values and some other features like trading etc.

It will be a great help, waiting for your replies.....

Thanks & Regards,
Ayush Srivastava

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.