Package: python-idex
This is an unofficial Python wrapper for theIDEX exchanges REST API v3. I am in no way affiliated with IDEX, use at your own risk.PyPihttps://pypi.python.org/pypi/python-idexSource codehttps://github.com/sammchardy/python-idexDocumentationhttps://python-idex.readthedocs.io/en/latest/FeaturesImplementation of all REST endpointsLiquidity endpointsDeposit from main wallet to exchange walletSandbox and faucet supportAsync client supportResponse exception handlingNotesUsing an API key increasesrate limits.Quick StartRegister an account withIDEX v3.pipinstallpython-idexSynchronous Examples# UnauthenticatedfromideximportClientclient=Client()# server timetime=client.get_server_time()# get exchange_infoexchange_info=client.get_exchange()# get assetsassets=client.get_assets()# get marketsmarkets=client.get_markets()# get market depthdepth=client.get_order_book(market='ETH-USDC')# get liquidity poolspools=client.get_liquidity_pools()# Authenticatedapi_key='<api_key>'address='<address_string>'private_key='<wallet_private_key_string>'wallet_address='0x<wallet_address>'client=Client(api_key,address,private_key)# associate wallet to accountclient.associate_wallet(wallet_address=wallet_address)# deposit fundsclient.deposit_funds(asset='MATIC',quantity=1.234)# get your balancesbalances=client.get_balances()# get your open ordersorders=client.get_open_orders()# create a market orderorder=client.create_market_order(market='ETH-USDC',order_side=OrderSide.BUY,quantity=1000)# create a limit orderorder=client.create_limit_order(market='ETH-USDC',order_side=OrderSide.BUY,quantity=1000,price=2100,)Async ExamplefromideximportAsyncClientasyncdefmain():# Initialise the clientclient=awaitAsyncClient.create()# get currenciescurrencies=awaitclient.get_currencies()# get market depthdepth=awaitclient.get_order_book('ETH_SENT')# get your balancesbalances=awaitclient.get_my_balances()# get your open ordersorders=awaitclient.get_my_open_orders('ETH_SENT')# create a limit orderorder=awaitclient.create_order('SENT','ETH','0.001','10000')# Authenticatedapi_key='<api_key>'address='<address_string>'private_key='<wallet_private_key_string>'wallet_address='0x<wallet_address>'client=awaitAsyncClient.create(api_key,address,private_key)# associate wallet to accountawaitclient.associate_wallet(wallet_address=wallet_address)# deposit fundsawaitclient.deposit_funds(asset='MATIC',quantity=1.234)# get your balancesbalances=awaitclient.get_balances()# get your open ordersorders=awaitclient.get_open_orders()# create a market orderorder=awaitclient.create_market_order(market='ETH-USDC',order_side=OrderSide.BUY,quantity=1000)# create a limit orderorder=awaitclient.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())WalletThe examples above use the wallet private key when creating the Client to specify
which wallet to interact with.Most functions will have awallet_addressparameter to target a different wallet.If a new wallet is needed for subsequent callsinit_walletcan be used to change the
internal wallet… code:pythonprivate_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()Contract functionFunctions such asdeposit_funds,contract_exit_walletandcontract_withdraw_exitinteract
with the Polygon blockchain.Gas fee and price are attempted to be generated, but may fail. These values can be
overridden by passing aTransactionOptionsobject to the calls.… code:pythonclient = Client(api_key, address, private_key)tx_options = TransactionOptions(gas=150000, gas_price=20000000000)client.deposit_funds(asset=”USD”, quantity=1123, tx_options=tx_options)Sandbox/TestnetIDEX v3 supports the Mumbai testnet as a sandbox to test functionality.Enable it by passingsandbox=Truewhen creating the client… code:pythonclient = Client(sandbox=True)# or asyncclient = await AsyncClient.create(sandbox=True)Read more about the Sandbox mode in theIDEX Sandbox docs.Search redditfor a functioning faucet to receive MATIC.For other tokens on the sandbox DIL, PIP, IDEX, USD they can be added using a contract function… code:pythonclient = Client(sandbox=True)tx_id = client.contract_testnet_faucet(asset=’DIL’)
client.wait_for_transaction_receipt(tx_id)tx_id = client.contract_testnet_faucet(asset=’PIP’)
client.wait_for_transaction_receipt(tx_id)tx_id = client.contract_testnet_faucet(asset=’IDEX’)
client.wait_for_transaction_receipt(tx_id)tx_id = client.contract_testnet_faucet(asset=’USD’)
client.wait_for_transaction_receipt(tx_id)Test OrdersAll order functions allow for test orders to be sent, just settest=Truewhen calling a test functionStake your IDEXEarn staking rewards on your idle IDEX tokens from IDEX trade fees while also contributing to the decentralization of
IDEX and robustness of the platform.Delegate them toeverday-chickennode in theIDEX v3 delegate portalwith one click.DonateIf this library helped you out feel free to donate.ETH: 0xD7a7fDdCfA687073d7cC93E9E51829a727f9fE70IDEX: 0xD7a7fDdCfA687073d7cC93E9E51829a727f9fE70 (Polygon)NEO: AVJB4ZgN7VgSUtArCt94y7ZYT6d5NDfpBoLTC: LPC5vw9ajR1YndE1hYVeo3kJ9LdHjcRCUZBTC: 1Dknp6L6oRZrHDECRedihPzx2sSfmvEBysOther ExchangesIf you useBinancecheck out mypython-binancelibrary.If you useBinance Chaincheck out mypython-binance-chainlibrary.If you useKucoincheck out mypython-kucoinlibrary.