📖OrderBook
Order Book Contract is the main contract responsible for holding all information regarding orders as well as executing those orders via the help of the Margin ledger.
Last updated
Order Book Contract is the main contract responsible for holding all information regarding orders as well as executing those orders via the help of the Margin ledger.
Last updated
Struct Position is used to store data regarding the position.
Type | Name | Description |
---|---|---|
Structure to store information about any Limit Order
Type | Name | Description |
---|---|---|
function fetchOrder(uint256 _orderId)
Returns the MakerOrder
structure for any given order ID.
Return Value : Maker Order
function getQuoteLot()
Returns the QuoteLot for the given market.
function fetchOrders(uint256[] _orderIds)
Returns the order structure for a given set of Order IDs.
function checkForAnyOpenOrder(address _user)
Returns true
if the address has any open limit order.
function addMakerOrder(bytes _orderData)
Function call to add a Limit order.
Ensure Sufficient Margin balance before calling this function!
Any given address can maintain a maximum of 5 limit orders at any point.
Params need to be encoded in the format :
function removeOrder(uint256
orderId
)
Function to remove any given order using its unique order ID.
Ensure that the address sending the transaction is the maker of the given order
Params:
function removeOrderByAddress(address maker)
Function to remove all orders for a given maker using his address.
Params :
Param Name | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
uint256
price
Price at which position was opened.
uint256
amount
Amount of underlying being sold/bought .
bool
isBuy
True = Long / False = Short
address
maker
Address of the user who put in the Limit Order.
uint256
timestamp
Limit Order creation timestamp.
uint256
orderId
Unique Order ID for the given Limit Order.
position
Limit Order Position Information.
maker
address
User Address.
amount
uint256
Amount of Asset to Long/Short.
price
uint256
Price of the Limit Order
isBuy
boolean
Side of the order. True=Long/ False=Short
orderId
uint256
Order ID of the Limit Order to be deleted.
maker
address
User address