• API Demo
    1.Procedure of MD5 Sign Request
    Long current = System.currentTimeMillis();
    Map<String,String> params =  new HashMap<String, String>() ;
    params.put("apiKey", apiKey) ;    // API_KEY
    params.put("a", a);               //Parameters...
    params.put("b", b);
    ......
    params.put("tonce", current.toString());
    a.Reorganize parameters in lexicographical order
    Collection<String> keyset= params.keySet();  
    List<String> list=new ArrayList<String>(keyset); 
    Collections.sort(list);
    b.Generate string of parameter k-v
    String signString = "" ;     
    for( String key : list ){
    	String split = "".equals(signString)?"":"&" ;
    	signString += split+ key+"="+params.get(key) ;
    }
    signString = signString+"&secretKey="+apiSecret;   // API_SECRET
    c.Generate test string sign, by MD5 encryption based on UTF-8 code.
    String sign = "";
    try {
    	MessageDigest md = MessageDigest.getInstance("MD5");
    	byte[] bytes = md.digest(signString.getBytes("utf-8"));
    	final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
    	StringBuilder ret = new StringBuilder(bytes.length * 2);
    	for (int i=0; i<bytes.length; i++) {
    		ret.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]);
    		ret.append(HEX_DIGITS[bytes[i] & 0x0f]);
    	}
    	sign =  ret.toString();
    }
    d.Wrap parameter and initiate POST request
    Map<String,String> reqParams =  new HashMap<String, String>() ;
    reqParams.put("apiKey", apiKey) ;    // API_KEY
    reqParams.put("a", a) ;              // Parameter…
    reqParams.put("b", b) ; 
    ...... 
    reqParams.put("tonce", current.toString());
    reqParams.put("sign",sign) ;         //MD5 sign
    String result = send(url,reqParams, "UTF-8");
    2. Procedure of ETH Pr Sign Request
    a. Reorganize parameters in lexicographical order
    Long current = System.currentTimeMillis();
    Map<String,String> params =  new HashMap<String, String>() ;
    params.put("apiKey", apiKey) ;    // API_KEY
    params.put("a", a);               // Parameters…
    params.put("b", b);
    ......
    params.put("tonce", current.toString());
    Collection<String> keyset= params.keySet();  
    List<String> list=new ArrayList<String>(keyset); 
    Collections.sort(list);
    b.Parameter string generated
    String signString = "" ;     
    for( String key : list ){
    	String split = "".equals(signString)?"":"&" ;
    	signString += split+ key+"="+params.get(key) ;
    }
    c.Set encrypted string, which is generated based on ETH pr encryption, to parameters
    String presign = ethSign(password, keystore, signString) ;    //The method will be listed later 
    param.put("presign", presign);
    d.Contrasting to a and b, reorganize parameter and generate string again.
    Collection<String> keyset1= params.keySet();  
    List<String> list1=new ArrayList<String>(keyset1); 
    Collections.sort(list1); 
    String signString1 = "" ;     
    for( String key : list1 ){
    	String split = "".equals(signString1)?"":"&" ;
    	signString1 += split+ key+"="+params.get(key) ;
    }
    signString1 = signString1+"&secretKey="+apiSecret;   // API_SECRET
    e. MD5 based on UTF-8 code
    String sign = "";
    try {
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] bytes = md.digest(signString1.getBytes("utf-8"));
      final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
    	StringBuilder ret = new StringBuilder(bytes.length * 2);
    	for (int i=0; i<bytes.length; i++) {
    		ret.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]);
    		ret.append(HEX_DIGITS[bytes[i] & 0x0f]);
    	}
    	sign =  ret.toString();
    }
    f. Wrap parameter and initiate POST request
    Map<String,String> reqParams =  new HashMap<String, String>() ;
    reqParams.put("apiKey", apiKey) ;    // API_KEY
    reqParams.put("a", a) ;              // Parameter…
    reqParams.put("b", b) ; 
    ...... 
    reqParams.put("tonce", current.toString());
    reqParams.put("presign",presign);     //ETH pr sign
    reqParams.put("sign",sign) ;          //MD5 sign
    String result = send(url,reqParams, "UTF-8");
    
    // ETH Pr verification in which web3j package is required.
    public  static String  ethSign(String passPhrase,String keystore,String signString){
    	try {
    		ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
    		JsonParser parser = objectMapper.getFactory().createParser(keystore);
    		WalletFile walletFile = objectMapper.readValue(parser, WalletFile.class);
    		Credentials cred = Credentials.create(Wallet.decrypt(passPhrase, walletFile));
    		ECKeyPair ecKeyPair = cred.getEcKeyPair() ;
    		SignatureData sd = Sign.signMessage( signString.getBytes() , ecKeyPair ) ;
    		byte[] bytes = new byte[1+32+32];
    		bytes[0] = sd.getV();
    		System.arraycopy( sd.getR() , 0, bytes, 1, 32);
    		System.arraycopy(sd.getS(), 0, bytes, 33, 32);
    		String sign = Hex.toHexString(bytes);
    		return sign ;
    	} catch (IOException e) {
    		e.printStackTrace();
    	} catch (CipherException e) {
    		e.printStackTrace();
    	}
    	return null ;
    }
    
    // Initiate HTTP POST Request
    public static String send(String url, Map<String, String> map, String encoding){
    		String body = "";
    		CloseableHttpResponse response = null;
    		try {
    			CloseableHttpClient client = HttpClients.createDefault();
    			HttpPost httpPost = new HttpPost(url);
    			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    			if (map != null) {
    				for (Entry<String, String> entry : map.entrySet()) {
    					nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
    				}
    			}
    			httpPost.setEntity(new UrlEncodedFormEntity(nvps, encoding));
    			httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
    			httpPost.setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
    
    			response = client.execute(httpPost);
    			HttpEntity entity = response.getEntity();
    			if (entity != null) {
    				body = EntityUtils.toString(entity, encoding);
    			}
    			EntityUtils.consume(entity);
    		} catch (IOException e) {
    
    		} finally {
    			if (response != null) {
    				try {
    					response.close();
    				} catch (IOException e) {
    					e.printStackTrace();
    				}
    			}
    		}
    		return body;
    }  
    Stop
  • Signature example
    Example keystore{"version":3,"id":"1e185a08-59b0-4556-8d71-a5cbfe76ffe9","address":"0769e7028983a48ac407d378b4c8a2549e1a9208","crypto":{"ciphertext":"53433a0483fda22a7488b302892a57dc32ed7f1e23927fb69f7dba43c493dbcc","cipherparams":{"iv":"a0045536d758b295c36f71631d74b82c"},"cipher":"aes-128-ctr","kdf":"scrypt","kdfparams":{"dklen":32,"salt":"a792c36368c0b7862a329d6d45163ef957d5d206247fa9c1b1029ce416bf36fa","n":262144,"r":8,"p":1},"mac":"1678ff371eb84303cddab2e7bedcbc7cf94e2b881279562774c0027720f06c92"}}
    Example
    keystore
    password
    123456
    ETH
    signature
    string
    apiKey=hello&num=1&price=1&side=buy&symbol=DEW.ETH&tonce=1532060010152
    ETH
    signature
    result
    1ceaac0d609f22e73305c57a17797b17a84bc35fcf9daa7ebb0ac2bfa651b5e519748f1500490f178a548ac8e13405b99e2bd23c71f3a4586ce578bdc5252290dc
    MD5
    signature
    string
    apiKey=hello&num=1&price=1&presign=1ceaac0d609f22e73305c57a17797b17a84bc35fcf9daa7ebb0ac2bfa651b5e519748f1500490f178a548ac8e13405b99e2bd23c71f3a4586ce578bdc5252290dc&side=buy&symbol=DEW.ETH&tonce=1532060010152&secretKey=hello
    MD5
    signature
    result
    9f8a1bd0052a7bfcd43d5f3d9161b4b5
    Stop
  • Signature Mechanism
    API adopts double signature (ETH pr sign, MD5 sign) mixed-mechanism. Apikeys related to trading and ordering use double signature, while others about enquiries use single MD5 signature.
    1.ETH Pr sign
    ProcedureExample
    Reorganize parameter in lexicographical order.Reorganized character string:
    apiKey=xxxxxxxxx&num=1&price=1&side=buy&symbol=DEW.ETH&tonce=1532060010152
    Sign the above character string using ETH private key.Get V,R,S
    Process VRS. Java Demo
    //generates a 65-byte array
    byte[] bytes = new byte[1+32+32];
    //V assign the 1st byte
    bytes[0] = sd.getV();
    //R assign the 2nd ~33rd bytes
    System.arraycopy( sd.getR() , 0, bytes, 1, 32);
    //S assign the 34th~65th bytes
    System.arraycopy(sd.getS(), 0, bytes, 33, 32);
    //converted to hexadecimal string
    String sign = Hex.toHexString(bytes);
    Add the signing result to the parameter.The parameter name is presign
    2.MD5 Sign
    ProcedureExample
    Reorganize parameter in lexicographical order.For double signature,the parameter should comprise ETH pr signing result, i.e. add presgin=xxxxxx to the parameter
    Add MD5 signature private key to the end of the reorganized string.Signature string = Signature string +”&”+secretKey=xxxxxx
    MD5 sign MD5(signature string)
    Add the signing result to the parameter. The parameter name is sign
    Fold
  • Get Server Time
    1.General
    Description Get server timestamp
    Collection http://api.dew.one/api/v1/tonce
    Request Type GET
    Signature Method Null
    2.Reference
    Null.
    3.Response
    Time of the long type (the distance of time between 1970-1-01 00:00:00.000 and the present, in long type)
    Fold
  • Get the details of an account
    1.General
    Description Get the details of account assets
    Collection http://api.dew.one/api/v1/accounts
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    Sign Y string MD5 Pr sign
    3.Response
    Field Data Type Description
    Success Bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result [{“currency”:”DEW”,”avaliable”:10000, ”freeze”:0,”total”:10000},…]
    currency: Token name
    available: Amount available
    freeze: blocked Amount
    total: Total amount
    Fold
  • Spot trading pairs available
    1.General
    Despription Get the spot trading pairs available
    Collection http://api.dew.one/api/v1/spot/symbols
    Request Type GET
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    sign Y string MD5 Pr signature
    3.Response
    Field Type Description
    Success Bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result [{“symbol”:”DEW.ETH”,”name”:”DEW/ETH”, ”numScale”:3,”priceScale”:6},…]
    numScale: decimal place of order volume
    priceScale: decimal place of order price
    Fold
  • Symbol of futures available
    1.General
    Description Get the list of futures available
    Collection http://api.dew.one/api/v1/fut/symbols
    Request Type GET
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    Sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    Success Bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result [{“symbol”:”BTC-YX”, ”name”:”BTC perpetual”, ”unit”:”sheet”, ”type”:”PERM”, ”deposit”:5, ”evenupDeposit”:1, ”currency”:”DEW”, “ratio”:20, “numScale”:0, “priceScale”:1, “lastTradeTime”:””, “deliveryTime”:””},…]
    symbol: Symbol of futures target
    type:PERM(perpetual futures)/DAILY(futures settle daily)
    deposit: Margin per unit
    evenupDeposit: Minimum margin per unit
    currency: Margin Type
    ratio: Leverage, only for perpetual futures.
    numScale: Decimal place of purchasing volume. The volume must adhere to the decimal rule.
    priceScale: Decimal place of price. Ordering price should comply with the decimal rule.
    lastTradeTime: The last trading time, only for futures settled daily.
    deliveryTime: Settlement time, only for futures settled daily.
    Fold
  • Real-time quotation
    1.General
    Description Get the real-time quotation of spot and futures
    Collection http://api.dew.one/api/v1/ticker
    Request Type GET
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Symbol of futures and spot
    Tonce Y Long Timestamp
    apiKey Y String Apikey using MD5 sign
    Sign Y String MD5 pr sign
    3.Response
    Field Type Description
    Success Bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result {“symbol”:”BTC-YX”, ”date”:20180728, ”time”:010025, ”price”:6400, “lastPrice”:6220, “highestPrice”:6500, “lowestPrice”:6100, “volume”:123123, “amount”:1231300, “change”:200, “percent”:”0.005”, “timestamp”:1532776712, “feeRatio”:”0.005”, “nextSettleTime”:”2018-08-14 14:00:00”, “nextFeeRatio”:“0.006” }
    symbol:Symbol of futures or spot
    date:Date of the latest quotation
    time:Time of the latest quotation
    price:The latest quote
    timestamp:Server responses to timestamp
    feeRatio: Current fund rate, only for futures perpetual contracts
    nextSettleTime:Next point of exchanging fund fee, only for futures perpetual contracts
    nextFeeRatio:Next expected fund rate, only for futures perpetual contracts
    Fold
  • Bid/ Ask
    1.General
    Description Get the bid/ask for spot and futures.
    Collection http://api.dew.one/api/v1/depth
    Request Type GET
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Symbol of futures and spot
    Size Y Int Depth of market depth, e.g. size=5 stands for getting 5 bid/ask gears
    Tonce Y Long Timestamp
    apiKey Y string ApiKey using MD5 sign
    sign Y string MD5 pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    Result Responds result {"nextFeeRatio":"0.000193", "asks":["7225:1214","7227.7:21"], "bids":["7217.1:10","7217:4"], "nextSettleTime":"2018-09-03 14:00:00", "feeRatio":"0.000054"}}
    bids: Array of bid gear
    asks: Array of ask gear
    feeRatio: Current fund rate, only for futures perpetual contracts
    nextSettleTime:Next point of exchanging fund fee, only for futures perpetual contract
    nextFeeRatio:Next expected fund rate, only for futures perpetual contracts
    Fold
  • Place an order (spot)
    1.General
    Description Place a single order on spot
    Collection http://api.dew.one/api/v1/spot/trade
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y string Code for spot trading pair, e.g. DEW.ETH
    Num Y decimal Order volume
    Price Y decimal Order price
    Side Y string Direction (buy|sell)
    Tonce Y Long Timestamp
    apiKey Y string ApiKey using MD5 sign
    Presign Y string ETH pr signature
    Sign Y string MD5 pr signature
    3.Response
    Field Type Description
    Success Bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result {“order_id”:1}
    Request order-id (order is processed asynchronously. You can check through apikey if the order is placed successfully.)
    Fold
  • Place a batch of orders (spot)
    1.General
    Descrption Place a batch of orders on spot
    Collection http://api.dew.one/api/v1/spot/trade_batch
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    Orders Y String [ {“symbol”:””,num:1,price:1,side:’buy’,index:1}, {“symbol”:””,num:1,price:1,side:’buy’,index:2} ]
    Index: each value is exclusive in a batch of orders(the value cannot be repeated).
    Tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    Presign Y String ETH pr sign
    SignY String MD5 pr sign
    3.Response
    Field Type Description
    Success bool Is the request successful or not
    Message string Return reason(s) for request failure
    Result Response result [{“index”:1,”order_id”:123},{”index”:2,”order_id”:124},{”index”:2,”msg”:“Error”}]
    index: correspond with the order
    msg: return error info about processing failure
    Fold
  • Cancel an order (spot)
    1.General
    Description Request to cancel an order
    Collection http://api.dew.one/api/v1/spot/cancel
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Field Required Type Description
    ordered Y String Divide order-ids by comma(s)
    Tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    Presign Y String ETH Pr sign
    Sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result {“order_id”:123}
    Cancelling order is processed asynchronously. Response does not mean cancelled.
    Fold
  • Cancel a batch of orders (spot)
    1.General
    Description Request to cancel a batch of orders on specified spot
    Collection http://api.dew.one/api/v1/spot/cancel_all
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Code for spot trading pair, e.g. DEW.ETH
    Tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    Presign Y String ETH Pr sign
    Sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success bool Is the request successful or not
    Message String Return reason(s) for request failure
    Result Response result {“order_ids”:”order_id1,order_id2,order_id3”}
    Cancelling order is processed asynchronously. Response does not mean cancelled.
    Fold
  • Query details of an order (spot)
    1.General
    Description Request the details of a single order
    Collection http://api.dew.one/api/v1/spot/order
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    ordered Y long Order-id
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    Sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    Result Response result {“id”:123,”symbol”:”DEW.ETH”,”side”:”buy”,”price”:1, ”num”:1.123,”remaining”:1,”doneNum”:0.123,”revokeNum”:0,”status”:”BFCJ” }
    id:Order id
    num: Order volume
    remaining : Open volume
    doneNum: Trade volume
    revokeNum: Cancel volume
    status: Status(in appendix 1)
    Fold
  • Query details of a batch of orders (spot)
    1.General
    Description Request the open order(s) of specified trading pair
    Collection http://api.dew.one/api/v1/spot/orders
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    symbol Y String Code for spot trading pair, e.g. DEW.ETH
    Size Y Long Records (Up to 50, 30 in default)
    Tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    sign Y String MD5 Pr sign
    3.Response
    success Bool Is the request successful or not
    message string Return reason(s) for request failure
    result Response result [{“id”:123,”symbol”:”DEW.ETH”,”side”:”buy”,”price”:1, ”num”:1.123,”remaining”:1,”doneNum”:0.123,”revokeNum”:0,”status”:”BFCJ” },……]
    num : Order volume
    remaining : Open volume
    doneNum: Trade volume
    revokeNum: Cancel volume
    status: Status(Check specification in appendix 1)
    Fold
  • Query batch of trade records (spot)
    1.General
    Description Search for the specified trade records
    Collection http://api.dew.one/api/v1/spot/dones
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol N String Code for spot trading pairs, e.g. DEW.ETH
    ordered N String Order-ids are divided by commas, and cannot be empty simultaneous with Symbol.
    startTime N String Start time(yyyy-MM-dd HH:mm:ss)
    endTime N String End time(yyyy-MM-dd HH:mm:ss)
    start Y Long Yield value of records, starts from 0
    Limit Y Long Upper limit, up to 50
    Tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    Sign Y String MD5 Pr sign

    Query records are arranged in chronological order.
    3.Response
    Field Type Description
    Success bool Is the request successful or not
    Message string Return reason(s) for request failure
    Result Response result [{“id”:123,”symbol”:”DEW.ETH”,”side”:”buy”,”price”:1, ”num”:1.123,”time”:”20180728121111” },……]
    id : trade-id
    num : Trade volume
    time: Trade time
    Fold
  • Place an order (futures)
    1.General
    Description Request to place an open or close-out order on futures
    Collection http://api.dew.one/api/v1/fut/trade
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    Type Y string Operation type (open|close) stands for open position and close-out position respectively.
    Symbol Y string Symbol of futures, e.g. BTC-YX, BTCI-20180729
    num Y decimal Order volume(not less 0)
    price Y decimal Order price
    side Y string Direction (buy|sell) stands for long and short respectively.
    tonce Y long Timestamp
    apiKey Y string apiKey using MD5 sign
    presign Y string ETH Pr sign
    sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result {"order_id":"6045473"}or{"msg":"Symbol Error"}
    order_id:order-id(Ordering is processed asynchronously. Query via the returned order-id if the order is succeeded.), If return occurs when the value of success is true, specified order status can be queried via order-id.
    msg: reason for failed order, return when the value of success is false.
    Fold
  • Place a batch of orders (futures)
    1.General
    Description Request to open or close-out a batch of futures orders
    Collection http://api.dew.one/api/v1/fut/trade_batch
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    symbol Y String Symbol of futures. Place a batch of orders on a single symbol of futures, or it may fail.
    orders Y string [{'symbol':'BTC-YX','num':1,'price':8180,'side':'buy','type':'open','index':'1'},{'symbol':'BTC-YX','num':2,'price':8170,'side':'buy','type':'open','index':'2'}]
    Place a batch of orders on a single symbol of futures
    Index stands for the subscript of futures order batch record.
    tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    presign Y String ETH Pr sign
    sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result [{"index":"1","order_id":"6045474"},{"index":"2","order_id":"6045475"},{"index":"3","msg":"Symbol Error"}]
    index: stands for the subscript of futures order batch record order_id: order-id
    msg:the reason why the order is failed.
    Fold
  • Query details of an order (futures)
    1.General
    Description Request the details of a futures order based on order-id
    Collection http://api.dew.one/api/v1/fut/order
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    symbol Y String Symbol of futures
    orderId Y String Order-id, divided by comma”,”
    tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result [{"id":"6045474","type":"OPEN","symbol":"BTC-YX","side":"BUY","price":7980.000000,"num":1.000000,"successNum":0.000000,"failNum":0.000000,"cancelNum":0.000000,"remaining":1.000000,"revokable":true,status:"YB"},{}...]
    id: order-id
    type: open/close open /close-out position
    symbol: symbol of futures
    side: buy/sell long/short
    num: order volume
    successNum: trade volume
    failNum: failed volume
    cancelNum: cancel volume
    remaining: revokable volume
    revokable: Is the current order revolable
    status:status of orders. Check specification in appendix 1
    Fold
  • Query a batch of orders (futures)
    1.General
    Description Request all open orders on a symbol of futures
    Collection http://api.dew.one/api/v1/fut/orders
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Symbol of futures
    Size Y Int Query records (up to50, 30 in default)
    tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result [{"id":"6045467","type":"OPEN","symbol":"BTC-YX","side":"BUY","price":7980.000000,"num":1.000000,"successNum":0.000000,"failNum":0.000000,"cancelNum":0.000000,"remaining":1.000000,"revokable":true,status:"YCJ"},{}...]
    id: order-id
    type: open/close open /close-out position
    symbol: symbol of futures
    side: buy/sell long/short
    num: order volume
    successNum: trade volume
    failNum: failed volume
    cancelNum: cancel volume
    remaining: revokable volume
    revokable: Is the current order revolable
    status:status of orders. Check specification in appendix 1
    Fold
  • Query detail match result (futures)
    1.General
    Description Request detail match results on a symbol of futures
    Collection http://api.dew.one/api/v1/fut/dones
    Required type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Symbol of futures
    ordered N string Divide order-ids by commas
    startTime N string Start time(yyyy-MM-dd HH:mm:ss)
    endTime N string End time(yyyy-MM-dd HH:mm:ss)
    Start Y long Yield value of records, starts from 0
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message string Return reason(s) for request failure
    result Response result [{"id":12313,"type":"OPEN","symbol":"BTC-YX","side":"BUY","price":7980.000000,"num":1.0000,"time":"2017-12-09 21:12:20"},{}...]
    id: order-id
    type: open/close open/close-out position
    symbol: symbol of futures
    side: buy/sell long/short
    price: trade price
    num: order volume
    time: match time
    Fold
  • Cancel an order (futures)
    1.General
    Description Request to cancel a open or close-out order on futures
    Collection http://api.dew.one/api/v1/fut/cancel
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    symbol Y String Symbol of futures
    orderId Y long Order-id. Divide order-ids by commas”,”
    tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    presign Y string ETH Pr sign
    sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result {"order_ids":["1234","1235"]}
    order_ids: Return array after cancel is processed
    Cancelling order is processed asynchronously. Response does not mean cancelled.
    Fold
  • Cancel a batch of orders (futures)
    1.General
    Description Request to cancel all open orders of certain symbol of futures
    Collection http://api.dew.one/api/v1/fut/cancel_all
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    symbol Y string Code for spot trading pair, e.g. DEW.ETH
    positionType N String Pbull and pbear stand for long position and short position respectively When the type of futures is PERM (perpetual), it must be passed, since long and short are simultaneously supported in perpetual contracts. When the type is DAILY, it need not be passed.
    tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    presign Y string ETH Pr sign
    sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result {"order_ids":["6045469","6045473","6045474","6045475"]}
    Canceling order is processed asynchronously. Response does not mean cancelled.
    Fold
  • Query position (futures)
    1.General
    Description Query current positions
    Collection http://api.dew.one/api/v1/fut/positions
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y string Symbol of Futures
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    Sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result [{"id":226,"symbol":"BTC-YX","num":1.000000,"tradableNum":1.000000,"costPrice":7980.000000,"evenupPrice":7656.012000,"profit":0.060000},{}...]
    id: symbol of position
    symbol: symbol of trading pair
    num:positions. Positive number stands for long, and negative number stands for short
    tradableNum: tradable volume. Positive number stands for tradable long, and negative number stands for tradable short
    costPrice: Cost price
    evenupPrice: Liquidation price
    profit: Floating profit
    Fold
  • Remargin (futures)
    1.General
    Description Request to remargin
    Collection http://api.dew.one/api/v1/fut/margin_call
    Request Type POST
    Signature Method ETH+MD5
    2.Reference
    Parameter Required Type Description
    symbol Y string Symbol of futures
    positionId Y long Symbol of futures position. Return via position querying api(correspond with id)
    deposit Y decimal Remargin amount, cannot be negative
    Tonce Y long Timestamp
    apiKey Y string ApiKey using MD5 sign
    presign Y string ETH Pr sign
    Sign Y string MD5 Pr sign
    3.Response
    Field Type Description
    success Bool Is the request successful or not
    message String Return reason(s) for request failure
    result Response result {"order_id":"6200722"}
    order_id: remargin order-id
    Remargining order is processed asynchronously. Query the result by order-id.
    Fold
  • Query the result of remargin (futures)
    1.General
    Description Request if the remargin is completed
    Collection http://api.dew.one/api/v1/fut/margin_call_result
    Request Type POST
    Signature Method MD5
    2.Reference
    Parameter Required Type Description
    Symbol Y String Symbol of futures
    orderId Y Long Remargin order_id
    tonce Y Long Timestamp
    apiKey Y String ApiKey using MD5 sign
    sign Y String MD5 Pr sign
    3.Response
    Field Type Description
    success bool Is the request successful or not
    message string Return reason(s) for request failure
    result Response result {“status”:”SUCCESS”}
    status: value can be SUCCESS/FAIL/CONFIRM, which stand for remargin is succeeded, failed, and confirming respectively.
    Fold
  • Appendix
    1.Appendix 1- Status of orders
    Status Description
    JJSL Reject submitted order(end)
    SLZ Processing, cannot cancel
    YB Order processed
    DC Cancelling, possible status after submitting a cancel order.
    BCDC Partially matched, partially cancelling
    BFCJ Partially matched
    BCBCPartially matched, partially cancelled(end)
    CD Cancelled(end)
    YCJMatched(end)
    Fold