# best_orders
The best_orders
method returns the best priced trades available on the orderbook. There are two options for the request, either volume
or number
.
If request is made by volume
, the returned results will show the best prices for trades that can fill the requested volume.
If request is made by number
, the returned results will show a list of the best prices, number
pairs long (e.g. top 5 best priced orders).
For coins with segwit, they may appear twice in the output (once for each address). E.g. LTC
and LTC-segwit
TIP
The response of this method can contain coins that are not activated on the Komodo DeFi Framework instance. Activation will be required to proceed with the trade.
# Arguments
Structure | Type | Description |
---|---|---|
coin | string | The ticker of the coin to get best orders |
action | string | Whether to buy or sell the selected coin |
request_by.type | string | Defines whether requesting by volume or by number |
request_by.value | string | If request_by.type is volume , the amount of coin user is willing to buy or sell. If request_by.type is number , the number of best price trades to return |
# Response
Structure | Type | Description |
---|---|---|
result | object (map) | the ticker -> array of order entries map |
where order entry has the following structure
Structure | Type | Description |
---|---|---|
coin | string | the ticker of the coin |
address | string | the address offering the trade |
price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request |
price_rat | rational | the price in num-rational crate format |
price_fraction | object (fraction) | the price represented as an object |
maxvolume | string (decimal) | the maximum amount of base the offer provider is willing to sell |
max_volume_rat | rational | the max volume in num-rational crate format |
max_volume_fraction | object (rational) | the max volume represented as an object |
min_volume | string (decimal) | the minimum amount of base coin the offer provider is willing to sell |
min_volume_rat | rational | the min volume in num-rational crate format |
min_volume_fraction | object (rational) | the min volume represented as an object |
pubkey | string | the pubkey of the offer provider |
age | number | the age of the offer (in seconds) |
zcredits | number | the zeroconf deposit amount (deprecated) |
netid | number | the id of the network on which the request is made (default is 0 ) |
uuid | string | the uuid of order |
is_mine | bool | whether the order is placed by me |
base_max_volume | string (decimal) | the maximum amount of base coin the offer provider is willing to buy or sell |
base_max_volume_rat | rational | the base_max_volume in num-rational crate format |
base_max_volume_fraction | object (rational) | the base_max_volume represented as an object |
base_min_volume | string (decimal) | the minimum amount of base coin the offer provider is willing to buy or sell |
base_min_volume_rat | rational | the base_min_volume in num-rational crate format |
base_min_volume_fraction | object (rational) | the base_min_volume represented as an object |
base_confs | number | the confirmations settings of base coin set by the offer provider |
base_nota | bool | the notarisation settings of base coin set by the offer provider |
rel_max_volume | string (decimal) | the maximum amount of rel coin the offer provider is willing to buy or sell |
rel_max_volume_rat | rational | the rel_max_volume max volume in num-rational crate format |
rel_max_volume_fraction | object (rational) | the rel_max_volume max volume represented as an object |
rel_min_volume | string (decimal) | the minimum amount of rel coin the offer provider is willing to buy or sell |
rel_min_volume_rat | rational | the rel_min_volume in num-rational crate format |
rel_min_volume_fraction | object (rational) | the rel_min_volume represented as an object |
rel_confs | number | the confirmations settings of rel coin set by the offer provider |
rel_nota | bool | the notarisation settings of rel coin set by the offer provider |
original_tickers | list (string) | Tickers included in response when orderbook_ticker is configured for the queried coin in coins file |
# 📌 Examples
# Command (by number)
curl --url "http://127.0.0.1:7783" --data "{
\"userpass\": \"$userpass\",
\"method\": \"best_orders\",
\"mmrpc\": \"2.0\",
\"params\": {
\"coin\": \"DGB\",
\"action\": \"buy\",
\"request_by\": {
\"type\": \"number\",
\"value\": 100
}
}
}"
# Command (by volume)
curl --url "http://127.0.0.1:7783" --data "{
\"userpass\": \"$userpass\",
\"method\": \"best_orders\",
\"mmrpc\": \"2.0\",
\"params\": {
\"coin\": \"BTC\",
\"action\": \"buy\",
\"request_by\": {
\"type\": \"volume\",
\"value\": 0.01
}
}
}"