Liquidity provision

Introduction

Liquidity Provision (LP) on Vega is designed to incentivise participants to place orders on the market that maintain liquidity on the order book. To learn more about the mechanics of LP on Vega please see the section on Providing liquidity for markets.

How do I provide a liquidity commitment?

Connect to a Vega API server, and provide a liquidity commitment:

1. Log in to wallet and get public key

See the section on the Wallet service to learn how to log in, list keys and select a public key.

For a working wallet example used by this how-to guide, please visit the API Samples GitHub repo.

2. Choose a market and ensure account/asset balance

In order to provide liquidity on a target market, the account balance for the settlement asset on the related public key (party) should be positive and sufficient to cover the commitment.

For more information on how to deposit an asset into Vega, see the section on How to deposit tokens to use on Vega or the guide in the Vega Bridge GitHub repo.

3. List all liquidity provisions for the market

Connect to a Vega API server, and request all liquidity provisions for the specified 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.

See also gRPC API reference for further query detail.

If successful, the response will include:

Field Description
liquidityProvisions A collection of liquidity provision data for the specified market. See below more information on each value.
For full example code, please visit the repo on GitHub.
Field information
Id – A unique identifier for the liquidity provision.
Party Id – The unique identifier of the party which submitted the liquidity provision.
Created At – A timestamp for when the liquidity provision was created at, in nanoseconds since the Unix epoch.
Updated At – A timestamp for when the liquidity provision was updated at, in nanoseconds since the Unix epoch.
Market Id – The unique market identifier for the data returned.
Commitment Amount – Specified as a unitless number that represents the amount of settlement asset of the market.
Fee – Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market, as per setting fees and rewarding liquidity providers.
Sells – A set of liquidity sell orders which may get deployed automatically to assure the liquidity provision obligation is always met.
Buys – A set of liquidity buy orders which may get deployed automatically to assure the liquidity provision obligation is always met.
Version – Version of the liquidity commitment transaction (incremented with every re-submission).
Status – Status of the liquidity commitment transaction.
Reference – A reference shared between this liquidity provision and all its orders.

4. Compose a liquidity commitment submission message

When submitting a liquidity commitment message, the following fields must be specified:

  • market identifier,
  • commitment amount,
  • proposed liquidity fee,
  • a set of liquidity buy and sell orders

Please see Providing liquidity for markets for details. Please note that the request will be rejected if the message is invalid. This could be because of the market state, the message is formatted incorrectly, or the requested liquidity commitment cannot be supported with your current balance in the market settlement asset.

Gitpod ready-to-code What’s Gitpod?

5. Compose a liquidity commitment amendment message

If the liquidity commitment message has already been submitted successfully, submitting a subsequent message will serve as either an amendment or cancellation. To amend, keep liquidityCommitment positive (unchanged to leave as is) and modify any fields which should be amended.

Please note that the request will be rejected if the message is invalid, and the liquidity commitment will stay as is. This could be because of the market state, the message is formatted incorrectly, or the requested liquidity commitment cannot be supported with your current balance in the market settlement asset.

Gitpod ready-to-code What’s Gitpod?

6. Compose a liquidity commitment cancellation message

If the liquidity commitment message has already been submitted successfully, submitting a subsequent message will serve as either an amendment or cancellation.

To cancel, set liquidityCommitment to 0.

Please note that the cancellation message will be rejected if the message is invalid, and the liquidity commitment will stay as is. This could be because of the market state, the message is formatted incorrectly, or the requested liquidity commitment cannot be supported with your current balance in the market settlement asset.

Gitpod ready-to-code What’s Gitpod?

7. Sign and send the transaction

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.

See also REST API reference for further query detail.

If successful, the response will include:

Field Description
signature A signed transaction message containing the liquidity commitment submission data. Because propagate is set to true, the signed data will be automatically forwarded by the wallet server to a node. If you wish to manually submit the transaction you can do so with the data in signature (tx) and set propagate to false.
For full example code, please visit the repo on GitHub.

What’s next?