Listing orders and trades

Orders and Trades

Introduction

In order to track your orders and trades on Vega there are several APIs available. An order may have zero or more related trades and a trade will have exactly one related buy order and one related sell order.

The following examples show how easy it is to retrieve orders and trades on Vega, as well as answers to common questions.

Listing orders on a market

Connect to a Vega API server, and request orders on a market:

See the how-to guide for Market information to learn how to get a list of market identifiers on Vega.

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
orders A list of zero or more orders for the market specified.
For full example code, please visit the repo on GitHub.

Listing orders for a party (public key)

Connect to a Vega API server, and request orders for a party:

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 for a party:

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
orders A list of zero or more orders for the party specified. A party is normally represented by a public key.
For full example code, please visit the repo on GitHub.

Listing trades for an order

Connect to a Vega API server, and request trades for an order:

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 trades for an order:

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
trades A list of zero or more trades for the party specified. A party is normally represented by a public key.
For full example code, please visit the repo on GitHub.

Listing trades on a market

Connect to a Vega API server, and request trades on a market:

See the how-to guide for Market information to learn how to get a list of market identifiers on Vega.

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 trades on a market:

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
trades A list of zero or more trades for the market specified.
For full example code, please visit the repo on GitHub.

Where do I find the fees charged for a trade?

Any fees charged on Vega are shown on individual trades returned by the API. For example, on each trade there are the following fields:

Field Description
buyerFee Any fees for the party on buy side of the trade, also known as the buyer.
sellerFee Any fees for the party on sell side of the trade, also known as the seller.
  "buyerFee": {                                  "sellerFee": {
     "infrastructureFee": "37963",                  "infrastructureFee": "0",
     "liquidityFee": "75926",                       "liquidityFee": "0",
     "makerFee": "18982"                            "makerFee": "0"
  }                                              }
Fee values are in the settlement currency with decimal precision (DP) for the market the trade occurred on.

Contained inside each of the buyer and seller fee structures are the fees charged:

Field Description
infrastructureFee Fees paid to validators as a reward for running the infrastructure of the network.
liquidityFee Liquidity portion of the fee is paid to market makers for providing liquidity, and is transferred to the market-maker fee pool for the market.
makerFee Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).

Fees are incurred on every trade on Vega, but it is the price taker who pays the fee. The price taker only sees one fee. The price taker is the party that traded using a market order, or placed a limit order that traded immediately. See the explainer section on Market and trading info to learn more on how fees are calculated, and who gets the fees.

What’s next?