On this page

latest contributor to this doc

Last Edit:

@gcharang

setprice

setprice base rel price (volume max cancel_previous=true base_confs base_nota rel_confs rel_nota min_volume)

The setprice method places an order on the orderbook, and it relies on this node acting as a maker, also called a Bob node.

The setprice order is always considered a sell, for internal implementation convenience.

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 and min_volume arguments 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 maximum amount of base coin available for 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
min_volumenumeric string or rationalthe minimum amount of base coin available for the order; it must be less or equal than volume param; 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
maxboolKomodo DeFi Framework API will use the entire coin balance for the order, taking 0.001 coins into reserve to account for fees
cancel_previousboolKomodo DeFi Framework API will cancel all existing orders for the selected pair by default; set this value to false to prevent this behavior
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
basestringthe base coin of the order
relstringthe rel coin of the order
pricestring (numeric)the expected amount of rel coin to be received per 1 unit of base coin; decimal representation
price_ratrationalthe expected amount of rel coin to be received per 1 unit of base coin; rational representation
max_base_volstring (numeric)the maximum volume of base coin available to trade; decimal representation
max_base_vol_ratrationalthe maximum volume of base coin available to trade; rational representation
min_base_volstring (numeric)Komodo DeFi Framework API won't match with other orders that attempt to trade less than min_base_vol; decimal representation
min_base_vol_ratrationalKomodo DeFi Framework API won't match with other orders that attempt to trade less than min_base_vol; rational representation
created_atnumberunix timestamp in milliseconds, indicating the order creation time
updated_atnumberunix timestamp in milliseconds, indicating the order update time
matchesobjectcontains the map of ongoing matches with other orders, empty as the order was recently created
started_swapsarray of stringsuuids of swaps that were initiated by the order
uuidstringuuid of the created order
conf_settingsobjectA standard ConfSettings 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.
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
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "BASE",
  "rel": "REL",
  "price": "0.9",
  "volume": "1"
}

POST
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "BASE",
  "rel": "REL",
  "price": "0.9",
  "max": true
}

POST
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "HELLO",
  "rel": "WORLD",
  "volume": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ],
  "price": [
    [
      1,
      [
        1
      ]
    ],
    [
      1,
      [
        1
      ]
    ]
  ]
}

POST
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "HELLO",
  "rel": "WORLD",
  "volume": {
    "numer": "3",
    "denom": "2"
  },
  "price": {
    "numer": "2",
    "denom": "1"
  }
}

POST
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "HELLO",
  "rel": "WORLD",
  "volume": {
    "numer": "3",
    "denom": "2"
  },
  "price": {
    "numer": "2",
    "denom": "1"
  },
  "min_volume": "1"
}

POST
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "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
setprice
{
  "userpass": "RPC_UserP@SSW0RD",
  "method": "setprice",
  "base": "KMD",
  "rel": "TKL",
  "volume": {
    "numer": "4",
    "denom": "3"
  },
  "price": {
    "numer": "7",
    "denom": "12"
  },
  "save_in_history": false
}