Oracles

If you're unfamiliar with oracles, start with the Ethereum Foundation's oracle overview for a comprehensive introduction.

All Standard Exchange orderbooks can serve as oracles, offering access to historical price and liquidity data. This capability unlocks a wide range of on-chain use cases.

Prices

In Solidity contracts, it is possible to retrieve the prices of an asset from the MatchingEngine contract of Standard Exchange. MatchingEngine contract is responsible for handling the matching of buy and sell orders for various assets on the Standard Exchange platform.

Within the order book of each asset, there are three different prices that can be accessed:

  1. Buy Price: The buy price represents the highest bid price for a particular asset. It indicates the maximum price at which a buyer is willing to purchase the asset. Traders who want to buy the asset can place bids at or below this buy price.

  2. Sell Price: The sell price corresponds to the lowest ask price for the asset. It represents the minimum price at which a seller is willing to sell the asset. Traders who wish to sell the asset can place asks at or above this sell price.

  3. Last Matched Price: The last matched price is the most recent price at which a buy and sell order were successfully matched and executed. It represents the price at which the last trade for the asset took place on the Standard Exchange platform. This price is updated whenever a new trade occurs.

By accessing these prices in the MatchingEngine contract, developers can build functionality that depends on the current market prices of assets. This can include displaying the current buy and sell prices to users, calculating market trends, or implementing automated trading strategies based on these prices.

Last updated