tanX Docupaper
AboutTrade
  • ABOUT
    • ๐Ÿ“’tanX Docupaper
  • TECH
    • ๐Ÿ‘ฉโ€๐Ÿ’ปTech Docupaper
      • ๐ŸจHigh level architecture
      • ๐Ÿค”Starkware logic
      • ๐ŸŒŠTransactional flow
        • Off-chain accounts
        • The deposit flow
        • The withdrawal flow
        • The trade flow
        • The transfer flow
        • Full withdrawal
    • ๐Ÿ”ŒAPI Documentation
      • ๐Ÿ˜‹Getting started
        • Test connectivity
      • ๐Ÿ“ˆMarket
        • 24hr Tickers Price
        • K-line/Candlestick data
        • Orderbook
        • Recent trades
      • โ†”๏ธTrading
        • Create order
        • Get order
        • List orders
        • Cancel order
        • Bulk Cancel
        • List trades
      • ๐Ÿ”Account
        • Generating L2 Key Pairs
        • Login
        • Deposit
        • Withdrawal
        • Profile Information
        • Balance details
        • Profit and loss details
      • ๐ŸŒWeb-socket stream
        • ๐Ÿ—๏ธPrivate web-socket connection
        • ๐Ÿ‘ฅPublic websocket connection
      • โœจInternal Transfer
        • Create Internal Transfer
        • Get Internal Transfer
        • Check User Existence
        • List Internal Transfers
      • ๐ŸงชSDK Reference
        • NodeJS SDK
        • Python SDK
  • LEGAL
    • โ€ผ๏ธtanX Disclaimer
Powered by GitBook
On this page
  • Installation
  • Usage
  • Quickstart:
  • Github repo

Was this helpful?

  1. TECH
  2. API Documentation
  3. SDK Reference

Python SDK

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

PreviousNodeJS SDKNexttanX Disclaimer

Last updated 1 year ago

Was this helpful?

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

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

Installation

First go to the and create an account with your wallet.

Install the package using pip.

pip install tanx-connector

Usage

Check out the files to see the complete workflow.

Quickstart:

Make sure that tanxconnector is and up-to-date. Also make sure you have an account on the or 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 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 with documentation and examples

๐Ÿ”Œ
๐Ÿงช
here
tanX website
example
installed
mainnet
testnet
L2 Key Pair
here