Order Endpoints

These functions use the wallet address passed in the constructor.

class idex.client.Client(api_key, address=None, private_key=None)[source]
get_order_trades(order_hash)[source]

Get all trades involving a given order hash, specified by the order_hash

https://github.com/AuroraDAO/idex-api-docs#returnordertrades

Parameters:order_hash (256-bit hex string) – The order hash to query for associated trades
trades = client.get_order_trades('0x62748b55e1106f3f453d51f9b95282593ef5ce03c22f3235536cf63a1476d5e4')
Returns:API Response
[
    {
        date: '2017-10-11 21:41:15',
        amount: '0.3',
        type: 'buy',
        total: '1',
        price: '0.3',
        uuid: 'e8719a10-aecc-11e7-9535-3b8451fd4699',
        transactionHash: '0x28b945b586a5929c69337929533e04794d488c2d6e1122b7b915705d0dff8bb6'
    }
]
Raises:IdexResponseException, IdexAPIException

These functions take an address, typically you would only use them to fetch from your own address.

class idex.client.Client(api_key, address=None, private_key=None)[source]
get_open_orders(market, address, count=10, cursor=None)[source]

Get the open orders for a given market and address

Output is similar to the output for get_order_book() except that orders are not sorted by type or price, but are rather displayed in the order of insertion. As is the case with get_order_book( there is a params property of the response value that contains details on the order which can help with verifying its authenticity.

https://github.com/AuroraDAO/idex-api-docs#returnopenorders

Parameters:
  • market (string) – Name of market e.g. ETH_SAN
  • address (address string) – Address to return open orders associated with
  • count (int) – amount of results to return
  • cursor (str) – For pagination. Provide the value returned in the idex-next-cursor HTTP header to request the next slice (or page)
orders = client.get_open_orders(
    'ETH_SAN',
    '0xca82b7b95604f70b3ff5c6ede797a28b11b47d63')
Returns:API Response
[
    {
        orderNumber: 1412,
        orderHash: '0xf1bbc500af8d411b0096ac62bc9b60e97024ad8b9ea170340ff0ecfa03536417',
        price: '2.3',
        amount: '1.2',
        total: '2.76',
        type: 'sell',
        params: {
            tokenBuy: '0x0000000000000000000000000000000000000000',
            buySymbol: 'ETH',
            buyPrecision: 18,
            amountBuy: '2760000000000000000',
            tokenSell: '0xf59fad2879fb8380ffa6049a48abf9c9959b3b5c',
            sellSymbol: 'DVIP',
            sellPrecision: 8,
            amountSell: '120000000',
            expires: 190000,
            nonce: 166,
            user: '0xca82b7b95604f70b3ff5c6ede797a28b11b47d63'
        }
    },
    {
        orderNumber: 1413,
        orderHash: '0x62748b55e1106f3f453d51f9b95282593ef5ce03c22f3235536cf63a1476d5e4',
        price: '2.98',
        amount: '1.2',
        total: '3.576',
        type: 'sell',
        params:{
            tokenBuy: '0x0000000000000000000000000000000000000000',
            buySymbol: 'ETH',
            buyPrecision: 18,
            amountBuy: '3576000000000000000',
            tokenSell: '0xf59fad2879fb8380ffa6049a48abf9c9959b3b5c',
            sellSymbol: 'DVIP',
            sellPrecision: 8,
            amountSell: '120000000',
            expires: 190000,
            nonce: 168,
            user: '0xca82b7b95604f70b3ff5c6ede797a28b11b47d63'
        }
    }
]
Raises:IdexResponseException, IdexAPIException
get_trade_history(market=None, address=None, start=None, end=None, count=10, sort='desc', cursor=None)[source]

Get the past 200 trades for a given market and address, or up to 10000 trades between a range specified in UNIX timetsamps by the “start” and “end” properties of your JSON input.

https://github.com/AuroraDAO/idex-api-docs#returntradehistory

Parameters:
  • market (string) – optional - will return an array of trade objects for the market, if omitted, will return an object of arrays of trade objects keyed by each market
  • address (address string) – optional - If specified, return value will only include trades that involve the address as the maker or taker.
  • start (int) – optional - The inclusive UNIX timestamp (seconds since epoch) marking the earliest trade that will be returned in the response, (Default - 0)
  • end (int) – optional - The inclusive UNIX timestamp marking the latest trade that will be returned in the response. (Default - current timestamp)
  • count (int) – optional - Number of records to be returned per request. Valid range: 1 .. 100
  • sort (string) – optional - Possible values are asc (oldest first) and desc (newest first). Defaults to desc.
  • cursor (string) – optional - For pagination. Provide the value returned in the idex-next-cursor HTTP header to request the next slice (or page). This endpoint uses the tid property of a record for the cursor.
trades = client.get_trade_history()

# get trades for the last 2 hours for ETH EOS market
start = int(time.time()) - (60 * 2) # 2 hours ago
trades = client.get_trade_history(market='ETH_EOS', start=start)
Returns:API Response
{
    ETH_REP: [
        {
            date: '2017-10-11 21:41:15',
            amount: '0.3',
            type: 'buy',
            total: '1',
            price: '0.3',
            orderHash: '0x600c405c44d30086771ac0bd9b455de08813127ff0c56017202c95df190169ae',
            uuid: 'e8719a10-aecc-11e7-9535-3b8451fd4699',
            transactionHash: '0x28b945b586a5929c69337929533e04794d488c2d6e1122b7b915705d0dff8bb6'
        }
    ]
}
Raises:IdexResponseException, IdexAPIException