Waves DEX API (official team's communication)


#1

Hello everyone! Here we’ll be discussing DEX API changes and improvements. Also, you can ask any questions related to API.

Here is our main API documentation: DEX API
REST API Explorer: https://matcher.wavesplatform.com/api-docs/index.html


#2

Currently, DEX supports deletion of orders in the final state (Canceled or Filled) from Order History. It’s a controversial method that rarely exists on other exchange APIs.

Our proposal is to deprecate this method:

POST /matcher/orderbook/{amountAsset}/{priceAsset}/delete

It will remain in the current version of API but executes “No Operation” to not breaking the existing clients. Later it can be removed.

Other changes will affect getting order history method (by AssetPair and PublicKey):

GET /matcher/orderbook/{amountAsset}/{priceAsset}/publicKey/{publicKey}

We’re working on the current optimization of Order History storage. This method will be unified with All Order History:

  1. At first, all active order is returned and the remaining capacity (up to 100 orders per one pair) will be supplemented with inactive orders in chronological order.
  2. activeOnly parameter will be added to return only currently open orders.
  3. By default activeOnly = true if not specified.

Please, provide your cooments and suggestions regardign these changes.


#3

Hi there!

Actually I have a question here concerning removal of /delete method. Have you got any usage statistics for this method? I guess it is not correct to delete it as some logic can rely on it somewhere. It breaks backward-compatibility of your API.

Why have you decided to delete it? Because each and every software uses it and it slows down operations because of internal implementation or just to be aligned with other exchanges APIs?

I want to encourage you to use Parallel change (Parallel Design) pattern, it is very important for public APIs if you want your clients be with you.

Personally I used this method widely and now part of my software has been broken. Broken software == upset clients == drawback to business.

Thanks.


#4

Hi @goliaf!

Thanks for your feedback. Actually, we haven’t deleted this method but make it do nothing, because it’s wired to delete something from history and also has some technical reasons behind it.

Also, we’ve added activeOnly method to GET /matcher/orderbook/{publicKey} method if you don’t want finished orders (in Filled or Cancelled status) in your response.

Could you please clarify how you software became broken?


#5

I was working on api and really get tired of current history books. Do we really have to get the id of order on the exchange? Why don’t we have an option to cancel order with this method
/matcher/orderbook/{amountAsset}/{priceAsset}/cancel and get the info if it is filled or else.


#6

Btw, while working on matcher could you please change testnet pairs. All based on waves market eg: usd / waves. Make it same with mainnet. Difficult to use testnet while programming trading bots. Also having difficulties with decimals :joy::zipper_mouth_face:


#7

muito bom o procedimento aplicado


#8

New validation rule for order price.
With the new version of DEX that will be on mainnet next week, we’re going to apply additional validation to Order price.

You may already know the following formula to convert raw price from an order in the blockchain to the human-readable form:
PriceDecimals = 8 + (PriceAssetDecimals - AmountAssetDecimals)

Current Problem:
For pairs where PriceAssetDecimals > AmountAssetDecimals price can contain more decimals than PriceAssetDecimals.

Example:
Pair is WCT/WAVES, price = 16073267999999
PriceDecimals = 8 + (8 - 2) = 14
UI Price = 0.16073267

This price was previously valid for DEX, but non-zero decimal after 8th digits are not needed and hidden in UI.
Only 8 significant digits will be shown in UI price = 0.16073267
and valid price in Order JSON should be price: 16073267000000.

16073267999999 (0.16073267999999) - Invalid price
16073267000000 (0.16073267) - Valid price

The new added validation will check this and won’t allow such prices with non-zero digits after 8th digit with error:
“Invalid price. Last {N} digits should be zero”, where
N = PriceAssetDecimals - AmountAssetDecimals


#9

Cancel all active order.

Using new API methods you can cancel all active orders by a pair or for all pairs in one call.

For both methods, you should use the request body without order id, where signature sign publicKey ++ timestamp bytes

{
  "sender": "string",
  "timestamp": 1543417471843,
  "signature": "string"
}