Python SDK

This package facilitates the use of the tanX (previously Brine.fi) APIs.

tanX Python Connector includes utility/connector methods which can be used to interact with the tanX API.

Please check out the full implementation herearrow-up-right to find all the rest api methods, web-socket methods and examples.

Installation

First go to the tanX websitearrow-up-right and create an account with your wallet.

Install the package using pip.

pip install tanx-connector

Usage

Check out the examplearrow-up-right files to see the complete workflow.

Quickstart:

Make sure that tanxconnector is installedarrow-up-right and up-to-date. Also make sure you have an account on the mainnetarrow-up-right or testnetarrow-up-right website. To get quickly started, try running the simple example for creating and fetching the order once logged in. For the stark_private_key, kindly see the L2 Key Pair section of the documentation.

from tanxconnector import Client

ETH_ADDRESS = "(your eth wallet address)"
ETH_WALLET_PRIVATE_KEY = "(your wallet's private key)"
STARK_PRIVATE_KEY = "(stark private key from the L2 Key Pair)"

client = Client()

# login to the network
login = client.complete_login(ETH_ADDRESS, PRIVATE_KEY)

# create an order nonce
nonce: CreateOrderNonceBody = {'market': 'ethusdc', 'ord_type':'market', 'price': 29580.51, 'side': 'sell', 'volume': 0.0005}

# create the order
order = client.create_complete_order(nonce, STARK_PRIVATE_KEY)
print(order)

# fetch the details of the order just created
order_id = order['payload']['id']
fetch_order = client.get_order(order_id)
print(fetch_order)

Github repo

Please find the complete implementation herearrow-up-right with documentation and examples

Last updated