> For the complete documentation index, see [llms.txt](https://docs.tanx.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tanx.fi/tech/api-documentation/sdk-reference/python-sdk.md).

# 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](/tech/api-documentation/account/generating-l2-key-pairs.md) 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tanx.fi/tech/api-documentation/sdk-reference/python-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
