Skip to main content
POST
Purchases collateral from a running auction on the market’s auction venue. The bidder pays in the market’s borrow asset and receives the security tokens. The cost is the collateral quantity multiplied by the auction’s live declining price, rounded up to the next base unit of the borrow asset. Bids can be partial. Buy any quantity up to collateralRemaining, and the auction stays open for the rest until its end time.
The buyer receives a security token, so the token must admit them. Delivery is an ordinary compliance-gated transfer: if the token refuses the bidding wallet, the whole bid reverts and no money moves. Name the bidding wallet as bidder to have the token asked first: a wallet it refuses is answered with 409 BIDDER_CANNOT_RECEIVE instead of calldata. Without bidder the API does not check the wallet, so confirm it is a verified holder on the token’s identity registry before submitting.

When a Bid Reverts

The API prices the bid and refuses auctions that are closed or past their end time. It checks the wallet only when bidder is supplied, and nothing about the market beyond that. The venue reverts the bid in each of these cases:
  • The market is paused.
  • The market’s oracle price is stale. The auction’s schedule was fixed when it opened, but the venue still demands a fresh price. Push one through Sync Oracle Price first.
  • The bidding wallet is the borrower whose collateral is on sale. A borrower cannot buy back their own seized collateral. With bidder, the API refuses this with SELF_PURCHASE_NOT_ALLOWED.
  • The auction reached its end time between quoting and mining.
  • The wallet lacks the payment, or the allowance from the first step. With bidder, a short balance is refused with INSUFFICIENT_BALANCE.

Path Parameters

string
required
The market’s record ID, as id on List Markets, not its contract address. See Market IDs.

Body Parameters

integer
required
Auction ID on the market’s venue. Must be a positive integer sent as a JSON number. Required on the confirm call too.
string
required
Collateral to purchase, as a decimal string in collateral token units, with no more decimals than the collateral token has. Must be greater than zero. Required on the confirm call too, although the confirmation reads the purchased amount from the receipt.
string
The wallet that will sign the bid, 0x followed by 40 hex characters. When supplied, the bid is checked against it before any calldata is built. The auction’s borrower is refused with SELF_PURCHASE_NOT_ALLOWED, a borrow asset balance below estimatedCost with INSUFFICIENT_BALANCE, and a wallet the collateral token refuses to receive the collateral from the venue with BIDDER_CANNOT_RECEIVE. When the wallet’s allowance to the venue already covers estimatedCost, the approve step is left out. A balance, allowance or token verdict that cannot be read refuses nothing, and the approve step stays. Not used on the confirm call.
string
Hash of the bidOnAuction transaction you broadcast. Send it with the same auctionId to confirm the bid and record the result. Omit it to receive the calldata.

Sign the Two Steps

Without txHash the response is SIGN_TRANSACTIONS with two steps, or with the bid alone when the allowance of bidder already covers it. Sign them from the bidding wallet, in order, because the venue pulls the payment from the wallet that calls it.
1

Approve the venue

approve on the borrow asset, naming the auction venue as spender, for estimatedCost. The venue collects the payment, not the market. Left out when the allowance of bidder to the venue already covers estimatedCost.
2

Bid

bidOnAuction on the venue, for the clamped collateralAmount. Confirm with this step’s hash, which confirmStepIndex names.

What the Closing Bid Settles

The venue forwards each payment to the market straight away, and the market holds it against the liquidation record until the auction closes. The bid that buys the last unit closes the auction. In that same transaction the market settles the record over everything the auction raised. The market keeps at most what the whole position owed at seizure, plus the liquidation penalty (the term penalty on a term realization). Anything above that goes to the borrower, or is escrowed on the market when the settlement token (stablecoin) refuses the transfer. If the proceeds fall short of the record’s claim, the market draws the insurance fund for the gap. Only principal the fund could not cover is booked against the liquidity pool. Only the confirmation of that closing bid carries auctionSettled: true with the settlement figures. Collateral still unsold at the end time is not settled by any bid; it moves to the liquidation router through Settle Expired Auction.

Response Fields

object
A bid larger than the collateral left is clamped to what remains, and the API prices the clamped amount. collateralAmount and estimatedCost in the response are therefore what the bid will cost, which can be less than you asked for.
The price is read at execution, not at quote time, and it only falls. Another bidder can also take part of the lot first, which shrinks what yours buys. The amount actually paid is therefore at or below estimatedCost, never above, and the approval always covers it.

Error Codes

Confirming with txHash can also return any transaction verification error.