Store buy / sell trade

2 credits for API call, 2 credits for each fill of the counter trade. 1 API call + 2 fills = 6 credits.


Store new buy / sell trade. If there is trade already available to fill, fill as much trades as possible.
It is possible to charge fees for the trades. Fees are an extra amount on top of the trade amount and are paid in the currency that you going to block e.g.: - BUY BTC/USDT - fees will be paid in USDT - SELL BTC/ETH - fees will be paid in BTC

If you fill type of the trade with FUTURE_BUY or FUTURE_SELL the trade will behave as a trade future. The trade is concluded now but will be fulfilled in future. The date of fulfillment is by the “Seal Date” field. You can also block a percentage of the amount until the future trade has expired.

Futures can also penalize contracting parties if they don’t have the agreed balance available in their accounts. The penalty is calculated in the following way: Penalty amount = (Percentage of incomplete deal amount because of shortage from user) × (Maximum Penalty percentage of futures deal based on blocked amount and time interval) × (total blocked value).

Example of the BTC/USDT trade future:

The maker creates a sell with the following properties: 1 BTC at a price of 60000 USDT, with a blocking percentage of 22%, a penalty percentage of 45%, a system commision of 1% and with an expiration time of within 12 hours.

{
  "type": "FUTURE_SELL",
  "price": "60000",
  "amount": "1",
  "pair": "BTC/USDT",
  "currency1AccountId": "60a236db1b57f60d62612bf3",
  "currency2AccountId": "609d0696bf835c241ac2920f",
  "fee": 1,
  "feeAccountId": "609d0696bf835c251ac2920a",
  "attr": {
    "sealDate": 1621990960631,
    "percentBlock": 22,
    "percentPenalty": 45
  }
}

The taker accepts the offer with a buy and blocks 13200 USDT (60000 USDT × 0.22) in their account.

{
  "type": "FUTURE_BUY",
  "price": "60000",
  "amount": "1",
  "pair": "BTC/USDT",
  "currency1AccountId": "60a236db1b57f60d62612bf2",
  "currency2AccountId": "609d0696bf835c241ac2920a",
  "attr": {
    "sealDate": 1621990960631,
    "percentBlock": 22,
    "percentPenalty": 45
  }
}

At the time of the trade, the maker and taker have the following conditions. The maker has 0.65 BTC (35% deficit) in their account and the taker has 49200 USDT (18% deficit) in their account.

The maker penalty is equal to 0.35 × 0.22 × (0.45 × 1 BTC) = 0.03465 BTC. The taker penalty is equal to 0.18 × 0.22 × (0.45 × 60000 USDT) = 1069.2 USDT.

The system commission for the maker is 1 BTC × 1% = 0.01 BTC. The system commission for the taker is 60000 USDT × 1% = 600 USDT.

The maker’s assets after deducting penalties and commissions equals 0.65 - 0.03465 - 0.01 = 0.60535 BTC. The taker’s assets after deducting penalties and commissions equals 49200 - 1069.2 - 600 = 47530.8 USDT.

The amount received by the maker after the trade is (0.60535 × 60000) + 1069.2 = 37390.2 USDT and the taker receives 0.60535 + 0.03465 = 0.64 BTC.

Language
Authorization
Header
Click Try It! to start a request and see the response here!