Coder Social home page Coder Social logo

angelplanet / python-idex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sammchardy/python-idex

0.0 0.0 0.0 180 KB

IDEX v3 Exchange REST API python implementation

Home Page: https://python-idex.readthedocs.io/en/latest/

License: MIT License

Python 100.00%

python-idex's Introduction

Welcome to python-idex v3.0.0

image

image

image

image

image

image

This is an unofficial Python wrapper for the IDEX exchanges REST API v3. I am in no way affiliated with IDEX, use at your own risk.

PyPi

https://pypi.python.org/pypi/python-idex

Source code

https://github.com/sammchardy/python-idex

Documentation

https://python-idex.readthedocs.io/en/latest/

Features

  • Implementation of all REST endpoints except for deposit.
  • Response exception handling
  • Liquidity endpoints

Notes

Using an API key increases rate limits.

Quick Start

Register an account with IDEX v3.

pip install python-idex

Synchronous Examples

# Unauthenticated

from idex import Client
client = Client()

# server time
time = client.get_server_time()

# get exchange_info
exchange_info = client.get_exchange()

# get assets
assets = client.get_assets()

# get markets
markets = client.get_markets()

# get market depth
depth = client.get_order_book(market='ETH-USDC')

# get liquidity pools
pools = client.get_liquidity_pools()

# Authenticated

api_key = '<api_key>'
address = '<address_string>'
private_key = '<wallet_private_key_string>'
client = Client(api_key, address, private_key)

# get your balances
balances = client.get_balances()

# get your open orders
orders = client.get_open_orders()

# create a market order
order = client.create_market_order(
    market='ETH-USDC',
    order_side=OrderSide.BUY,
    quantity=1000
)

# create a limit order
order = client.create_limit_order(
    market='ETH-USDC',
    order_side=OrderSide.BUY,
    quantity=1000,
    price=2100,
)

Async Example

from idex import AsyncClient


async def main():

    # Initialise the client
    client = await AsyncClient.create()

    # get currencies
    currencies = await client.get_currencies()

    # get market depth
    depth = await client.get_order_book('ETH_SENT')

    # get your balances
    balances = await client.get_my_balances()

    # get your open orders
    orders = await client.get_my_open_orders('ETH_SENT')

    # create a limit order
    order = await client.create_order('SENT', 'ETH', '0.001', '10000')

    # Authenticated

    api_key = '<api_key>'
    address = '<address_string>'
    private_key = '<wallet_private_key_string>'
    client = await AsyncClient.create(api_key, address, private_key)

    # get your balances
    balances = await client.get_balances()

    # get your open orders
    orders = await client.get_open_orders()

    # create a market order
    order = await client.create_market_order(
        market='ETH-USDC',
        order_side=OrderSide.BUY,
        quantity=1000
    )

    # create a limit order
    order = await client.create_limit_order(
        market='ETH-USDC',
        order_side=OrderSide.BUY,
        quantity=1000,
        price=2100,
    )

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Wallet

The examples above use the wallet private key when creating the Client to specify which wallet to interact with.

Most functions will have a wallet_address parameter to target a different wallet.

If a new wallet is needed for subsequent calls init_wallet can be used to change the internal wallet

... code:python

private_key = '<old_private_key>' client = Client(api_key, address, private_key) client.init_wallet(private_key='<new_wallet_private_key>')

# this will fetch balance of the new wallet client.get_balance()

Sandbox

IDEX v3 supports a sandbox to test functionality.

Enable it by passing sandbox=True when creating the client

... code:python

client = Client(sandbox=True)

# or async

client = await AsyncClient.create(sandbox=True)

Test Orders

All order functions allow for test orders to be sent, just set test=True when calling a test function

Donate

If this library helped you out feel free to donate.

  • ETH: 0xD7a7fDdCfA687073d7cC93E9E51829a727f9fE70
  • IDEX: 0xD7a7fDdCfA687073d7cC93E9E51829a727f9fE70 (Polygon)
  • NEO: AVJB4ZgN7VgSUtArCt94y7ZYT6d5NDfpBo
  • LTC: LPC5vw9ajR1YndE1hYVeo3kJ9LdHjcRCUZ
  • BTC: 1Dknp6L6oRZrHDECRedihPzx2sSfmvEBys

Other Exchanges

If you use Binance check out my python-binance library.

If you use Binance Chain check out my python-binance-chain library.

If you use Kucoin check out my python-kucoin library.

image

python-idex's People

Contributors

ccludts avatar sammchardy 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.