Core Trading Functionality
close_sale<CURRENCY>(...)
and reopen_sale<CURRENCY>(...)
The SALE module provides a comprehensive set of functions to facilitate NFT trading using an order book model. These functions allow users to create and manage buy and sell orders, match orders automatically, and analyze market liquidity.
Core Trading Functionality:
Order Creation:
create_sell_order<CURRENCY>
: Allows users to create sell (ask) orders by specifying the NFTs to sell, quantity, and price per NFT.create_buy_order<CURRENCY>
: Enables users to create buy (bid) orders by specifying the desired quantity and maximum price per NFT.
Order Matching:
match_orders<CURRENCY>
: This function automatically matches compatible buy and sell orders based on price and time priority. It executes trades by transferring NFTs from sellers to buyers and payment from buyers to sellers.
Order Cancellation:
cancel_order<CURRENCY>
: Allows users to cancel their existing buy or sell orders.
Liquidity Analysis:
get_liquidity_metrics<CURRENCY>
: Calculates and returns key liquidity metrics for a given pool, such as total bid and ask volumes, market depth, and bid-ask ratio.get_liquidity_depth<CURRENCY>
: Provides a more detailed view of liquidity by analyzing price levels, order volumes, and weighted average prices.
Entry Points:
The following functions serve as entry points for interacting with the trading functionality:
create_trade_pool<CURRENCY>
: Creates a new NFT trading pool for a specific collection and currency. This is the initial step required to enable trading for a collection.create_sell_order<CURRENCY>
: Allows users to place sell orders into the order book.create_buy_order<CURRENCY>
: Allows users to place buy orders into the order book.cancel_order<CURRENCY>
: Enables users to cancel their existing orders.
These entry points provide a clear and well-defined interface for users to interact with the trading system. By utilizing these functions, users can participate in the NFT marketplace, create and manage orders, and contribute to the overall liquidity and price discovery process.
Last updated