latest contributor to this doc

Last Edit: @gcharang ,

sell

sell base rel price volume (match_by order_type base_confs base_nota rel_confs rel_nota)

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.

StructureTypeDescription
basestringthe name of the coin the user desires to sell
relstringthe name of the coin the user desires to receive
pricenumeric string or rationalthe price in rel the user is willing to receive per one unit of the base coin
volumenumeric string or rationalthe amount of coins the user is willing to sell of the base coin; 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
min_volumenumeric string or rational (optional)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
match_byobjectthe created order is matched using this condition; important: this condition is not applied after GoodTillCancelled order conversion to maker request
match_by.typestringAny to match with any other order; Orders to select specific uuids; Pubkeys to select specific nodes; Default is Any
match_by.dataarray of stringsuuids of orders to match for Orders type; pubkeys of nodes to match for Pubkeys type
order_typeobjectthe type of the order
order_type.typestringthere are two types from which to choose: GoodTillCancelled and FillOrKill. The GoodTillCancelled order is automatically converted to a maker order if the order is not matched in 30 seconds, and this maker order stays in the orderbook until explicitly cancelled. On the other hand, a FillOrKill order is cancelled if it is not matched within 30 seconds. The default type is GoodTillCancelled
base_confsnumbernumber of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set
base_notaboolwhether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set
rel_confsnumbernumber of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set
rel_notaboolwhether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set
save_in_historybooleanDefaults 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, it's history will be saved as a json file

StructureTypeDescription
resultobjectthe resulting order object
result.actionstringthe action of the request (Sell)
result.basestringthe base currency of the request
result.base_amountstringthe resulting amount of base currency that is sold if the order matches (in decimal representation)
result.base_amount_ratrationalthe resulting amount of base currency that is sold if the order matches (in rational representation)
result.relstringthe rel currency of the request
result.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)
result.rel_amount_ratrationalthe minimum amount of rel coin that must be received in order to sell the base_amount of base (according to price, in rational representation)
result.methodstringthis field is used for internal P2P interactions; the value is always equal to "request
result.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
result.sender_pubkeystringthe public key of our node
result.uuidstringthe request uuid
result.match_byobjectthe created order is matched using this condition
result.match_by.typestringAny to match with any other order; Orders to select specific uuids; Pubkeys to select specific nodes; Default is Any
result.match_by.dataarray of stringsuuids of orders to match for Orders type; pubkeys of nodes to match for Pubkeys type
result.conf_settings.base_confsnumbernumber of required blockchain confirmations for base coin atomic swap transaction
result.conf_settings.base_notaboolwhether dPoW notarization is required for base coin atomic swap transaction
result.conf_settings.rel_confsnumbernumber of required blockchain confirmations for rel coin atomic swap transaction
result.conf_settings.rel_notaboolwhether dPoW notarization is required for rel coin atomic swap transaction
result.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.
result.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.

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": "1",
  "price": "1"
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ]
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "HELLO",
  "rel": "WORLD",
  "volume": {
    "numer": "3",
    "denom": "2"
  },
  "price": {
    "numer": "2",
    "denom": "1"
  }
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "HELLO",
  "rel": "WORLD",
  "volume": {
    "numer": "3",
    "denom": "2"
  },
  "price": {
    "numer": "2",
    "denom": "1"
  },
  "base_confs": 2,
  "base_nota": true,
  "rel_confs": 5,
  "rel_nota": false
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "TKL",
  "rel": "DUST",
  "volume": {
    "numer": "5",
    "denom": "2"
  },
  "price": {
    "numer": "9",
    "denom": "4"
  },
  "save_in_history": false
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "order_type": {
    "type": "GoodTillCancelled"
  }
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "order_type": {
    "type": "FillOrKill"
  }
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "match_by": {
    "type": "Any"
  }
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "match_by": {
    "type": "Pubkeys",
    "data": [
      "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a"
    ]
  }
}

POST
sell
{
  "userpass": "testpsw",
  "method": "sell",
  "base": "BASE",
  "rel": "REL",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "match_by": {
    "type": "Orders",
    "data": [
      "d14452bb-e82d-44a0-86b0-10d4cdcb8b24"
    ]
  }
}

{
  "result": {
    "action": "Sell",
    "base": "BASE",
    "base_amount": "1",
    "base_amount_rat": [
      [1, [1]],
      [1, [1]]
    ],
    "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000",
    "method": "request",
    "rel": "REL",
    "rel_amount": "1",
    "rel_amount_rat": [
      [1, [1]],
      [1, [1]]
    ],
    "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920",
    "uuid": "d14452bb-e82d-44a0-86b0-10d4cdcb8b24",
    "match_by": {
      "data": [
        "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a"
      ],
      "type": "Pubkeys"
    },
    "conf_settings": {
      "base_confs": 2,
      "base_nota": true,
      "rel_confs": 5,
      "rel_nota": false
    },
    "base_orderbook_ticker": null,
    "rel_orderbook_ticker": null
  }
}

{
  "error": "rpc:278] utxo:884] BASE balance 12.88892991 is too low, required 21.15"
}