Package: newdex
Newdex Python APIPython 3 client for Newdex V1 REST API.OverviewNewdex api_key needs to be binded with EOS account.Apply for Newdex Market API_KEYREST Market and Trade APIget_pairs()Get the list of all exchange pairs.NameData typeDescriptionidintExchange pair idsymbolstringExchange pair name, such as: eosblackteam-black-eoscontractstringContract name, such as: eosblackteamcurrencystringCurrency name, such as: BLACKprice_precisionintThe price precision on Newdexcurrency_precisionintThe currency precisionget_ticker()Get the market of a particular exchange pair.NameData typeDescriptionsymbolstringExchange pair namelastdoubleLatest pricechangedoublePrice change (price change from 08:00 (GMT) to present time)highdoubleHighest price in 24 hourslowdoubleLowest price in 24 hoursamountdouble24-hour trading volumevolumedouble24-hour trading amount (converted to accounted currency, such as EOS, USDTget_tickersGet the market of all exchange pairs.NameData typeDescriptionsymbolstringExchange pair namelastdoubleLatest pricechangedoublePrice change (price change from 08:00 (GMT) to present time)highdoubleHighest price in 24 hourslowdoubleLowest price in 24 hoursamountdouble24-hour trading volumevolumedouble24-hour trading amount (converted to accounted currency, such as EOS, USDTget_price()Get the price of an exchange pair.NameData typeDescriptionsymbolstringExchange pair namepricedoubleLatest priceGET get_depth()Get order book (quoted depth)NameData typeDescriptionasksarrayAsk orders depthbidsarrayBid orders depthData example:/* GET /v1/depth?symbol=eosblackteam-black-eos */
{
  "code":200,
  "data":{
      "bids":[
       [0.035,1299.1857],
       [0.03493,11400],
       [0.0344,1612.4186],
       [0.0335,24299.6626],
       [0.0315,95103.6126],
       [0.03046,6744.3959],
       [0.03002,316.439],
       [0.03,3333.3333],
       [0.02961,31.9587],
       [0.02926,17.7101]
     ],
     "asks":[
       [0.068,549.1971],
       [0.067,18106.8275],
       [0.06666,3000],
       [0.066,15373.3999],
       [0.06539,20.6],
       [0.065,9347.6336],
       [0.064,6767.0784],
       [0.06398,676.949],
       [0.063,6265.8133],
       [0.062,92.3191]
     ]
   }
 }get_trades()Get deals record of exchange pairNameData typeDescriptionidarrayTrade IDpricedoubleDealt priceamountdoubleDealt volumevolumedoubleDealt amount (converted to accounted currency, such as EOS, USDT)timeint10-digit timestampget_candles()Get K-Line data of exchange pairRequest:NameData typeDescriptionsymbolstringExchange pair nametime_framestring(optional) time interval, defaulted 1 hour, options: 1 min, 5 mins, 30 mins, 1 hour, 4 hours, 6 hours, 1 day, 1 week, 1 month, 1 year.sizeint(optional) quantity, defaulted 100, 2000 maximumResponse Object[]NameData typeDescription0intK-Line ID1doubleOpening price2doubleClosing price3doubleHighest price in 24 hours4doubleLowest price in 24 hours5doubleTrading volume6doubleTrading amount (converted to accounted currency, such as EOS, USDT)Data example:/* GET /v1/candles?symbol=eosblackteam-black-eos&time_frame=1hour&size=10 */
{
  "code":200,
  "data":[
    [1544140800,0.04075,0.046,0.046,0.04075,100882.9715,4518.451],
    [1544144400,0.046,0.043,0.046,0.04271,8857.6799,381.6711],
    [1544148000,0.043,0.04441,0.046,0.043,63614.3411,2811.6175],
    [1544151600,0.04441,0.04444,0.046,0.04354,5183.5131,234.7778],
    [1544155200,0.04444,0.04257,0.04444,0.04255,12290.0635,528.4927],
    [1544158800,0.04257,0.04599,0.04599,0.04257,1160.6585,53.2085],
    [1544162400,0.04599,0.04531,0.0469,0.04416,129433.0583,5809.5475],
    [1544166000,0.04531,0.0445,0.0469,0.0445,14117.186,631.1711],
    [1544169600,0.0445,0.0456,0.04684,0.0445,469.2888,21.2106],
    [1544173200,0.0456,0.04777,0.04777,0.0456,4895.7245,231.3036]
  ]
}open_orders()filled_orders()canceled_orders()order_history()Response Object[]NameData typeDescriptionidintOrder IDpair_idintExchange pair idtrx_idstringTrx ID on chainsidestringTrade direction: sell, buytypestringTrade type: sell-limit, sell-market, buy-limit, buy-marketpricedoubleOrder priceamountdoubleOrder amountdeal_pricedoubleDealt price (average)deal_amountdoubleDealt amountdeal_volumedoubleDealt volumestatedoubleStatus: new, partially-filled, filled, canceled, partial-canceledcreated_atintCreate time, 10-digit timestampupdated_atintUpdate time, 10-digit timestampcancel_order()Cancel order based on trx_id.Request:NameData typeDescriptiontrx_idstringTrx ID on chainResponse: String, If succeeded, response "Order successfully canceled"Note: this interface only supports old orders (account: newdexpocket), and the orders which created by contract (account: newdexpublic) can only be cancelled by contract action.)Error CodesCode = 200, it means request succeeded, other situations mean error. See error code reference form below:Error CodeExplanation-1001The request is beyond limit, if you don’t have API_KEY, pleaseapply for API_KEYas soon as possible.-1002Invalid API_KEY-1003Invalid signature , pleas refer tosignature verification-1004Request timestamp has expired-1005No permission, request trade and order API need to verify API_KEY-1101Invalid account-1102Invalid email-1103Invalid symbol-1104Invalid trx_id-1105Order has been canceled-1106Order is dealt, cannot be cancel-1500Unknown errorTODOMore candle options