Markets and Market Data

Introduction

Markets on Vega are defined by the Market framework (see Vega Whitepaper for explanation), it is one of the core features of the protocol and central to a design for flexibility. Markets can be proposed on a network and can be voted in using governance. Derivatives markets on a network are composed from a set of parameters and include a risk model.

Both market information and market data are queryable, the following guides show how to use the APIs:

Listing markets on a Vega network

Connect to a Vega API server, and request all markets:

Gitpod ready-to-code What’s Gitpod?

See also REST API reference for further query detail.

See also REST API reference for further query detail.

Make sure vegaapiclient is installed (from PyPI):

pip install --upgrade Vega-API-client

This Python snippet code shows how to query for a list of orders on a market:

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
markets A list of zero or more markets available on a Vega network.
For full example code, please visit the repo on GitHub.

Requesting market data

Connect to a Vega API server, and request the market data for a market:

Gitpod ready-to-code What’s Gitpod?

See also REST API reference for further query detail.

See also REST API reference for further query detail.

Make sure vegaapiclient is installed (from PyPI):

pip install --upgrade Vega-API-client

This Python snippet code shows how to query for a list of orders on a market:

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
marketData A collection of market data for the specified market. See below more information on each value.
For full example code, please visit the repo on GitHub.
Field information
Mark Price – A concept derived from traditional markets. It is a calculated value for the ‘current market price’ on a market.
Market – The unique market identifier for the data returned.
Best Bid Price – The highest price level on an order book for buy orders on the market.
Best Bid Volume – The aggregated volume being bid at the best bid price on the market.
Best Offer Price – The lowest price level on an order book for offer orders on the market.
Best Offer Volume – The aggregated volume being offered at the best offer price on the market.
Mid Price – The arithmetic average of the best bid price and best offer price on the market.
Static Mid Price – The arithmetic average of the best static bid price and best static offer price on the market.
Best Static Bid Price – The highest price level on the order book for non dynamic buy orders on the market.
Best Static Bid Volume – The aggregated volume being bid at the best static bid price on the market.
Best Static Offer Price – The lowest price level on an order book for non dynamic offer orders on the market.
Best Static Offer Volume – The aggregated volume being bid at the best static offer price on the market.
Auction Start – The auction starting timestamp (when in auction mode).
Auction End – The auction ending timestamp (when in auction mode).
Indicative Price – The price at which all trades would occur if the auction was uncrossed now (when in auction mode).
Indicative Volume – The volume at which all trades would occur if the auction was uncrossed now (when in auction mode).
Market Trading Mode – Continuous trading or auction mode.
Trigger – Price monitoring trigger (if available). A price monitoring trigger is constructed using a fixed horizon and probability level.
Target Stake – Target amount of stake committed relative to what is happening on the market. Currently based on open interest, which is the volume of all open positions.
Supplied Stake – The current stake supplied on the market.
Open Interest – The volume of all open positions in a given market (the sum of the size of all positions greater than 0).
Price Monitoring Bounds – The current bounds used for price monitoring, includes the price monitoring settings (trigger). The market will go into a price monitoring auction if generating a trade would result in a price that is larger than the theoretical bounds implied by the risk model and the market’s price monitoring settings. See the section on Market Monitoring for more detail.

What’s the difference between Market and Market Data?

Market information is the current static information/configuration of the markets available on a Vega network, where as Market Data is the latest data available from trading within the market itself. Information such as the settlement date of a future or the risk model will be found by querying for a Market. Data such as best bid price or open interest will be found in Market Data.

What’s next?