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.

Get your API Key.

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

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:

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))

Last updated