Python & Typescript SDKs

Introduction

This guide is intended for participants of our Dexterity Beta to programmatically connect to the market and start trading. Note that participation to our beta program requires a whitelist token. Please get in touch on Discord if you are interested in joining the program.

Connectivity

While we eventually plan to host or provided self hosted REST/Websocket access to the market, currently the only provided mechanisms via which to connect are a Python & a Typescript SDK. Both of these are available in the usual library repositories.

Some technical bits

You can find a much more in-depth technical description in the dexterity whitepaper, for the purposes of connecting it's important to understand two fundamental concepts in dexterity, that of the market product group and trader risk group. The market product group (MPG) represents a selection of actively traded products where cross-margining can take place. Products are dynamic in the sense that some products in a group will expire and new ones will get created, obviously some like a perpetual future can exist in perpetuity. The MPG is generally created and maintained by the network. The trader risk group (TRG) represents the trader's deposits, orders, positions and overall risk in the instruments of a specific MPG. This should be created by the trader as it will be linked to the trader's wallet.

Creating a TRG and accessing the market

Discovery steps

  • Find out the program ids being used in the deployment from the Hxro team. The programs you will need the ids of are:

    • DEX

    • AGNOSTIC_ORDERBOOK

    • RISK_ENGINE

    • FEES

    • INSTRUMENTS

  • Then also find out what the current MPG being used in the beta is.

Python SDK

Install via Pypi and follow instructions provided here

Typescript SDK

Install via NPM and follow instructions provided here

Last updated