# OpenAPI

## 1 Apply app\_key

Open the website <https://zksync.satori.finance/tradeApi> and connect your wallet,

Click the button "Create API" and input your data, you can read the doc detail.

<figure><img src="/files/EmfAg1pAKsLA9EzWa9E6" alt=""><figcaption></figcaption></figure>

Get your API Key.&#x20;

<figure><img src="/files/UZ0fMLIDb55Zi4lg8VQg" alt=""><figcaption></figcaption></figure>

```
Note: the API Key need auth pass before it works. This may take some days.
```

## 2 Install the SDK

```
SDK path: https://github.com/satoridao/satori_openapi_sdk
```

Init the sdk config with your API key and your api address private key.

```
# config.ini
[keys]
base_url= https://openapi.satori.finance
ws_url= wss://openapi.satori.finance/api/market/ws
api_key= ${your api key}
api_secret= ${your api address private key}
```

## 3 Deposit USD into Satori

<figure><img src="/files/Z9uNTtjakXdeehuhgc3Q" alt=""><figcaption></figcaption></figure>

```
Note: The same address at different chain have different account in satori. Please choose the same chain with your api key you applyed.
```

After depositing, you can check your available balance from the web front or through the sdk.

example code:&#x20;

```
import json
​
from satori.client import Client
from examples.utils.prepare_env import get_env
​
if __name__ == '__main__':
    config = get_env()
    print(config)
    cs = Client(api_key=config["api_key"], api_secret=config["api_secret"], api_sign_type=config["api_sign_type"], base_url=config["base_url"])
    time = cs.time()["data"]
    print(json.dumps(cs.balance("USD", time), ensure_ascii=False))
```

## 4 Open orders

> Open orders

```
#!/usr/bin/env python
import json
​
from satori.client import Client,Order
from examples.utils.prepare_env import get_env
​
if __name__ == '__main__':
    config = get_env()
    cs = Client(api_key=config["api_key"], api_secret=config["api_secret"], api_sign_type=config["api_sign_type"], base_url=config["base_url"])
    time = cs.time()["data"]
    order1 = Order(str(time), True, False, 1, 1, "ETH-USD", 3, "0.02", "2000")
    print(json.dumps(cs.create_order(order1,str(time)), ensure_ascii=False))
```

> Cancel orders

```
#!/usr/bin/env python
import json
​
from satori.client import Client
from examples.utils.prepare_env import get_env
​
if __name__ == '__main__':
    config = get_env()
    cs = Client(api_key=config["api_key"], api_secret=config["api_secret"], api_sign_type=config["api_sign_type"], base_url=config["base_url"])
    time = cs.time()["data"]
    # print(cs.order_list("ETH-USD",time))
    print(json.dumps(cs.cancel_order(entrustId=178790278,timestamp=str(time)), ensure_ascii=False))
```

<br>


---

# Agent Instructions: 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:

```
GET https://docs.satori.finance/api-docs/openapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
