Releases: wavesplatform/matcher
Version 2.0.0
In this release
The project was split into parts:
- The DEX server. Contains matching engine, provides a REST API to place and cancel orders, getting order books and etc. It contains only one artifact for any blockchain network. The DEX server should know a host with a Waves DEX extension.
- The NODE extension called Waves DEX extension which needs to be installed on NODE. It starts a gRPC server and provides a blockchain API for DEX server.
We recommend to install DEX server on a dedicated machine. An installation on the same machine is possible too.
For a better availablity we suggest to setup several NODEs with Waves DEX extension using round-robin DNS.
Note! Make sure the DEX server will connect to the NODE with the actual blockchain. The DEX server has to collect some information about assets during start.
See installation instructions on the main page.
Changes
We were focused more on splitting and testing, but some features and fixes were included too.
Severe
- DEX Server won't issue ExchangeTransactionV1 anymore. Make sure, your blockchain supports "Smart Account Trading" (feature 10)
New
- Added an ability to make the fee different for maker and taker. See
waves.dex.order-fee
inapplication.conf
for more information; - Added a possibility of fee changing. The DEX Server restart is required anyway, but you can specify the new rule from a some offset on all your DEX Servers and they will change an algorithm in a consistent way. See
waves.dex.order-fee
for more information; - Introduced a new binary
waves-dex-cli
. It can do some useful things now and will be improved later. Just writewaves-dex-cli --help
- A fresh Swagger UI;
Fixes
- History database: fixed improperly formatted amounts, prices and fee when they have huge values (e.g. 98778998 WAVES). Also this fix solves an akin issue in errors output;
- Improved a thread pools management. This solves a small set of performance issues;
- Solved 10 seconds delay during DEX server starting;
- Better handling of invalid JSONs those are sent to REST API;
- Improved logging. Some log entries could not be written before this fix;
- A DEX server has different exit codes for different starting issues. If your instance stopped during start, please attach this code to the issue;
Other notable technical changes
- DEX project doesn't depend on NODE at all. Required dependencies are downloaded automatically.
- Updated dependencies of used libraries to fresh versions;
- DEB artifacts:
waves-dex-extension
is marked as incompatible withgrpc-server
extension, because they both had a common set of dependencies, probably with incompatible versions;
Migration
No data migration is required, only a configuration.
1. Waves DEX extension
-
If "Smart Account Trading" wasn't activated before update:
- Block requests to DEX
- Make snapshots for order books via
POST /matcher/debug/saveSnapshots
-
Save the previous DEX configuration
-
Uninstall the DEX extension
-
Remove the previous DEX configuration from the NODE's config. Add instead settings:
# Waves NODE settings
# ...
waves {
extensions += "com.wavesplatform.dex.grpc.integration.DEXExtension"
dex {
# gRPC integration settings for Waves Node
grpc.integration {
# "0.0.0.0" if the DEX server connects to the DEX extension from other machine
host = "127.0.0.1"
port = 6887
}
}
}
- Install the new DEX extension. Note, it requires NODE 1.1.8
2. DEX Server
Install DEX Server. Old settings now are DEX server settings, but a migration is required:
-
The database should be moved from NODE's directory to the DEX Server's one, e.g.:
mv /var/lib/waves-testnet/matcher to /var/lib/waves-dex
-
Added a new mandatory field:
waves.dex.address-scheme-character
. It should have a following value:W
for MainNet. For example:waves.dex.address-scheme-character = "W"
;T
for TestNet;S
for StageNet;- or your custom network byte;
-
Added a new mandatory field:
waves.dex.waves-blockchain-client
. Sample configuration:# external_or_host_with_extension:port_of_extension waves.dex.waves-blockchain-client.grpc.target = "192.168.1.2:6887"
-
account
was replaced byaccount-storage
. Generate an account storage and follow instructions. -
bind-address
andport
were replaced byrest-api
. Sample configuration:waves.dex.rest-api { # Here is old "bind-address" address = "127.0.0.1" # Here is your old "port" port = 6886 # Hash of API key string in the Base58 encoding # Run "waves-cli-dex create-api-key" and follow instructions to replace # this value api-key-hash = "4Cmi2ZMmH7nTRig9fnDVzSmfXA9mCcyeqyswPbRhLS34" # Enable/disable CORS support # If you want to access DEX Server REST API from the other hosts in a browser, # otherwise set to "no" cors = yes # Enable/disable X-API-Key from different host # If enabled, a client from other hosts can pass X-Api-Key in a browser and # therefore has an access to the private API api-key-different-host = no }
-
The
order-fee
setting now supports a switching of a fee algorithm. The default rule has-1
offset. Sample configuration:waves.dex.order-fee { -1: { # Here is your old "order-fee" content } }
SHA256 Checksums
bff2410564387bbff0bcd413f218a1e15d31dd9838a80098bb279385555da60b waves-dex-2.0.0.zip
0490e383d014d42dacd72a60c08daa484c89f8a016cd10cb8f34a2c2672fad1f waves-dex_2.0.0_all.deb
a20b80c9ceecf0195801eabcac3d84dc602fa2cb5abe0256c65b19c2351468ba waves-dex-extension-2.0.0.zip
1542c2b5fa445b9dfd36a4c9c6ed4d62c0e19fff48fe0ca5ed17e7dac531e02d waves-dex-extension_2.0.0_all.deb
4f807fa497d63ed2eba5da6edb8f8d534fe538aeedc18e906e12b2f5f985e931 waves-dex-extension-testnet_2.0.0_all.deb
10ac062b8f6b0605057b413b5d79f4e81158c6ceb2dd8c92649cd5d8abd401a8 waves-dex-extension-stagenet_2.0.0_all.deb
Version 1.1.1
This release compatible with a fresh NODE v1.1.7. No migration is required.
SHA256 Checksums
e320fa316e3fc3244acc3c7d7c87ea0a20cfe9f5bad188794888d464f7690340 dex-1.1.1.tgz
2fece7b0ef3007f8f45a88805f61b12ae6f869ae61a41fe472be6d2877f4a5d3 dex_1.1.1_all.deb
cb3634b9340f5b46d7ce315693ad990fee45c7c9ae09facbf3e4e011806ee84e dex-testnet-1.1.1.tgz
bd7898823ff4fa0be6b1eef7c2505ddd76b198aaefdbec1a78f2d8f612c201d3 dex-testnet_1.1.1_all.deb
aafda3b4489ba441a85727b6bf15fc8f2b94983cc1b7b1078836426793beea4c dex-stagenet-1.1.1.tgz
1b0fcec1be82df0948ae85e3c1fdd8b43ebc1ae704093202714c59b31a5749f3 dex-stagenet_1.1.1_all.deb
Version 1.1.0
In this release
This release contains bug fixes and improvements with a fresh Node's version dependency.
Migration
Some changes are required for configs.
-
akka.kafka
section is obsolete. Please remove it, if you have. -
Settings from
akka.kafka.consumer.kafka-clients
are moved towaves.dex.events-queue.kafka.consumer.client
. If you hadn't such settings, just ignore this. -
Settings from
akka.kafka.producer.kafka-clients
are moved towaves.dex.events-queue.kafka.producer.client
. If you hadn't such settings, just ignore this. -
There are some changes in
waves.dex.events-queue.kafka
:consumer.buffer-size
was renamed toconsumer.max-buffer-size
consumer.min-backoff
,consumer.max-backoff
andproducer.buffer-size
was removed
Also it is recommended to enable broadcast-until-confirmed
:
# Enables transaction rebroadcasting until if confirmed on blockchain
waves.dex.exchange-transaction-broadcast.broadcast-until-confirmed = yes
And tune Kafka's clients configuration for production, if you use Kafka's queue and have issues with not working places and cancels:
waves.dex.events-queue.kafka {
consumer.client.connections.max.idle.ms = 30000
producer.client.connections.max.idle.ms = 30000
}
Changes
The NODE dependency is updated to 1.1.6
New
Distinguishing limit and market orders in order history requests (#130). Added "orderType" in JSON responses of:
* getAssetPairAndPublicKeyOrderHistory - `GET /matcher/orderbook/{amountAsset}/{priceAsset}/publicKey/{publicKey}`
* getPublicKeyOrderHistory - `GET /matcher/orderbook/{publicKey}`
* Admin's getAllOrderHistory - `GET /matcher/orders/{address}`
Fixes
- Solved multiple issues those lead to unexpected orders cancellation;
- Release a reserved balance if the placement is failed to save to the queue;
Other improvements
- A new client for Kafka's queue with better tuned settings by default. Uses less TCP/IP connections, works well for massive cancels;
- We removed the
InvalidRateInput
error with code 20971521 and introduced more general errorInvalidJson
with code 1048577.
SHA256 Checksums
9b80c48638061f4c3c1eef7220d423d53d4982ff98d6a62a0818ce72f0d1e528 dex-1.1.0.tgz
f88828f1b2a8c36b02bdb4cf6af8817693641cc5981070d4d5214259f5bf4a9d dex_1.1.0_all.deb
1d3115d09a2b8f8c716bf37b94ba1ddc29557f7c906e0338027e338a64643b56 dex-testnet-1.1.0.tgz
153b2b7d2edf56941eb58b6f95ddfe04962f0a8687fd9fdd2d04d5f6d5527303 dex-testnet_1.1.0_all.deb
5480712dd46ad12a27cdddd2eb3fbbe8b3e154bb5c287517e7cfff8cb9c648e0 dex-stagenet-1.1.0.tgz
893edbb875f835bd08577aa375b3008ad658fb785de24962132987375269309e dex-stagenet_1.1.0_all.deb
Version 1.0.4
In this release
This is mostly a compatibility release with a fresh Node's version dependency.
Migration
No needed.
Changes
The NODE dependency is updated to 1.1.5
New
- A custom database can be specified for Order History in the config:
waves.dex.postgres.database
. Specify this option, If you used a history database functionality
Fixes
- The tick size now can be correctly represented for the pairs with 16 decimals;
- Improved a handling of incorrect asset rates.
SHA256 Checksums
29e4f85e24d980126007b447e57f155a85df62b671b5c97ae1f80e4c522025e6 dex-1.0.4.tgz
b2ee0ae5e75edb7518e0da04d0098144a7acf3ef24e38e6cd29ce340eb244cde dex_1.0.4_all.deb
6df031ae921c588e0dda19bb937f42c65eebfd85c0c8c09ee015deb749464986 dex-testnet-1.0.4.tgz
5612463f1e091b9542f8903a4917e224045d386555c2ce277e6d4f549e1344a6 dex-testnet_1.0.4_all.deb
e33603db65c2aa2f777de74f835d302917beb849de556250a0417c0f3f0bc1df dex-stagenet-1.0.4.tgz
4c6b5adf5df1d9141dd99c56afb0ddfedabd894087b32c496542ce18e4c6da5d dex-stagenet_1.0.4_all.deb
Version 1.0.3
In this release
This is a release with small bug-fixes with a fresh Node's version dependency.
Migration
No needed.
Changes
The NODE dependency is updated to 1.1.4
Fixes
- Zero fee in partially filled order with expensive fee asset fixed
- Matching rules for the asset pair now display tick-size that will be applied to the next order
- A lot of bug-fixes regarding tick-size
SHA256 Checksums
9e439a27ff879417b9d1c8e036528e534acecd2396db3d852b10e91d4335f837 dex-1.0.3.tgz
46f9ace4969fc8f32dd6d31e4bf8adb577be2936d9ad4d7d72904a553f08ce06 dex_1.0.3_all.deb
bf749bcc07f88b0bf254c8845e827acd774be71a7edfd48ef0a67d08bfa17d63 dex-testnet-1.0.3.tgz
41b8a71af49647764af4cbbe8e2a2d1194627a9c12b9c01e4080c0413b212903 dex-testnet_1.0.3_all.deb
fc6d4b68a6e78e9db7d3b64f3074efde2910a8cf65dd90d7a1b0598b39a2ec9d dex-stagenet-1.0.3.tgz
ae5d48c99e163be07dbc4d5a1cfa852238c07cf65c0abd6149767c35cdf48e1a dex-stagenet_1.0.3_all.deb
Version 1.0.2 (MainNet)
In this release
Migration
No needed.
Changes
New
Updated dependency to Node version 1.1.2
Support Java 11
New admin endpoint to save snapshots
POST /matcher/debug/saveSnapshots
- forcibly saves snapshots for all order books
Format amount, price and fee in errors as floating-point numbers
All amount, prices and fees are in human-readable format in errors.
Example
{
"message": "The order's amount 98778998.00000124 EXK248vv4E1Q7iVm1FmcRU7vsMJJ48q3ehRqvtYPK4zb does not meet matcher requirements: max amount = 1000000, min amount = 0.001, step amount = 0.00000001"
}
Fixes
- Fee denormalization bug in History Database fixed, filling of the fee in History Database added, OrderHistoryTestSuite refactoring
- Fixed issues with loading Swagger resource files in a browser
- Issues after migration to Node 1.1.0
- Forbid 0 price level
- Simultaneous single and group cancels
- Configurable depth of orderbooks in responses
SHA256 Checksums
b86532eb84f02241d502ba93f9dfea6c8a267a2d8f869a342a129704eef91931 dex-1.0.2.tgz
eede74622df261b5c87599aa2924e83e79b940e24eb3aeb6437ee25771f83d12 dex_1.0.2_all.deb
d6ea8898920ab90b585b2833f1d64dbebbf2e816a35e94ca61751279ea3034c9 dex-testnet-1.0.2.tgz
d1d2a47f92d264cbbfb0500a9f74815017a10a6b242f67c2b6c71317752ba007 dex-testnet_1.0.2_all.deb
ab5d94cbe7b015433b5560a2c3dd62f5573a15790ec5d9bb9c7022b000e8f94d dex-stagenet-1.0.2.tgz
5072fc00fa7cc762c2e8238e145b7e115dcb0f037f27da473c09b312d69f7a2e dex-stagenet_1.0.2_all.deb
Version 1.0.1
In this release
Migration
This migration is mandatory. It is required to provide a correct information about fees in REST API.
Run after update:
- for mainnet:
sudo -u waves waves -main com.wavesplatform.dex.MatcherTool /path/to/config oi-migrate
- for testnet:
sudo -u waves-testnet waves-testnet -main com.wavesplatform.dex.MatcherTool /path/to/config oi-migrate
Probably, you will see:
Can't parse the ...
There are very old orders, those weren't migrated a long time ago and it's okay to delete them.
Depending on the machine configuration the migration could take ≈12 minutes for each 100 millions of orders. Also the migration is idempotent and leaves the DB in the correct state even it ran multiple times.
Changes
New
The matcher fee in REST API
Getting a single order's information
Added filledFee
in JSON for methods:
GET /orderbook/{amountAsset}/{priceAsset}/{orderId}
Sample responses
Before:
{
"status": "Filled",
"filledAmount": 754859
}
Now:
{
"status": "Filled",
"filledAmount": 754859,
"filledFee": 700000
}
Getting a multiple orders' information
Added fee
, filledFee
and feeAsset
fields in JSON for methods:
- GET
/orderbook/{amountAsset}/{priceAsset}/publicKey/{publicKey}
- GET
/orderbook/{publicKey}
- GET
/orders/{address}
Sample responses
Before:
[
{
"id": "D3mniK9HoDvF8eMSDqd5eAE1og2fpa2VVP4d9BeTKV7C",
"type": "sell",
"amount": 54999997,
"price": 1000,
"timestamp": 1559646820853,
"filled": 0,
"status": "Cancelled",
"assetPair": {
"amountAsset": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
"priceAsset": "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
}
},
{
"id": "BQHKXPr13r4fXVbB4q8e1XAoz5SsPfj9rDtVpbHgxCCx",
"type": "buy",
"amount": 5000000,
"price": 39499999,
"timestamp": 1559646738907,
"filled": 4999998,
"status": "Filled",
"assetPair": {
"amountAsset": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
"priceAsset": null
}
}
]
Now:
[
{
"id": "D3mniK9HoDvF8eMSDqd5eAE1og2fpa2VVP4d9BeTKV7C",
"type": "sell",
"amount": 54999997,
"fee": 300000,
"price": 1000,
"timestamp": 1559646820853,
"filled": 0,
"filledFee": 0,
"feeAsset": null,
"status": "Cancelled",
"assetPair": {
"amountAsset": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
"priceAsset": "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
}
},
{
"id": "BQHKXPr13r4fXVbB4q8e1XAoz5SsPfj9rDtVpbHgxCCx",
"type": "buy",
"amount": 5000000,
"fee": 300000,
"price": 39499999,
"timestamp": 1559646738907,
"filled": 4999998,
"filledFee": 299999,
"feeAsset": null,
"status": "Filled",
"assetPair": {
"amountAsset": "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
"priceAsset": null
}
}
]
Numbers in errors in a human-readable format
All amount, prices and fees are in human-readable format in errors. Before this update you may see long numbers, now you will see a floating point values those correspond to your intuition about an asset.
For example, you may see "12345000000 WAVES" before in errors, now you will see "123.45 WAVES".
Other changes
- The NODE dependency is updated to 1.0.2;
- Now the DEX's version is show correctly in Swagger;
- A DEX's deb package now depends on exact NODE's deb version. Previously we have issues with changed internal API, those led to unstable DEX work;
- A new cool tool to make releases, see README.md :)
- Updated other dependencies: [email protected];
- Improved logs for AskTimeoutException;
Fixes
Fixed issue with order placement on new scripts
Previously, users have issues with order placement on accounts with scripts like this:
{-# STDLIB_VERSION 3 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Verifier(x)
func verifier() = {
match(x) {
case o: Order =>true
case _ => false
}
}
Also now we catch all blockchain's access during an order's validation. All new functions those doesn't require a blockchain's access will be supported automatically in future. But the errors will be less readable if you trying, for example, to obtain account's data. Waiting for news from Smart Contracts Team!
SHA256 Checksums
9542468070ebef8cd2cb468b7bb3ab5135cda50306d3f2c07a216dc124e4a416 dex-1.0.1.tgz
e5159cb8fbbbed2dd777b1dd7de021a377ac41532210fdb577389ec5c64e5fe5 dex_1.0.1_all.deb
689a0aa5899cbf0098019ba4f51c1d6bf6cc66ec4f0dd034baebfaf67008a734 dex-testnet-1.0.1.tgz
61032a0c1033964b33ba872f3a7b502392ac9a0b5510a07835fd6a83556b6a5e dex-testnet_1.0.1_all.deb
Version 1.0.0
Separation from NODE!
Previously, we have to develop new features in the old NODE's branch. All this time we made changes in 0.16
branch.
Now DEX is a separate project on GitHub and we are able to develop new features for any NODE's version (with some limitations). We still depend on NODE, but this will help us to avoid a lot of problems during development.
Snapshot migration
In the latest 0.16
and 0.17
NODE's versions, we changed storage format for order books and the list of all available markets. To migrate make the following steps:
-
Get the oldest snapshot offset from the running DEX:
curl --header 'X-API-Key: your-api-key' 'https://dex-host[:dex-port]/matcher/debug/oldestSnapshotOffset'
-
Stop the NODE with DEX;
-
Backup
/var/lib/waves/matcher
or/var/lib/waves-testnet/matcher
for mainnet or testnet respectively; -
Upgrade the DEX, don't yet run the service;
-
Run the migration tool to covert a list of available markets:
For mainnet:
sudo -u waves waves -main com.wavesplatform.dex.MatcherTool /usr/share/waves/conf/waves.conf ma-migrate
For testnet:
sudo -u waves-testnet waves-testnet -main com.wavesplatform.dex.MatcherTool /usr/share/waves-testnet/conf/waves.conf ma-migrate
You will see
Asset pairs migrated
in the end.
-
Check all pairs are migrated:
For mainnet:
sudo -u waves waves -main com.wavesplatform.dex.MatcherTool /usr/share/waves/conf/waves.conf ma-inspect
For testnet:
sudo -u waves-testnet waves-testnet -main com.wavesplatform.dex.MatcherTool /usr/share/waves-testnet/conf/waves.conf ma-inspect
You will see
Known asset pairs
and the list of migrated pairs.
-
Run the migration tool to covert order books:
For mainnet:
sudo -u waves waves -main com.wavesplatform.dex.MatcherTool /usr/share/waves/conf/waves.conf ob-migrate <paste-oldest-snapshot-offset-from-p.1-here>
For testnet:
sudo -u waves-testnet waves-testnet -main com.wavesplatform.dex.MatcherTool /usr/share/waves-testnet/conf/waves.conf ob-migrate <paste-oldest-snapshot-offset-from-p.1-here>
Probably you will see
Can't migrate order books
with
The default offset for these order books is
It's okay.
-
Delete folders old snapshots and journal:
For mainnet:
sudo -u waves rm -rf /var/lib/waves/matcher/{snapshots,journal}
For testnet:
sudo -u waves-testnet rm -rf /var/lib/waves-testnet/matcher/{snapshots,journal}
Settings migration
-
We changed the main section in settings. It was
waves.matcher
, now it iswaves.dex
-
Also, the DEX is activated after this setting:
waves.extensions = [ // Other extensions "com.wavesplatform.dex.Matcher" ]
Don't forget it.
-
order-match-tx-fee
now isexchange-tx-base-fee
-
If you used
allowed-asset-pairs
before, add the setting:waves { // … dex { // … white-list-only = yes } }
Now:
- whitelist works only if this flag is provided;
allowed-asset-pairs
functionality doesn't affectallowed-asset-pairs
, aren't validated against blacklist rules only.
-
Kafka:
New functionality
Some of new functionality are marked as Experimental.
This means that the feature is implemented and tested, but currently isn't used in our DEX.
Allowed order versions
Now you can specify allowed order version in the waves.dex.allowed-order-versions section.
Notice, the DEX still checks the version is supported in the blockchain and deny orders of unsupported versions.
The current supported versions (with blockchain's checks) can be obtained through GET /matcher/settings
, for example:
{
"priceAssets": [],
"orderFee": {
"dynamic": {
"baseFee": 300000,
"rates": {
"BrmjyAWT5jjr3Wpsiyivyvg5vDuzoX2s93WgiexXetB3": 0.0097,
"DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn": 0.0003,
"WAVES": 1
}
}
},
"orderVersions": [
1,
2
]
}
Charging fee's modes
- Default:
dynamic
requires an additional fee for scripted entities (DEX's account, scripted assets in pair and fee); fixed
requires a fixed amount of fee;- Experimental:
percent
requires a percent fee of one of pair's asset;
Our DEX
uses a dynamic
as usual. See waves.dex.order-fee for more information and all available settings.
Fee rates
This feature allows clients to pay fee both in Waves and assets.
We don't specify the absolute values, but instead specify a waves-to-asset conversion rate, because it's hard to rely on absolute values in some fee's modes.
To enable the feature make sure:
- Order Version 3 (id is 12) is activated on blockchain. See
GET https://node-host[:node-rest-api-port]/activation/status
for activation status. waves.dex.allowed-order-versions
contains 3.
REST API
-
Getting current rates:
GET /settings/rates
.Sample response:
{ "BrmjyAWT5jjr3Wpsiyivyvg5vDuzoX2s93WgiexXetB3": 0.0097, "DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn": 0.0003, "WAVES": 1 }
-
Add or update rate for the specified asset:
PUT /settings/rates/{assetId}
. The request's body must contain a rate in units: 1.5 means that the rate is 150%. The method requires the API key. -
Delete the rate for the specified asset:
DELETE /settings/rates/{assetId}
. Clients won't be able to pay a fee in{assetId}
after deletion. The method requires the API key.
Order restrictions
It's an additional and configurable layer of order's validation.
The sample configuration:
waves.dex.order-restrictions = {
"WAVES-DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn": {
step-amount = 0.00000001
min-amount = 0.001
max-amount = 1000000
step-price = 0.00000001
min-price = 0.001
max-price = 100000
}
}
REST API
Getting order info for a pair: GET /matcher/orderbook/WAVES/DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn/info
Sample response:
{
"restrictions": {
"stepAmount": "0.00000001",
"minAmount": "0.01",
"maxAmount": "100000",
"stepPrice": "0.00000001",
"minPrice": "0.000003",
"maxPrice": "100"
},
"matchingRules": {
"tickSize": "0.00000001"
}
}
Getting order books GET /orderbook
now returns matchingRules
too.
Matching rules
Matching rules is the way to change how the DEX's algorithm works for specified pair. The rules are changed when a pair processes a message with offset (kafka or local) >= specified.
Rules can be changed at specified offset. See waves.dex.matching-rules for more information.
The current queue offset could be determined through GET /matcher/debug/currentOffset
(an authentication key is required).
Merge prices rule
At this moment we have only the one rule: to merge prices with a given step or not. By default this rule is not applied.
For example we defined rules:
waves.dex.matching-rules = {
"WAVES-DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn": [
{
start-offset = 10000
merge-prices = yes
tick-size = 0.002
},
{
start-offset = 55000
merge-prices = no
}
]
}
This means:
-
At start prices are not merged.
-
When the offset becomes 10000, we align incoming orders at prices multiple of 0.002:
- A sell (ask) order with price 0.005 will be aligned at 0.006 level and will be added to the end of the queue of this level.
- A buy (bid) order with price 0.003 will be aligned at 0.002 level and will be added to the end of the queue of this level.
Note, the we doesn't align existent orders in the order book. An ask order that was placed with the 0.007 price before will not be merged into 0.008. Same for bid orders.
-
The merging is disabled, when the offset becomes 55000. The existent orders will not be un-aligned too.
Max price deviation (Experimental)
Defines an additional order's validation against current market;
# Price and fee deviations (in percents)
waves.dex.max-price-deviations {
# Enable/disable deviations checks
enable = no
# Max price deviation IN FAVOR of the client
profit = 50
# Max price deviation AGAINST the client
loss = 40
# Max fee deviation from the market price
fee = 30
}
This means if a user tries to submit an order with the price outside of specified bounds:
- the price is better by more than 50% than the current market price
- the price is worse by more than 40% than the current market price
- the specified fee is lower by more than 30%, that otherwise, the user pays as a fee by executing the order at market price (applicable for
percent
fee type)
In all those cases the order will be rejected with an error.
History database (Experimental)
Now we are able to write a his...