Documentation
Markets
An explanation of what Markets are, and how they are used.
The Definition of a Market
A market is a venue where traders meet to negotiate the exchange of one tradeable item for another.
Markets were once physical locations where traders met face to face, shouted their orders and hoped that someone would hear them and want to trade. This method was known as "Open Outcry", and access was tightly controlled, usually allowing approved brokers only. With the advent of the IT era, these markets were superseded by electronic markets. The shouts of the traders became anonymous electronic messages, and the best orders were ranked, and could be seen by all traders at the same time.
This system generalises the idea of an electronic market so that it can apply to any two Tradeable Items. You can run your own Markets, either routing all Orders from your own applications or gathering a group of Users together to trade with them.
Terminology and Jargon
Markets are rife with an evolved terminology and a lot of jargon. This section explains many of the terms commonly used in electronic market trading.
In this section, let us use an example to make the explanations clearer. A Market is defined between two Tradeable Items, so let us use an example Market for Apples priced in US Dollars.
Tradeable Items
A Market is a place to exchange an amount of one item for an amount of another. Each of the two things we swap is called a Tradeable Item. For a Market to work, each Tradeable Item must be commoditised, and this means that only the amount of the item matters, not the individual items themselves.
In our example, Apples are an agricultural product, with a particular variety or quality grade. The idea is you buy and sell amounts of these apples; you do not pick which to buy or sell. Similarly, US Dollars are standard and interchangeable; you do not care which individual dollar bills you receive, only the amount.
Transactional and Settlement Tradeables
When we define a Market, there are always two Tradeable Items, and one is stated before the other. The first item is termed the Transactional Item, and the Orders to buy and sell are stated relative to the Transactional Item. The second item is termed the Settlement Item, and this is what is exchanged in the opposite direction.
In our Apples for US Dollars Market, Apples are the Transactional Item, and US Dollars are the Settlement Item. When a trader puts in an Order to buy, they mean they wish to receive Apples, and in return to give US Dollars. Prices quoted for the Market are expressed as the amount of the Settlement Item required per unit of the Transactional Item. In this example, that is the amount of US Dollars required to buy or sell one Apple.
Whilst this might seem obvious in an Apples for US Dollars market, it is less obvious in a Currency market or a Swap market. A Currency Market exchanges one currency for another, and here the Transactional and Settlement Items are similar, and the orientation of the Market must be well known and understood by all traders. Similarly, a Swap Market may exchange two Tradeable Items, neither of which is a currency, like an Apples for Oranges market. Again, it is important to know which item is considered the Transactional Item.
Orders
Orders are instructions from traders to buy or sell amounts of the Transactional Item (first item). Buy Orders are often called "Bids", and Sell Orders are called "Offers", and the Buy-Sell terminology is often used interchangeably with Bids-Offers.
Orders can be very simple, or very complex, depending on the strategy of the trader. MARKET Orders are simple Orders to buy or sell without a price restriction. LIMIT Orders have price restrictions; for a Buy Order, the limit sets the maximum price the trader is willing to pay, and for a Sell Order the limit sets the minimum price that the trader is willing to receive.
Working Orders are available to match to other working Orders on the other side of the Market. Orders might be suspended, awaiting a triggering condition that turns them into a working Order. They can also have a lifespan that determines how long the Order is allowed to stay working.
Prices
Price data for a Market shows the working Orders that have limit prices. The limit prices are grouped into Buys and Sells. Orders with the same or similar prices are grouped together, and the total amount at the price level is displayed.
The prices are ranked, best to worst. The best Buy Order is the Order with the highest price, and the best Sell Order is the Order with the lowest price. Only the top 'n' price levels for each side are displayed, usually the top 5 Order price levels. Price data is limited to the top 'n' price levels because the best Orders, ranked first, are always going to trade before the lower ranked Orders. As you go down the ranking, the Orders are "further away from the market" and less likely to trade. This setting is termed the Market "depth".
Price data is anonymous, and updated in real time. Data showing historical price changes is also available.
Also included in the price update is the last traded price and last traded transactional amount. The idea is that the price data is enough to show, at minimum, the best bid and offer, and the last successful trade. The optional extra price levels, showing Orders further away from the Market, give a trader a picture of the "pressure" on either side.
Market State
A Market is OPEN, or in state OPEN, when it is receiving Orders, trying to match them, and creating Prices.
A Market can be in CLOSE state, and in this state it rejects Orders, and does not try to match, and provides no Prices.
The ACCEPT state is also sometimes known as PRE-OPEN. In this state, a Market will accept Orders, generate Price updates to show those Orders, but not actually match the Orders. This state allows a Market to settle on a price before trading actually begins, and it is useful in situations where there is no consensus between traders on what the fair price is. For example, perhaps a new product is being launched. The Market could be in ACCEPT state for a period to allow early adopters to bid or offer without risk, and remove their Orders if they realise they have bid or offered incorrectly, before the Market moves to OPEN state at a declared point in time.
The HALT state freezes a running Market, and it is used to deal with potentially chaotic situations. Orders in the Market stay working, but are not matched. New Orders are not accepted. In this frozen state, Administrators can manage Orders or deal with problems, without the Market jumping around. Once the problem is rectified, the Market can be moved back to the OPEN state.
The BLOCKED state removes a Market from the system, and is used by Administrators to take a problematic Market offline.
The User who creates the Market becomes the Owner and can change the Market state as needed, unless the Market is BLOCKED. Only Administrators can take a Market out of BLOCKED state.
Price Negotiation vs Settlement
Price Negotiation (sometimes also called Price Discovery) is the process of finding two Orders that agree on the amount to trade and the price to trade at. Settlement is then the process of carrying out that agreement by transferring the Transactional Item in return for the Settlement Item.
This system draws a line in the sand between the two. The matching price is negotiated and an agreement is reached between two counterparties, but Settlement does not automatically occur. It is possible to track the progress of Settlement, but this system does not perform the Settlement.
Performing Settlement would require maintaining accounts in the Tradeable Items and verifying that transfers of those Tradeable Items actually occurred. As this system has abstracted the market mechanics away from the items being traded, it would be impossible for the exchange to hold an account for every conceivable Tradeable Item. Users would have to lodge funds with the exchange, and commit to delivery of traded goods.
Additionally, the idea is that your business is routinely taking care of Settlement on a daily basis by another name, "fulfilment". When you supply goods to a customer and take their payment, you are performing Settlement. This system allows the price to be negotiated, but leaves fulfilment to the Market Owner. Your business discovers the fair price the customer wants to pay, and then you go through fulfilment as normal, except at the negotiated price.
Creating Your Markets
To create your own Markets, you would need to set up one or more Tradeable Items to represent the product, goods, services, assets or contracts that are relevant to your business domain.
Once you have that, the simplest route is to set up a Market that has your Tradeable Item as the first Transactional Item, and your local currency as the Settlement Item.
You receive a free allowance equivalent to the use of one Market every day. This is to allow Users going through a proof-of-concept stage to assess the system and see if it suits their needs, without incurring costs. You can submit as many Orders and create as many Fills on this Market as you need, and run it indefinitely. Beyond your first free Market, usage is charged proportionally to the number of Markets running, and the Orders and Fills they generate.
Anatomy of a Market
When you define a Market, you have control of the following parameters:
- Name: A short name, intended to communicate the two Tradeable Items exchanged in the Market.
- Description: Longer text that you can use to include more detailed information, or links to product definitions on your website, legal qualifiers and disclaimers.
- Tradeable_A_PK: The unique identifier for the Transactional Tradeable Item.
- Tradeable_B_PK: The unique identifier for the Settlement Tradeable Item.
- Algo (Optional): The matching algorithm for prioritising matching, either FIFO or BIG, with FIFO as the default.
- Expiry (Optional): A point in time in the future after which the Market is invalid and is automatically closed.
- MaxPx and MinPx (Optional): Limits on the possible accepted Order prices.
- Dec_Places_Px (Optional): Decimal precision to quote prices to, defaults to 2.
- Depth (Optional): Price levels to display, defaults to 5.
Tradeable_A_PK and Tradeable_B_PK
A Market is always defined between a Transactional Tradeable Item and a Settlement Tradeable Item. When configuring a Market, the Transactional is termed "A", and the Settlement is termed "B", as shorthand. The Tradeable Items are identified using their unique identifiers. These unique identifiers are returned to you when you create or view a Tradeable Item.
Algo
Orders are matched based on the best bid or offer price. When there are two Orders with the same price, there are optional rules to choose which should be prioritised.
The FIFO algo value sets the Market to use "First In, First Out" matching. When two Orders have the same price, the Order which arrived at the Market first is matched first. This is the most common method in most contemporary markets, and is the default if no algorithm is specified.
The BIG algo value sets the Market to use "Biggest First" matching. When two Orders have the same price, the Order with the largest initial volume (amount of transactional item) is matched first. This is so that Markets can prioritise the most active traders, the whales, at the expense of the smaller traders, the minnows.
This setting can be changed whilst the Market is open and running.
Expiry
The optional Expiry setting allows you to set a point in the future (as a combination of date and time, in UTC) beyond which the Market should be closed, and will not be allowed to open again.
Some Markets may be for ticketed events, and should not be used once the event has passed. Tradeable Items like Futures Contracts have an expiry date, after which the contract is invalid. You may have Tradeable Items that are time-dependent, and you can use the Market Expiry setting to ensure that trading is not allowed after your expiry date. Also, if a Market contains a Tradeable Item that has an Expiry set, the Market will close at the Tradeable Item's expiry date. If there is more than one Expiry date, for example from a Tradeable Item and the Market itself, the earliest date is used as the effective Expiry.
The settings can be changed whilst the Market is open and matching. Due care should be taken to ensure that the expiry date is in the future, as setting a date in the past will cause the Market to immediately close.
MaxPx and MinPx
Traders can make mistakes, and enter Orders with very high or very low prices by accident (the "fat finger" problem). The optional MaxPx and MinPx settings can be used to block Orders from the Market that are above MaxPx or below MinPx.
These settings become guardrails, to prevent volatile Markets from spiking unnaturally. You can use either one, both or neither of them to control the Market as you need. If no values are set, all Order prices are allowed into the Market.
The settings can be changed whilst the Market is open and matching.
Dec_Places_Px and Depth
In this system, Orders are "ticked" on the Tradeable Item amounts in the Order, rather than the price. Prices are "unticked" and can be any number of decimal places in precision.
The Dec_Places_Px setting controls how Orders are grouped into one price level. The high-precision prices are rounded to the number of decimal places set in Dec_Places_Px, and then grouped on their rounded price when being displayed.
Usually the Dec_Places_Px setting will be the resolution of the Settlement Tradeable Item. In the case of US Dollars for example, the smallest unit is the cent, or 0.01 of a Dollar, and this would imply a Dec_Places_Px value of 2 decimal places.
However, you could show prices to a tenth, hundredth or thousandth of a cent, if this made sense for your business use case. Conversely, you could show prices to the nearest ten cents, or whole dollars. You have the control to do what works best for you.
The Dec_Places_Px setting will affect how Orders are grouped into price levels. This may have an impact on how many levels of price data, Depth, you choose to display in prices for your Market.
You can change both of these settings whilst the Market is open and matching. Traders should probably be advised of such changes in advance, as their price data will change and might be confusing if the reason for the change was not understood.
Permissions and Privacy
Markets and Tradeable Items can be Private or Public. Any Markets or Tradeable Items created by a User default to being Private to that User only.
The creator of these resources becomes the Owner of the resource. The Owner can grant access privileges to other Users, allowing them to create Markets with the Owner's Tradeable Items, or to view and trade on the Owner's Markets.