# Python SDK

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

Please check out the full implementation [here](https://pypi.org/project/tanx-connector/) to find all the rest api methods, web-socket methods and examples.

## Installation

First go to the [tanX website](https://tanx.fi) and create an account with your wallet.

Install the package using pip.

```bash
pip install tanx-connector
```

## Usage

Check out the [example](https://github.com/brine-finance/brine-connector-nodejs/tree/main/example) files to see the complete workflow.

## Quickstart:

Make sure that tanxconnector is [installed](https://github.com/tanx-libs/tanx-connector-python#installation) and up-to-date. Also make sure you have an account on the [mainnet](https://trade.tanx.fi/) or [testnet](https://testnet.tanx.fi/) 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](https://docs.tanx.fi/tech/api-documentation/account/generating-l2-key-pairs) section of the documentation.

```python
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 [here](https://github.com/tanx-libs/tanx-connector-python) with documentation and examples
