IOrderbook
Last updated
Last updated
This interface defines the functions that can be called on the Orderbook contract. These functions provide various operations related to initializing the orderbook, managing orders, retrieving orderbook information, and executing trades.
initialize
Initializes the orderbook with the specified ID, base asset, quote asset, and engine address.
Name | Type | Description |
---|---|---|
fpop
Removes and returns the first order from the orderbook at the specified price.
Name | Type | Description |
---|---|---|
setLmp
Sets the last matched price (LMP) of the orderbook.
mktPrice()
Retrieves the market price of the orderbook.
assetValue
Converts the specified amount of base or quote asset to its corresponding value in the other asset.
isEmpty
Checks if the orderbook at the specified price is empty.
getRequired
Retrieves the required amount to execute the specified order at the given price.
placeAsk
Places an ask order in the orderbook with the specified owner, price, and amount.
placeBid
Places a bid order in the orderbook with the specified owner, price, and amount.
Parameters
cancelOrder
Cancels the specified order in the orderbook.
execute
Executes the specified order at the given price and amount.
heads()
Retrieves the head of the bid and ask orderbooks.
askHead()
Retrieves the head of the ask orderbook.
bidHead()
Retrieves the head of the bid orderbook.
getPrices
Retrieves the prices from the orderbook.
getOrders
Retrieves the orders from the orderbook at the specified price.
getOrder
Retrieves the order from the orderbook with the specified ID.
getOrderIds
Retrieves the order IDs from the orderbook at the specified price.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Variable | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
id
uint256
The ID of the orderbook.
base_
address
The address of the base asset in the pair.
quote_
address
The address of the quote asset in the pair.
engine_
address
The address of the engine contract.
isBid
bool
Flag indicating whether the order is a bid (true) or ask (false).
price
uint256
The price at which the order is placed.
orderId
uint256
The ID of the removed order.
lmp
uint256
The last matched price.
mktPrice
uint256
The market price of the orderbook.
amount
uint256
The amount of the asset to convert.
isBid
bool
Flag indicating whether the asset is a bid asset (true) or ask asset (false).
converted
uint256
The converted value of the asset.
isBid
bool
Flag indicating whether the orderbook is a bid orderbook (true) or ask orderbook (false).
price
uint256
The price at which to check.
isEmpty
bool
Flag indicating if the orderbook at the specified price is empty.
isBid
bool
Flag indicating whether the order is a bid (true) or ask (false).
price
uint256
The price at which the order is placed.
orderId
uint256
The ID of the order.
required
uint256
The required amount to execute the order.
owner
address
The address of the order owner.
price
uint256
The price at which to place the ask order.
amount
uint256
The amount of the ask order.
owner
address
The address of the order owner.
price
uint256
The price at which to place the ask order.
amount
uint256
The amount of the ask order.
orderId
uint256
The ID of the order to cancel.
isBid
bool
Flag indicating whether the order is a bid (true) or ask (false).
owner
address
The address of the order owner.
remaining
uint256
The remaining amount of the canceled order.
base
address
The address of the base asset of the canceled order.
quote
address
The address of the quote asset of the canceled order.
orderId
uint256
The ID of the order to execute.
isBid
bool
Flag indicating whether the order is a bid (true) or ask (false).
price
uint256
The price at which to execute the order.
sender
address
The address of the sender executing the order.
amount
uint256
The amount to execute.
owner
address
The address of the order owner.
bidHead
uint256
The head of the bid orderbook.
askHead
uint256
The head of the ask orderbook.
askHead
uint256
The head of the ask orderbook.
bidHead
uint256
The head of the bid orderbook.
isBid
bool
Flag indicating whether to retrieve prices from the bid orderbook (true) or ask orderbook (false).
n
uint256
The number of prices to retrieve.
prices
uint256[] memory
An array of prices retrieved from the orderbook.
isBid
bool
Flag indicating whether to retrieve orders from the bid orderbook (true) or ask orderbook (false).
price
uint256
The price at which to retrieve orders.
n
uint256
The number of orders to retrieve.
orders
NewOrderOrderbook.Order[] memory
An array of orders from the orderbook.
isBid
bool
Flag indicating whether to retrieve the order from the bid orderbook (true) or ask orderbook (false).
orderId
uint256
The ID of the order to retrieve.
order
NewOrderOrderbook.Order
The order from the orderbook.
isBid
bool
Flag indicating whether to retrieve order IDs from the bid orderbook (true) or ask orderbook (false).
price
uint256
The price at which to retrieve order IDs.
n
uint256
The number of order IDs to retrieve.
orderIds
uint256[] memory
An array of order IDs from the orderbook.