API

How to setup

What are the api services

How to add a service

What are needed before running

  1. Creating a Virtual Environment

    sudo apt update
    sudo apt install python3.12-venv
    python3 -m venv /home/ubuntu/myenv
  2. Automatically Activating the Virtual Environment

nano ~/.bashrc
source /home/ubuntu/myenv/bin/activate #add this code at the end of .bashrc file
source ~/.bashrc
  1. Git Cloning the Repository under the Branch feat/standalone-signer

Ask the administrator for permission

https://github.com/spherex-code/spherex-openapi-demo

  1. Initiating Setup Files in the Directory /spherex-openapi-demo

Copy

  1. Running Demos in the Directory /spherex-openapi-demo/tests

Substituting Your Testnet or Mainnet gRPC Path in Demo Files(ask the administrator for grpc paths)

  1. you can find all services

  1. There are 22 services, for example

For example, OrderServices(you can create batch order and cancel orders using this service)

https://github.com/spherex-code/spherex-protos/blob/main/protos/spherex/trade/order_rpc.proto

Quote Services(you can find market data and account position using this service)

https://github.com/spherex-code/spherex-protos/blob/main/protos/spherex/quote/quote_rpc.proto

  1. Adding a service

If you want to get open/active orders by account, you can first find the catagory(Account/Order/Quote/Trade etc.) and the service, then add the service.

What needs to be prepared before running

  • VPN or A Server

  • A permission for a github repo

  • An valid grpc path with a whitelisted ip

  • Account_id/L2_keys

Batch order demo

Last updated