Code Monkey home page Code Monkey logo

iqoption-api's Introduction

IQOption Api

A Simple websocket API for IQ Option.

IMPORTANT

Please use the code from async branch master branch will be updated onceall the basic functionality is completly rewritten in async branch.

Next Addition

  • Ability to place Put, Sell Digital Options

Basic Usage

Initialisation

    from iqoption_api import IQOption
    api = IQOption("[email protected]","password")
    api.login() # Returns True if successful else False
    api.start_socket_connection()

Check Account Type

    print(api.active_account) # prints `real` or `practice`

Check Active Account Balance

    print(api.balance) # prints active account balance

Check Balances

    print(api.real_balance) # prints real account balance
    print(api.practice_balance) # prints practice account balance

Change Account

    api.change_account("real") # `real` or `practice` Returns Account Type (`real` or `practice`)

Check Positions Modified/Opened After API Started

    print(api.positions)  

Get Server Tick

    print(api.tick) ## range 0, 59

Get Instruments

    print(api.instruments_to_id) ## All Instruments Websocket Returned
    print(api.forex_instruments)
    print(api.cfd_instruments)
    print(api.crypto_instruments)

Subscribe to Realtime Market Data

    api.subscribe_market("EURUSD")

Access Market Data

    api.market_data

Update Expiration list

    api.update_expiration_list("EURUSD")

Get Expiration List

    print(api.binary_expiration_list["EURUSD"])
    
    ### Sample Response
        [{u'expiration_length': 60, u'type': u'PT1M', u'dead_time_length': 10, u'time': 1512475620},             {u'expiration_length': 300, u'type': u'PT5M', u'dead_time_length': 10, u'time': 1512475800}]

Place a Binary Position

    api.open_position(direction="put",
                    expiration_time=api.binary_expiration_list["EURUSD"][-1]["time"],
                    market_name="EURUSD",
                    price=5,
                    type="turbo"
                    )

Update Candle Data

    # api.update_candle_data(market_name,interval,start_time,end_time)
    api.update_candle_data("EURUSD",1,0,int(time.time())) ## get latest 1000 candles with 1 second interval

Access CandleData

    # api.candle_data[market_name][interval] # list of lists  [time,open,close,high,low]
    print(api.candle_data["EURUSD][1]) # prints candles 

iqoption-api's People

Contributors

harwee avatar

Watchers

 avatar

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.