Git Product home page Git Product logo

ejtraderiq's Introduction

Pypi Publish GitHub release (latest by date) License

IQoption API

ToDo

  • Account Balance
  • trade buy and sell "Digital & Turbo"
  • Check Win
  • check open Markets
  • remaning time
  • real time quote
  • ohlc dataframe history
  • payout
  • get server time
  • get powerbar - market depth

MHI Martingale Bot Example

You can find the bot under the examples directory in our repository here.

Installation

Tested on python 3.7 to 3.9

pip install ejtraderIQ -U

Or install from source

git clone https://github.com/ejtraderLabs/ejtraderIQ
cd ejtraderIQ
python setup.py install

Import librarys

from ejtraderIQ import IQOption

Login to IQ Options

# account type DEMO OR REAL
api = IQOption('email','passowrd','DEMO') 

symbol = "EURUSD"
timeframe= "M1"

Real time quote

Subscribe quote stream
api.subscribe(symbol,timeframe)
symbols quote
quote = api.quote()
print(quote)

# Output

                         open      high       low     close  volume
date                                                               
2022-08-22 22:39:00  0.994245  0.994415  0.994215  0.994365     120
Unsubscribe quote stream
api.unsubscribe(symbol,timeframe)

# Output
"Unsubscribed from EURUSD"

Symbols History Dataframe

candles = 1000 # max history 1000 periods

history = api.history(symbol,timeframe,candles)
print(quote)

# Output
                         open      high       low     close  volume
date                                                               
2022-08-17 12:20:00  1.016235  1.016565  1.015925  1.016005    1225
2022-08-17 12:25:00  1.016015  1.016265  1.015585  1.016195     947
2022-08-17 12:30:00  1.016015  1.016905  1.014535  1.014635    3280
2022-08-17 12:35:00  1.014635  1.015415  1.014605  1.015315    1646
2022-08-17 12:40:00  1.015305  1.016015  1.015305  1.015985    1685
...                       ...       ...       ...       ...     ...
2022-08-22 23:15:00  0.993955  0.994035  0.993435  0.993475     779
2022-08-22 23:20:00  0.993475  0.993635  0.993365  0.993405     547
2022-08-22 23:25:00  0.993405  0.993585  0.993335  0.993455     577
2022-08-22 23:30:00  0.993475  0.993495  0.993305  0.993435     519
2022-08-22 23:35:00  0.993415  0.993655  0.993375  0.993635     527

[1000 rows x 5 columns]
Trade Position
volume = 1 # position size $1


# Buy Digital
api.buy(volume,symbol,timeframe)

# Buy turbo
api.buy(volume,symbol,timeframe,turbo=True)

# Sell Digital
api.sell(volume,symbol,timeframe)

# Sell turbo
api.sell(volume,symbol,timeframe,turbo=True)

Trade & Account Fuctions

check Payout
payout = api.payout(symbol) 
print(("Payout: {:.2f}%".format(payout)))
Check balance
 balance = api.balance()
 print(f'Balance : {balance}')
Remaning tim to trade
 expire = api.remaning(timeframe)
 print(f'Remaning : {expire}')
Market depth
# start streaming
 api.powerbar_start(symbol)

# get live data SELL side %
 api.powerbar_get(symbol)

# get all history from the time start streaming
 api.powerbar_get_all()

# stop streaming
api.powerbar_stop(symbol)
Server time
 
st = api.server_time()

st.year
st.day
st.hour
st.minute
st.second
 
Check Win
api.checkwin(id)

# example check win Digital 
id = api.buy(volume,symbol,timeframe)
win = api.checkwin(id)

if win > 0:
    print(("WIN"+'\n'))
elif win < 0:                                            
    print(("LOSS"+'\n'))
else:
    print(('Tied '+'\n'))
    
    
# example check win Turbo
id = api.buy(volume,symbol,timeframe,turbo=True)
win = api.checkwin(id,turbo=True)

if win > 0:
    print(("WIN"+'\n'))
elif win < 0:                                            
    print(("LOSS"+'\n'))
else:
    print(('Tied '+'\n'))    
Check markets state
markets = api.isOpen()
print(markets)

# Output

          Asset    Type Status
0    USDZAR-OTC  binary  close
1        EURUSD  binary  close
2    GBPJPY-OTC  binary  close
3        BTCUSD  binary  close
4        USDCHF  binary  close
..          ...     ...    ...
371    BNBUSD-L  crypto   open
372    VETUSD-L  crypto   open
373      ETCUSD  crypto   open
374   DOGEUSD-L  crypto   open
375    ETCUSD-L  crypto   open

[376 rows x 3 columns]

ejtraderiq's People

Contributors

traderpedroso avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ejtraderiq's Issues

active_suspended: rejected by risks

Hello, what does this error mean?
Happens on api.sell & api.buy()

Login gets through OK, also balance and other functions are working, but sell/buy throws this error.
I am trying to place an order on DEMO account. Tried on a few accounts, same thing happens.

Error put 
False {'message': 'active_suspended: rejected by risks'}

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.