On this page

latest contributor to this doc

Last Edit:

@smk762

Sell

API-v1sell

The sell method issues a sell request and attempts to match an order from the orderbook based on the provided arguments.

Buy and sell methods always create the taker order first. A taker order must pay a dexfee during the swap as it is taking liquidity from the market. The dexfee is calculated as "the greater of either Minimum transaction amount (dust) TAKER COIN or 0.0001 TAKER COIN or 1/777th the size of the desired order". If your GoodTillCancelled order is not matched in 30 seconds, the order is automatically converted to a maker request and stays on the orderbook until the request is matched or cancelled. To always act as a maker, please use the setprice method. To prevent a user from making trades in which the transaction fees may end up costing a significant portion of the value of the trade, we have set a lower limit to the value of a trade. See the description of the volume argument for more info.

ParameterTypeRequiredDefaultDescription
basestring-The name of the coin the user desires to sell
relstring-The name of the coin the user desires to receive
pricenumeric string or rational-The amount of rel coins the user wants to receive for each unit of the base coin spent.
volumenumeric string or rational-The maximum amount of base coin available for sale in the order, ignored if max is true; the following values must be greater than or equal to the min_trading_vol of the corresponding coin:
  • the argument volume
  • the product of the arguments volume and price
base_confsnumber-Number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set
base_notabool-Whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set
match_byobject-Optional. A standard MatchBy object, to filter to include only matches by pubkey or uuid. Important: This condition is not applied after a GoodTillCancelled order is converted to a maker request.
min_volumenumeric string or rational-The amount of base coin that will be used as min_volume of GoodTillCancelled order after conversion to maker; the following values must be greater than or equal to the min_trading_vol of the corresponding coin:
  • the argument min_volume
  • the product of the arguments min_volume and price
. Can be a numeric string, expressed using standard RationalValue or FractionalValue objects.
order_typeobject-Optional. A standard OrderType object.
rel_confsnumber-Number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set
rel_notabool-Whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set
save_in_historybooleantrueDefaults to true. If set to false no order history will be saved (though order status will be temporarily stored while in progress). If true, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, its history will be saved as a json file

ParameterTypeDescription
actionstringThe action of the request (Sell)
basestringThe base currency of the request
base_amountnumeric stringThe resulting amount of base currency that is sold if the order matches, represented as a decimal value.
base_amount_ratrationalThe resulting amount of base currency that is sold if the order matches, represented as a standard RationalValue object.
base_orderbook_tickerstringThe ticker of the base currency if orderbook_ticker is configured for the base currency in coins file. If not defined, will return a null value.
conf_settingsobjectA standard ConfSettings object.
dest_pub_keystringReserved for future use. The dest_pub_key allows the user to choose the P2P node that is eligible to match with the request. This value defaults to "zero pubkey", meaning that anyone can match
match_byobjectA standard MatchBy object, to filter to include only matches by pubkey or uuid. Important: This condition is not applied after a GoodTillCancelled order is converted to a maker request.
methodstringThis field is used for internal P2P interactions; the value is always equal to "request"
relstringThe rel currency of the request
rel_amountstringThe minimum amount of rel coin that must be received in order to sell the base_amount of base (according to price, in decimal representation)
rel_amount_ratrationalThe minimum amount of rel coin that must be received in order to sell the base_amount of base (according to price, represented as a standard RationalValue object).
rel_orderbook_tickerstringThe ticker of the rel currency if orderbook_ticker is configured for the rel currency in coins file. If not defined, will return a null value.
sender_pubkeystringThe public key of our node
uuidstringThe request uuid

sell

POST
sell
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "sell",
  "base": "DOC",
  "rel": "MARTY",
  "price": 1.1,
  "volume": 2.4
}