NAV
shell python rust go javascript

Welcome

Welcome to the Syndr testnet API Documentation!

Overview

Syndr is an institutional-grade decentralized exchange for trading derivatives. Syndr enables traders to trade Options, Perpetuals & Futures on the same platform with no compromises, combining high-performance & high capital efficiency.

We currently support two different interfaces to access the API:

Support for FIX(Financial Information eXchange) is also planned and will be available in the future.

Syndr's testnet environment, dev.syndr.com, is currently in invite-only private phase and can be used to test our API.

Base API Urls

Base URLs for Syndr API endpoints are as follows:

For any questions, feedback and request for testnet UI access, reach out to [email protected].

Happy Trading!

Naming

Currency

Supported currencies on Syndr use the following naming system:

public/get_currencies method can be used to get all supported currencies.

Examples Comments
BTC Symbol of the ERC20 token


Instruments

Syndr's tradeable assets/instruments use the following naming system:

public/get_instruments method can be used to get all instruments.

Kind Examples Template Comments
Future BTC-25MAR16, BTC-5AUG16 BTC-DMMMYY BTC is currency, DMMMYYis expiration date, D stands for day of month (1 or 2 digits), MMM - month (3 first letters in English), YY stands for year.
Perpetual BTC-PERP Perpetual contract for currency BTC.
Option BTC-25MAR16-420-C, BTC-5AUG16-580-P BTC-DMMMYY-STRIKE-K STRIKE is option strike price in USD. Template K is option kind: C for call options or P for put options.


Index

Syndr's instrument indices use the following system of naming:

public/get_index_price_names method can be used to get all index names.

Examples
BTC/USD
ETH/USD
USDT/USD
USDC/USD
DAI/USD

JSON-RPC

Request Messages

According to the JSON-RPC specification the requests must be JSON objects with the following fields.

An example of request message

{
  "jsonrpc": "2.0",
  "id": 8066,
  "method": "public/ticker",
  "params": {
    // paramaters for the request message
  }
}
Name Type Description
jsonrpc string The version of the JSON-RPC spec: "2.0"
id integer or string An identifier of the request. If it is included, then the response will contain the same identifier
method string The method to be invoked
params object The parameters values for the method. The field names must match with the expected parameter names. The parameters that are expected are described in the documentation for the methods, below.

Response Messages

The JSON-RPC API always responds with a JSON object with the following fields.

Response Message structure:

{
  "jsonrpc": "2.0",
  "result": [],
  "id": 8066
}
Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result any The response of the message sent.
error error object Only present if there was an error invoking the method.


In case of an error the response message will contain the error field, with as value an object with the following with the following fields:

Name Type Description
code integer A number that indicates the kind of error.
message string A short description that indicates the kind of error.

JSON-RPC over websocket

Websocket is the preferred transport mechanism for the JSON-RPC API due to its low overhead, low latency, and support for high-frequency communication. The code examples, located next to each method, demonstrate how websockets can be utilized in Python to interact with Syndr's trading API.

API Key Setup

Script to generate the required signatures for the request

import traceback
from web3 import Web3
from eth_account.messages import encode_typed_data
from eth_account import Account
import json
import requests
import secrets
from dataclassy import dataclass
import aiohttp
import asyncio

class SigningKeyManager:
    def __init__(self, l3_public_client, l2_public_client):
        self.l3_public_client = l3_public_client
        self.l2_public_client = l2_public_client
        self.contract_address = None
        self.max_uint256 = int("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)


    async def fetch_contract_address(self):
        """Fetch the signing keys manager address from the API."""
        payload = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "public/get_l3_contracts",
            "params": {}
        }
        async with aiohttp.ClientSession() as session:
            async with session.post("https://dev-api.syndr.trade/api/v1", json=payload) as response:
                response_text = await response.text()
                if response.status == 200:
                    response_data = json.loads(response_text)
                    raw_address = response_data["result"]["signing_keys_manager_address"]
                    self.contract_address = Web3.to_checksum_address(raw_address)
                    print(f"Contract address set to: {self.contract_address}")
                else:
                    print(f"Failed to fetch contract address: {response_text}")
                    raise Exception("Failed to fetch contract address")


    def generate_private_key(self):
        """Generate a random private key"""
        return "0x" + secrets.token_hex(32)

    def private_key_to_address(self, private_key: str):
        """Convert private key to Ethereum address"""
        account = Account.from_key(private_key)
        return account.address

    def ensure_hex_prefix(self, hex_str: str) -> str:
        """Ensure the hex string has a '0x' prefix."""
        if not hex_str.startswith('0x'):
            return f'0x{hex_str}'
        return hex_str


    async def sign_typed_data_async(self, private_key: str, domain: dict, types: dict, primary_type: str, message: dict):
        """Sign typed data according to EIP-712"""
        try:
            structured_data = {
                "types": {
                    "EIP712Domain": [
                        {"name": "name", "type": "string"},
                        {"name": "version", "type": "string"},
                        {"name": "chainId", "type": "uint256"},
                        {"name": "verifyingContract", "type": "address"}
                    ],
                    **types
                },
                "primaryType": primary_type,
                "domain": domain,
                "message": message
            }
            print("Structured data is:", structured_data)
            account = Account.from_key(private_key)
            signable_message = encode_typed_data(full_message=structured_data)
            signed_message = account.sign_message(signable_message)
            return signed_message.signature.hex()

        except Exception as e:
            print(f"Error signing typed data: {str(e)}")
            raise

    async def GenerateApiKeySecret(self, wallet_address: str, wallet_private_key: str):
        try:
            """Initialize the manager by fetching the contract address."""
            await self.fetch_contract_address()
            abi_string = '''
            [
                {
                    "type": "function",
                    "name": "getVerifySigningKeyNonces",
                    "inputs": [
                        {
                            "name": "account",
                            "type": "address",
                            "internalType": "address"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "type": "function",
                    "name": "getSigningKeyRegisterNonces",
                    "inputs": [
                        {
                            "name": "sk",
                            "type": "address",
                            "internalType": "address"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "stateMutability": "view"
                }
            ]
            '''
            self.abi = json.loads(abi_string)
            self.contract = self.l3_public_client.eth.contract(
                address=self.contract_address,
                abi=self.abi
            )
            # Create a new signer
            signer_private_key = self.generate_private_key()
            signer_address = self.private_key_to_address(signer_private_key)

            # Get verify nonce
            verify_nonce = self.contract.functions.getVerifySigningKeyNonces(
                wallet_address
            ).call()

            # Create domain data
            domain_data = {
                "name": "Syndr",
                "version": "1",
                "chainId": 421614,
                "verifyingContract": self.contract_address
            }

            # First signature: SignKey
            signing_key_types = {
                "SignKey": [
                    {"name": "account", "type": "address"},
                    {"name": "nonce", "type": "uint256"}
                ]
            }

            signing_key_message = {
                "account": wallet_address,
                "nonce": verify_nonce
            }

            signing_key_signature = await self.sign_typed_data_async(
                private_key=signer_private_key,
                domain=domain_data,
                types=signing_key_types,
                primary_type="SignKey",
                message=signing_key_message
            )
            print("Signing key signature is:", signing_key_signature)

            # Get register signing key nonce
            register_nonce = self.contract.functions.getSigningKeyRegisterNonces(
                signer_address
            ).call()

            # Second signature: RegisterSigningKey
            register_types = {
                "RegisterSigningKey": [
                    {"name": "key", "type": "address"},
                    {"name": "expiresAt", "type": "uint256"},
                    {"name": "nonce", "type": "uint256"}
                ]
            }

            register_message = {
                "key": signer_address,
                "expiresAt": self.max_uint256,
                "nonce": register_nonce
            }

            account_signature = await self.sign_typed_data_async(
                private_key=wallet_private_key,
                domain=domain_data,
                types=register_types,
                primary_type="RegisterSigningKey",
                message=register_message
            )

            # Make API call
            async with aiohttp.ClientSession() as session:
                payload = {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "public/register_signing_key",
                    "params": {
                        "account": wallet_address,
                        "signer_public_address": signer_address,
                        "expires_at": str(self.max_uint256),
                        "signing_key_signature": self.ensure_hex_prefix(signing_key_signature),
                        "account_signature": self.ensure_hex_prefix(account_signature)
                    }
                }

                async with session.post(
                    "https://dev-api.syndr.trade/api/v1",
                    json=payload,
                    headers={
                        "Content-Type": "application/json",
                        "Accept": "application/json",
                        "User-Agent": "Python/3.9"
                    }
                ) as response:
                    response_text = await response.text()
                    print(f"API Response Status: {response.status}")
                    print(f"API Response Text: '{response_text}'")

                    if response.status != 200:
                        print(f"API Error: {response_text}")
                        return None

                    try:
                        if not response_text:
                            return {
                                "success": True,
                                "message": "Operation completed successfully",
                                "signer_public_address": signer_address
                            }

                        response_data = json.loads(response_text)
                        if "result" in response_data:
                            return {
                                "success": True,
                                "account": response_data["result"].get("account"),
                                "api_key": response_data["result"].get("api_key"),
                                "api_secret": response_data["result"].get("api_secret"),
                                "signer_public_address": response_data["result"].get("signer_public_address"),
                                "tx_hash": response_data["result"].get("tx_hash")
                            }
                        return response_data

                    except json.JSONDecodeError as e:
                        print(f"Error decoding JSON response: {e}")
                        print(f"Raw response text: '{response_text}'")
                        if response.status == 200:
                            return {
                                "success": True,
                                "message": "Operation completed successfully",
                                "signer_public_address": signer_address
                            }
                        return None

        except Exception as e:
            print(f"Error enabling trading: {str(e)}")
            traceback.print_exc()  # This will print the full error traceback
            return None

async def main():
try: # Initialize web3 clients
l3_public_client = Web3(Web3.HTTPProvider("https://sepolia.syndr.com/http"))
l2_public_client = Web3(Web3.HTTPProvider("https://endpoints.omniatech.io/v1/arbitrum/sepolia/public"))

        manager = SigningKeyManager(
            l3_public_client=l3_public_client,
            l2_public_client=l2_public_client
        )

        # Your wallet details
        wallet_private_key = ""
        wallet_address = ""

        result = await manager.GenerateApiKeySecret(
            wallet_address=wallet_address,
            wallet_private_key=wallet_private_key
        )

        if result is not None:
            print("Successfully enabled trading")
            print("Result:", result)
        else:
            print("Failed to enable trading - no valid response received")

    except Exception as e:
        print(f"Error in main: {str(e)}")
        traceback.print_exc()

if **name** == "**main**":
asyncio.run(main())

To start trading on Syndr via the API, we need a Api key secret which will enable us to trade on syndr exchange. To do this we need to make call to endpoint public/register_signing_key.

The steps to create request parameters for the API is little complicated and so we have provided with sample scripts in Python. Steps involved are as follows, you can use the script as a template to create request parameters for the same. The script will generate the required signatures for the request and register API Key, API Secret for your account.

  1. We need few parameters which are required for the generation of the request for the API.

    1. L3 URL is the url for the https endpoint for our L3 chain.
    2. L2 URL is the url for the https endpoint for the L2 chain.
    3. CONTRACT_ADDRESS is the address for signing key manager contract of Syndr chain.
    4. Wallet Address is the address to your wallet which you want to link to syndr exchange.
    5. Wallet private Key is the private key to the wallet.
  2. Create JSONRpc Provider for L3 and L2 urls to interact with onchain contracts.

  3. Create instance of Signing Key manager to use the methods for request creation.

  4. Generate signer_private_key and signer_address.

  5. Generate signing_key_signature.

  6. Generate account_signature.

  7. Perform api call at public/register_signing_key.

You can find steps to generate signing_key_signature and account_signature in the script.

Request Parameters for public/register_signing_key

Parameter Required Type Description
account true string address of the account
signerPublicAddress true string address of the signer
expiresAt true integer expiry time of signing key
signingKeySignature true string signature generated using signer
accountSignature true string signature generated using account

Response for public/register_signing_key

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result
› api_key string API key
› api_secret string API secret
› signer_public_address string Address that has the authority to sign orders on behalf of your account
› tx_hash string Hash of the transaction submitted by API that registered the signer for your account

An example of the response

{
  "jsonrpc": "2.0",
  "result": {
    "apiKey": ".....",
    "apiSecret": ".....",
    "signingKey": "0x0..",
    "txHash": "0x0..."
  },
  "id": 1
}

Authentication

Our API offers two types of methods: public and private. Public methods can be accessed without any authentication, while private methods require proper authentication to access. To use private methods, you need to authenticate using an API key and secret. You can follow the instructions in the API Key Setup section to obtain an API key and secret for your account.

REST

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc" : "2.0",
  "id" : 7365,
  "method" : "public/get_all_instrument_names",
  "params" : {

  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1/api/v1"
api_key = <API_KEY>
api_secret = <API_SECRET>

headers = {
    "syndr-api-key": api_key,
    "syndr-api-secret": api_secret,
    "Content-Type": "application/json"
}

json_rpc_request = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": <ANY_PRIVATE_METHOD>,
    "params": <METHOD_PARAMS>
}

response = requests.post(
    url,
    headers=headers,
    data=json.dumps(json_rpc_request),
  )

print(response.text)

When making a request to a private method using our REST API, you need to include the following headers in your POST request

  1. syndr-api-key
  2. syndr-api-secret

WEBSOCKET

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 1,
  "method" : "public/auth",
  "params" : {
    "api_key": <API_KEY>,
    "api_secret": <API_SECRET>
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
       await websocket.send(msg)
       while websocket.open:
           response = await websocket.recv()
           # do something with the response...
           print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))

An example of the response if valid api key and api secret

{
  "jsonrpc": "2.0",
  "result": {
    "status": "connection authenticated",
    "account": "0x0.."
  },
  "id": 1
}

When using our WebSocket API to access a private method, you must first send an authentication request to the public/auth method to authenticate your connection. Once authenticated, you can access any private method for the duration of the connection without needing to provide the API key again.

Request Parameters of public/auth

Parameter Required Type Description
api_key true string API key
api_secret true string API secret

Response of public/auth

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result
› status string "connection authenticated"
› account string Account corresponding to the input API key-pair


Methods

Public Methods:

Public methods can be accessed freely without requiring any authentication. Examples of public methods include retrieving general information like orderbook data, tickers or any other data that does not require access to user-specific information.

Private Methods:

Private methods, on the other hand, require proper authentication using an API key and secret. These methods allow access to user-specific data or actions, such as account information, trading, and account management.

Market Data

public/get_all_instrument_names

This method returns all the instrument names presently available.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_all_instrument_names",
      "params": {}
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "public/get_all_instrument_names",
    "params": {}
  })
  headers = {
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_all_instrument_names",
      "params": {}
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_all_instrument_names",
      "params":{

      }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "public/get_all_instrument_names",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

This method does not require any parameters.

An example of the response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "ETH-PERP",
    "ETH-27SEP24-2400-C",
    "ETH-25OCT24-2800-C",
    "ETH-9NOV24-2450-P"
  ],
  "usIn": 1731144056368324,
  "usOut": 1731144056368950,
  "usDiff": 626
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result array array of all instrument names.
usIn integer Server In Time
usOut integer Server Out Time
usDiff integer Out Time -In Time

public/get_trades

Get last trades for an instrument

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'Content-Type: application/json' \
  --data '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_trades",
      "params":{
          "instrument_name": "ETH-PERP"
      }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "public/get_trades",
    "params": {
      "instrument_name": "ETH-PERP"
    }
  })
  headers = {
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_trades",
      "params": {
          "instrument_name": "ETH-PERP"
      }
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "public/get_trades",
      "params":{
          "instrument_name": "ETH-PERP"
      }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "public/get_trades",
    params: {
      instrument_name: "ETH-PERP",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
instrument_name true string N/A The name of the instrument to query.

An example of the response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "amount": "0.001",
      "id": "0a24c367-7c6d-4b69-bdc6-5ae07f62f215",
      "instrument_name": "ETH-PERP",
      "price": "3029.8",
      "side": "buy",
      "timestamp": "2024-11-09T07:59:57.282Z"
    },
    {
      "amount": "0.001",
      "id": "1d300e62-0ec8-4bf7-a4c0-089132b85dd2",
      "instrument_name": "ETH-PERP",
      "price": "3029.8",
      "side": "buy",
      "timestamp": "2024-11-09T07:59:46.233Z"
    }
  ],
  "usIn": 1731144093831935,
  "usOut": 1731144093836187,
  "usDiff": 4252
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array Array containing all instrument trade details.
amount string The total amount traded in this transaction.
id string Unique identifier for the trade.
instrument_name string Name of the instrument
price string Price at which the trade was executed.
side string The taker order side for this trade (buy or sell).
timestamp integer Timestamp when the trade occurred.
usIn integer Timestamp for when the server received the request.
usOut integer Timestamp for when the server completed the response.
usDiff integer Duration of the request (calculated as usOut - usIn).

public/get_instruments

This method lists all the active instruments of a particular kind.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instruments",
    "params": {
        "kind": "perpetual"
    }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instruments",
    "params": {
      "kind": "perpetual"
    }
  })
  headers = {
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "public/get_instruments",
      "params": {
          "kind": "perpetual"
      }
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instruments",
    "params": {
        "kind": "perpetual"
    }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_instruments",
    params: {
      kind: "perpetual",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
kind true string perpetual, option, future, any kind of instrument you want for the list

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "ETH-PERP": {
      "base_currency": "ETH",
      "contract_size": "0.001",
      "id": 3,
      "is_active": true,
      "kind": "perpetual",
      "maker_commission": "-0.000025",
      "max_leverage": "50",
      "max_liquidation_commission": "5",
      "min_trade_amount": "0.001",
      "name": "ETH-PERP",
      "price_index": "ETHUSD",
      "quote_currency": "USD",
      "settlement_period": "perpetual",
      "taker_commission": "0.00025",
      "tick_size": "0.1",
      "underlying_name": "ETHUSD"
    }
  },
  "usIn": 1731144748610898,
  "usOut": 1731144748611634,
  "usDiff": 736
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Contains the instruments object.
[instrument_name] object An object with the key of the instrument name.
›› base_currency string The base currency of the instrument.
›› contract_size string The contract size of the instrument.
›› id integer The unique instrument ID.
›› is_active bool Indicates whether the instrument is active.
›› kind string The type or kind of instrument (e.g., "perpetual").
›› maker_commission string The maker commission rate for the instrument.
›› max_leverage string Maximum leverage available (only applicable for futures).
›› max_liquidation_commission string Maximum liquidation commission for the instrument.
›› min_trade_amount string The minimum trade amount for the instrument.
›› name string The name of the instrument.
›› price_index string The index associated with the instrument’s price feed.
›› quote_currency string The quote currency for the instrument.
›› settlement_period string Settlement period for the instrument (e.g., "perpetual").
›› taker_commission string The taker commission rate for the instrument.
›› tick_size string The minimum price increment for the instrument.
›› underlying_name string The underlying name of the instrument.
usIn integer Timestamp for the server request initiation.
usOut integer Timestamp for the server response completion.
usDiff integer Time difference (usOut - usIn), representing request duration.

public/get_instruments_by_currency

This method lists all the active instruments of a particular kind and currency.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_instruments_by_currency",
  "params": {
    "kind": "perpetual",
    "currency": "ETH"
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_instruments_by_currency",
  "params": {
    "kind": "perpetual",
    "currency": "ETH"
  }
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instruments_by_currency",
    "params": {
        "kind": "perpetual",
        "currency": "ETH"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_instruments_by_currency",
  "params": {
    "kind": "perpetual",
    "currency": "ETH"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_instruments_by_currency",
    params: {
      kind: "perpetual",
      currency: "ETH",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
kind true string perpetual option future kind of instrument
currency true string ETH BTC currency name

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "ETH-PERP": {
      "base_currency": "ETH",
      "contract_size": "0.001",
      "id": 1,
      "is_active": true,
      "kind": "perpetual",
      "maker_commission": "0.0003",
      "max_leverage": "50",
      "max_liquidation_commission": "0.05",
      "min_trade_amount": "0.001",
      "name": "ETH-PERP",
      "price_index": "ETHUSD",
      "quote_currency": "USD",
      "settlement_period": "perpetual",
      "taker_commission": "0.0003",
      "tick_size": "0.1",
      "underlying_name": "ETHUSD"
    }
  },
  "usIn": 1731148525505915,
  "usOut": 1731148525506701,
  "usDiff": 786
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Contains the instruments object.
[instrument_name] object An object with the key of the instrument name.
›› base_currency string The base currency of the instrument.
›› contract_size string The contract size of the instrument.
›› id integer The unique instrument ID.
›› is_active bool Indicates whether the instrument is active.
›› kind string The type or kind of instrument (e.g., "perpetual").
›› maker_commission string The maker commission rate for the instrument.
›› max_leverage string Maximum leverage available (only applicable for futures).
›› max_liquidation_commission string Maximum liquidation commission for the instrument.
›› min_trade_amount string The minimum trade amount for the instrument.
›› name string The name of the instrument.
›› price_index string The index associated with the instrument’s price feed.
›› quote_currency string The quote currency for the instrument.
›› settlement_period string Settlement period for the instrument (e.g., "perpetual").
›› taker_commission string The taker commission rate for the instrument.
›› tick_size string The minimum price increment for the instrument.
›› underlying_name string The underlying name of the instrument.
usIn integer Timestamp for the server request initiation.
usOut integer Timestamp for the server response completion.
usDiff integer Time difference (usOut - usIn), representing request duration.

public/get_order_book

Retrieves the order book, along with other market values for a given instrument.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_order_book",
  "params": {
    "instrument_name": "ETH-PERP"
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_order_book",
  "params": {
    "instrument_name": "ETH-PERP"
  }
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_order_book",
    "params": {
        "instrument_name": "ETH-PERP"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_order_book",
  "params": {
    "instrument_name": "ETH-PERP"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_order_book",
    params: {
      instrument_name: "ETH-PERP",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
instrument_name true string Name of the instrument

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "asks": [["3114.9", "0.821"]],
    "best_ask_amount": "0.821",
    "best_ask_price": "3114.9",
    "best_bid_amount": "0.02",
    "best_bid_price": "3110",
    "bids": [["3110", "0.02"]],
    "funding_rate": "-0.5",
    "index_price": "3128.8942043",
    "instrument_name": "ETH-PERP",
    "last_price": "3117",
    "mark_price": "3113.2497332785",
    "max_price": "3159.9484792776775",
    "min_price": "3066.5509872793225",
    "open_interest": "4.999",
    "stats": {
      "high": "0",
      "low": "0",
      "price_change": "3113.2497332785",
      "volume": "0"
    },
    "timestamp": "1732017185737"
  },
  "usIn": 1732017186722841,
  "usOut": 1732017186723962,
  "usDiff": 1121
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Details of the market data.
> asks array of array List of ask orders, each containing price and amount.
> best_ask_amount string The amount of the best ask order.
> best_ask_price string The price of the best ask order.
> best_bid_amount string The amount of the best bid order.
> best_bid_price string The price of the best bid order.
> bids array of array List of bid orders, each containing price and amount.
> funding_rate string The current funding rate.
> index_price string The index price of the instrument.
> instrument_name string The name of the instrument (e.g., "ETH-PERP").
> last_price string The last traded price.
> mark_price string The mark price of the instrument.
> max_price string The maximum price over the recent period.
> min_price string The minimum price over the recent period.
> open_interest string The current open interest for the instrument.
> stats object Statistical data for the instrument.
>> high string The highest price over the recent period.
>> low string The lowest price over the recent period.
>> price_change string The price change over the recent period.
>> volume string The trading volume over the recent period.
> timestamp string The timestamp of the market data.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

public/get_tradingview_chart_data

Publicly available market data used to generate a TradingView candle chart.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_tradingview_chart_data",
  "params": {
    "instrument_name": "ETH-PERP",
    "resolution": "1",
    "from": 1729682270000,
    "to":   1729682340052
  }
}
'

import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_tradingview_chart_data",
  "params": {
    "instrument_name": "ETH-PERP",
    "resolution": "1",
    "from": 1729682270000,
    "to": 1729682340052
  }
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/get_tradingview_chart_data",
  "params": {
    "instrument_name": "ETH-PERP",
    "resolution": "1",
    "from": 1729682270000,
    "to":   1729682340052
  }
}
`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_tradingview_chart_data",
    "params": {
        "instrument_name": "ETH-PERP",
        "resolution": "1",
        "from": 1729682270000,
        "to": 1729682340052
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}

var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_tradingview_chart_data",
    params: {
      instrument_name: "ETH-PERP",
      resolution: "1",
      from: 1729682270000,
      to: 1729682340052,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
instrument_name true string Name of the instrument
from true integer Unix timestamp from
to true integer Unix timestamp to
resolution true string Resolution of candel. Possible values: 1, 5, 30, 60,240,1D

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [
    {
      "LastUpdatedTime": 1729682280003,
      "close": 2575.1,
      "high": 2575.1,
      "low": 2575.1,
      "open": 2575.1,
      "time": 1729682280000,
      "volume": 0
    },
    {
      "LastUpdatedTime": 1729682340052,
      "close": 2575.1,
      "high": 2575.1,
      "low": 2575.1,
      "open": 2575.1,
      "time": 1729682340000,
      "volume": 0
    }
  ],
  "usIn": 1731153318004194,
  "usOut": 1731153318005839,
  "usDiff": 1645
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object Array of historical candlestick data.
> LastUpdatedTime integer The last time this data was updated (timestamp in milliseconds).
> close float The closing price of the candlestick.
> high float The highest price during the candlestick period.
> low float The lowest price during the candlestick period.
> open float The opening price of the candlestick.
> time integer The starting time of the candlestick period (timestamp in ms).
> volume float The trading volume during the candlestick period.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

public/ticker

Gives ticker for the instrument

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/ticker",
  "params": {
    "instrument_name": "ETH-PERP"
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/ticker",
  "params": {
    "instrument_name": "ETH-PERP"
  }
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/ticker",
    "params": {
        "instrument_name": "ETH-PERP"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "public/ticker",
  "params": {
    "instrument_name": "ETH-PERP"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/ticker",
    params: {
      instrument_name: "ETH-PERP",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
instrument_name true string Name of the instrument

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "best_ask_amount": "0.821",
    "best_ask_price": "3114.9",
    "best_bid_amount": "0.02",
    "best_bid_price": "3110",
    "funding_8h": "0",
    "funding_rate": "-0.5",
    "index_price": "3130.27376119",
    "instrument_name": "ETH-PERP",
    "last_price": "3117",
    "mark_price": "3114.62239238405",
    "max_price": "3161.34172826981075",
    "min_price": "3067.90305649828925",
    "open_interest": "4.999",
    "stats": {
      "change_24h": "-3.1",
      "max_24h": "3120.1",
      "min_24h": "3117",
      "volume_24h": "15589.6814"
    },
    "timestamp": "1732017510718"
  },
  "usIn": 1732017511001871,
  "usOut": 1732017511002857,
  "usDiff": 986
}

Response

Name Type Description
jsonrpc string The JSON-RPC version, here 2.0.
id integer The ID that was sent in the request.
result object Contains the market data details.
best_ask_amount string The amount of the best ask price available in the market.
best_ask_price string The current best ask price.
best_bid_amount string The amount of the best bid price available in the market.
best_bid_price string The current best bid price.
funding_8h string The funding rate for the past 8 hours.
funding_rate string The current funding rate for the instrument.
index_price string The index price of the instrument (ETH/USD in this case).
instrument_name string The name of the instrument (e.g., ETH-PERP).
last_price string The last price at which the instrument was traded.
mark_price string The mark price of the instrument.
max_price string The maximum price of the instrument within the current period.
min_price string The minimum price of the instrument within the current period.
open_interest string The total open interest (number of contracts outstanding).
stats object Contains 24-hour trading statistics.
›› change_24h string The price change in the last 24 hours.
›› max_24h string The maximum price in the last 24 hours.
›› min_24h string The minimum price in the last 24 hours.
›› volume_24h string The trading volume in the last 24 hours.
delta string Greek Delta only in case of option instruments.
gamma string Greek Gamma only in case of option instruments.
rho string Greek Rho only in case of option instruments.
sigma string Greek Sigma only in case of option instruments.
tau string Greek Tau only in case of option instruments.
theta string Greek Theta only in case of option instruments.
vega string Greek Vega only in case of option instruments.
timestamp string The timestamp of the server response.
usIn integer Timestamp for the server request initiation.
usOut integer Timestamp for the server response completion.
usDiff integer Time difference (usOut - usIn), representing request duration.

public/get_supported_collaterals

Gives ticker for the instrument

  curl --location --request GET 'https://dev-api.syndr.trade/api/v1/public/get_supported_collaterals' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "public/get_supported_collaterals",
    "params" : {}
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1/public/get_supported_collaterals"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_supported_collaterals",
    "params": {}
  })
  headers = {
    'Content-Type': 'application/json'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "public/get_supported_collaterals",
      "params": {}
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::GET, "https://dev-api.syndr.trade/api/v1/public/get_supported_collaterals")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1/public/get_supported_collaterals"
    method := "GET"

    payload := strings.NewReader(`{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "public/get_supported_collaterals",
    "params" : {}
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "GET",
  url: "https://dev-api.syndr.trade/api/v1/public/get_supported_collaterals",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_supported_collaterals",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

An example of the response

{
  "jsonrpc": "2.0",
  "result": {
    "DAI": {
      "collateral_weight": "1",
      "decimals": 18,
      "im_weight": "1",
      "l2_address": "0x667094b03b8534d9f93b97a1e211c01c63f6bc2e",
      "l2_gateway": "0xbb0d77b2ae2843409f60fe99c7a54b377e26b363",
      "l3_address": "0x0e55f649ea4843dd173520c3733839cf2f215d16",
      "mm_weight": "1",
      "name": "Syndr L3 DAI",
      "oracle_price_id": "DAIUSD",
      "oracle_update_data": "0x020000000000000000000000000000000000000000000000000000000005f5c39a4441495553440000000000000000000000000000000000000000000000000000eca5d4e8daf05714b380081a0c3453ad563c5d655cf0ef1820f0818f450500d923cb0430b2b0c63d93dc7f15a0ef0446a2e279926c030bf9672da9fe11d790af00000000000399df672f51bffffffff81b",
      "paused": false,
      "price_index": "DAIUSD",
      "symbol": "DAI"
    },
    "USDC": {
      "collateral_weight": "1",
      "decimals": 6,
      "im_weight": "1",
      "l2_address": "0xce1c613bffc4d7b1e8c64d851274c59ccd13bc97",
      "l2_gateway": "0xbb0d77b2ae2843409f60fe99c7a54b377e26b363",
      "l3_address": "0x85d4cd6a8dc7d6280d53254477ac681ac46a2d50",
      "mm_weight": "1",
      "name": "Syndr L3 Circle USD",
      "oracle_price_id": "USDCUSD",
      "oracle_update_data": "0x020000000000000000000000000000000000000000000000000000000005f5b14555534443555344000000000000000000000000000000000000000000000000003f0368f1d36677c032bac045f755ff85c2081fec0cbf3deee9f6202c4578e36b54643c1f6331f4771c20f658f478754009cd086ea9792b777ec1dd85a1acf566000000000000eb8a672f51bffffffff81c",
      "paused": false,
      "price_index": "USDCUSD",
      "symbol": "USDC"
    },
    "USDT": {
      "collateral_weight": "1",
      "decimals": 6,
      "im_weight": "1",
      "l2_address": "0x68e53712bdabfabc0da19a1065dfdeec90572f8b",
      "l2_gateway": "0xbb0d77b2ae2843409f60fe99c7a54b377e26b363",
      "l3_address": "0xf96ea8426edc799ea7dbf34c86b565722e52ccce",
      "mm_weight": "1",
      "name": "Syndr L3 Tether USD",
      "oracle_price_id": "USDTUSD",
      "oracle_update_data": "0x020000000000000000000000000000000000000000000000000000000005f6ad95555344545553440000000000000000000000000000000000000000000000000075e1d1ac903dfb24cad9981a0e529cc5f968e0a93e07f7c02ca02325c8e159b752ccfad7ba9d1b9b912d7d9f63352971e14d05583c2363312d9bf56454debcb0000000000001b1df672f51bffffffff81c",
      "paused": false,
      "price_index": "USDTUSD",
      "symbol": "USDT"
    }
  },
  "usIn": 1731154369530543,
  "usOut": 1731154369531263,
  "usDiff": 720
}

Response

Name Type Description
jsonrpc string The JSON-RPC version.
result object Contains the collateral list supported for trade
token object Contains data specific to the collateral.
› › collateral_weight string Collateral weight of the token.
› › decimals integer Number of decimals for the token.
› › im_weight string IM weight of the token.
› › l2_address string The Layer 2 address for the token.
› › l2_gateway string The Layer 2 gateway address for the token.
› › l3_address string The Layer 3 address for the token.
› › mm_weight string Market maker weight for the token.
› › name string The name of the token.
› › oracle_price_id string The price index used by the oracle for price feed.
› › oracle_update_data string The data used by the oracle to update the token’s price.
› › paused bool Whether the token is active or paused.
› › price_index string The price index used for the token’s price feed.
› › symbol string The symbol of the token (e.g., DAI, USDC, USDT).
usIn integer Timestamp for when the server received the request.
usOut integer Timestamp for when the server completed the response.
usDiff integer Duration of the request (calculated as usOut - usIn).

public/get_instrument

This method gets the detail of the instrument.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instrument",
    "params": {
        "instrument_name": "ETH-PERP"
    }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instrument",
    "params": {
      "instrument_name": "ETH-PERP"
    }
  })
  headers = {
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "public/get_instrument",
      "params": {
          "instrument_name": "ETH-PERP"
      }
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "public/get_instrument",
    "params": {
        "instrument_name": "ETH-PERP"
    }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "public/get_instrument",
    params: {
      instrument_name: "ETH-PERP",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
instrument_name true string name of the instrument to fetch its details

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "base_currency": "ETH",
    "contract_size": "0.001",
    "id": 3,
    "is_active": true,
    "kind": "perpetual",
    "maker_commission": "-0.000025",
    "max_leverage": "50",
    "max_liquidation_commission": "5",
    "min_trade_amount": "0.001",
    "name": "ETH-PERP",
    "price_index": "ETHUSD",
    "quote_currency": "USD",
    "settlement_period": "perpetual",
    "taker_commission": "0.00025",
    "tick_size": "0.1",
    "underlying_name": "ETHUSD"
  },
  "usIn": 1731144748610898,
  "usOut": 1731144748611634,
  "usDiff": 736
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Contains the instruments object.
base_currency string The base currency of the instrument.
contract_size string The contract size of the instrument.
id integer The unique instrument ID.
is_active bool Indicates whether the instrument is active.
kind string The type or kind of instrument (e.g., "perpetual").
maker_commission string The maker commission rate for the instrument.
max_leverage string Maximum leverage available (only applicable for futures).
max_liquidation_commission string Maximum liquidation commission for the instrument.
min_trade_amount string The minimum trade amount for the instrument.
name string The name of the instrument.
price_index string The index associated with the instrument’s price feed.
quote_currency string The quote currency for the instrument.
settlement_period string Settlement period for the instrument (e.g., "perpetual").
taker_commission string The taker commission rate for the instrument.
tick_size string The minimum price increment for the instrument.
underlying_name string The underlying name of the instrument.
usIn integer Timestamp for the server request initiation.
usOut integer Timestamp for the server response completion.
usDiff integer Time difference (usOut - usIn), representing request duration.

Trading

private/buy

This method places a buy order.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/buy",
    "params": {
        "order_type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "price": 3500,
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "timestamp": 1718133867572,
        "expiration": 1718133868572,
        "salt": 647684,
        "signature": "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b"
    }
}'

import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/buy",
  "params": {
    "order_type": "limit",
    "time_in_force": "GTC",
    "post_only": False,
    "price": 3500,
    "instrument_name": "ETH-PERP",
    "amount": 1,
    "timestamp": 1718133867572,
    "expiration": 1718133868572,
    "salt": 647684,
    "signature": "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b"
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/buy",
    "params": {
        "order_type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "price": 3500,
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "timestamp": 1718133867572,
        "expiration": 1718133868572,
        "salt": 647684,
        "signature": "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/buy",
    "params": {
        "order_type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "price": 3500,
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "timestamp": 1718133867572,
        "expiration": 1718133868572,
        "salt": 647684,
        "signature": "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b"
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/buy",
    params: {
      order_type: "limit",
      time_in_force: "GTC",
      post_only: false,
      price: 3500,
      instrument_name: "ETH-PERP",
      amount: 1,
      timestamp: 1718133867572,
      expiration: 1718133868572,
      salt: 647684,
      signature:
        "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

|

An example of the response

{}

Response

Name Type Enum Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result object Acknowledgement of the order
› Order string Order obj contains order details
›› amount string trade amount
›› average_price string avg price of trade
›› creation_timestamp integer trade creation timestamp
›› creator string wallet address of account
›› direction string order type
›› filled_amount string amount of order filled
›› instrument_name string instrument name of executed order
›› is_liquidation bool is a liquidation order
›› label string order label
›› last_update_timestamp integer last updated timestamp of order
›› order_id string a unique id for each order
›› order_state string state of order
›› order_type string type of order
›› post_only bool is order post only
›› price string price of order
›› reduce_only bool is order reduce only
›› time_in_force string time to force order
›› unfilled_amount string unfilled amount of order
›› Trades Array of object Array of trades
›› id string id of given trade
›› instrument_name string instrument name of given trade
›› price string price name of given trade
›› side string side of given trade
›› amount string amount of given trade
›› timestamp integer timestamp of given trade
usIn integer Server In Time
usOut integer Server Out Time
usDiff integer Out Time -In Time

private/sell

This method places a sell order.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/sell",
    "params": {
        "price": 3800,
        "order_type": "limit",
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "time_in_force": "GTC",
        "post_only": false,
        "signature": "0xjhjhhhhj",
        "timestamp": 1708693483000,
        "salt" : 1,
        "expiration": 1708698000000
    }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/sell",
  "params": {
    "price": 3800,
    "order_type": "limit",
    "instrument_name": "ETH-PERP",
    "amount": 1,
    "time_in_force": "GTC",
    "post_only": False,
    "signature": "0xjhjhhhhj",
    "timestamp": 1708693483000,
    "salt": 1,
    "expiration": 1708698000000
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/sell",
    "params": {
        "price": 3800,
        "order_type": "limit",
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "time_in_force": "GTC",
        "post_only": false,
        "signature": "0xjhjhhhhj",
        "timestamp": 1708693483000,
        "salt": 1,
        "expiration": 1708698000000
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/sell",
    "params": {
        "price": 3800,
        "order_type": "limit",
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "time_in_force": "GTC",
        "post_only": false,
        "signature": "0xjhjhhhhj",
        "timestamp": 1708693483000,
        "salt" : 1,
        "expiration": 1708698000000
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/sell",
    params: {
      price: 3800,
      order_type: "limit",
      instrument_name: "ETH-PERP",
      amount: 1,
      time_in_force: "GTC",
      post_only: false,
      signature: "0xjhjhhhhj",
      timestamp: 1708693483000,
      salt: 1,
      expiration: 1708698000000,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

An example of the response


Response

Name Type Enum Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result object Acknowledgement of the order
› Order string Order obj contains order details
›› amount string trade amount
›› average_price string avg price of trade
›› creation_timestamp integer trade creation timestamp
›› creator string wallet address of account
›› direction string order type
›› filled_amount string amount of order filled
›› instrument_name string instrument name of executed order
›› is_liquidation bool is a liquidation order
›› label string order label
›› last_update_timestamp integer last updated timestamp of order
›› order_id string a unique id for each order
›› order_state string state of order
›› order_type string type of order
›› post_only bool is order post only
›› price string price of order
›› reduce_only bool is order reduce only
›› time_in_force string time to force order
›› unfilled_amount string unfilled amount of order
›› Trades Array of object Array of trades
›› id string id of given trade
›› instrument_name string instrument name of given trade
›› price string price name of given trade
›› side string side of given trade
›› amount string amount of given trade
›› timestamp integer timestamp of given trade
usIn integer Server In Time
usOut integer Server Out Time
usDiff integer Out Time -In Time

private/edit

This method edits an existing order.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc" : "2.0",
  "id" : 7365,
  "method" : "private/edit",
  "params" : {
    "order_id": "cb52c2b0-9baf-4db3-a241-4a9e0e4eaaa6",
    "instrument_name": "ETH-PERP",
    "amount" : 0.8,
    "price" : 4350,
    "timestamp": 1718133867572
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/edit",
  "params": {
    "order_id": "cb52c2b0-9baf-4db3-a241-4a9e0e4eaaa6",
    "instrument_name": "ETH-PERP",
    "amount": 0.8,
    "price": 4350,
    "timestamp": 1718133867572
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/edit",
    "params": {
        "order_id": "cb52c2b0-9baf-4db3-a241-4a9e0e4eaaa6",
        "instrument_name": "ETH-PERP",
        "amount": 0.8,
        "price": 4350,
        "timestamp": 1718133867572
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/buy",
    "params": {
        "order_type": "limit",
        "time_in_force": "GTC",
        "post_only": false,
        "price": 3500,
        "instrument_name": "ETH-PERP",
        "amount": 1,
        "timestamp": 1718133867572,
        "expiration": 1718133868572,
        "salt": 647684,
        "signature": "0x56db36f8989d74565ff8027a1f57476f520cad7eea2b0c401dac31c9f00423da4a76474da2b8416eccdcf60fea117a5cc80c675fc6c7c9dcbd6d2772258880861b"
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/edit",
    params: {
      order_id: "cb52c2b0-9baf-4db3-a241-4a9e0e4eaaa6",
      instrument_name: "ETH-PERP",
      amount: 0.8,
      price: 4350,
      timestamp: 1718133867572,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
instrument_name true string Instrument name
amount true number It represents the requested order amount. For all instruments, the amount is in corresponding underlying currency (Like 1ETH, 2.5ETH, 4BTC).
time_in_force true string GTC Specifies how long the order remains in effect. Currently only GTC supported (good till canceled) IOC and more types coming soon.
type true string limit , market The order type
price false number The order price in USD
signature false string

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "status": "success",
    "result": {
      "amount": "1",
      "average_price": "0",
      "creation_timestamp": 1702383895830,
      "creator": "0x770e486038da4d6dce7d781e3ab0421dac34ddd9",
      "direction": "buy",
      "filled_amount": "0",
      "instrument_name": "",
      "is_liquidation": false,
      "label": "",
      "last_update_timestamp": 1702383895830,
      "order_id": "e50464e8-16d0-4c3d-aac5-77100359e34e",
      "order_state": "open",
      "order_type": "Limit",
      "post_only": false,
      "price": "2200",
      "reduce_only": false,
      "time_in_force": "",
      "unfilled_amount": "1"
    }
  }
}

Response

Name Type Enum Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result object Acknowledgement of the order
› amount string trade amount
› average_price string avg price of trade
› creation_timestamp integer trade creation timestamp
› creator string wallet address of account
› direction string order type
› filled_amount string amount of order filled
› instrument_name string instrument name of executed order
› is_liquidation bool is a liquidation order
› label string order label
› last_update_timestamp integer last updated timestamp of order
› order_id string a unique id for each order
› order_state string state of order
› order_type string type of order
› post_only bool is order post only
› price string price of order
› reduce_only bool is order reduce only
› time_in_force string time to force order
› unfilled_amount string unfilled amount of order
› Trades Array of object Array of trades
› id string id of given trade
› instrument_name string instrument name of given trade
› price string price name of given trade
› side string side of given trade
› amount string amount of given trade
› timestamp integer timestamp of given trade

private/cancel

This method allows to cancel a given order.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'syndr-api-key: SYNDR_API_KEY' \
  --header 'syndr-api-secret: SYNDR_API_SECRET' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "private/cancel",
    "params" : {
      "instrument_name": "ETH-PERP",
      "order_id": "6fde9b01-156f-4416-a800-8ca1a0e8f471"
    }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/cancel",
    "params": {
      "instrument_name": "ETH-PERP",
      "order_id": "6fde9b01-156f-4416-a800-8ca1a0e8f471"
    }
  })
  headers = {
    'syndr-api-key': 'SYNDR_API_KEY',
    'syndr-api-secret': 'SYNDR_API_SECRET',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
      headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "private/cancel",
      "params": {
          "instrument_name": "ETH-PERP",
          "order_id": "6fde9b01-156f-4416-a800-8ca1a0e8f471"
      }
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "private/cancel",
    "params" : {
      "instrument_name": "ETH-PERP",
      "order_id": "6fde9b01-156f-4416-a800-8ca1a0e8f471"
    }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
    req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/cancel",
    params: {
      instrument_name: "ETH-PERP",
      order_id: "6fde9b01-156f-4416-a800-8ca1a0e8f471",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
instrument_name true string Instrument name
order_id true string the order id of the order to cancel

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "amount": "1",
    "average_price": "0",
    "creation_timestamp": 1702383895830,
    "creator": "0x770e486038da4d6dce7d781e3ab0421dac34ddd9",
    "direction": "buy",
    "filled_amount": "0",
    "instrument_name": "",
    "is_liquidation": false,
    "label": "",
    "last_update_timestamp": 1702383895830,
    "order_id": "e50464e8-16d0-4c3d-aac5-77100359e34e",
    "order_state": "open",
    "order_type": "Limit",
    "post_only": false,
    "price": "2200",
    "reduce_only": false,
    "time_in_force": "",
    "unfilled_amount": "1"
  }
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result string Acknowledgement of successful order cancellation
› amount string trade amount
› average_price string avg price of trade
› creation_timestamp integer trade creation timestamp
› creator string wallet address of account
› direction string order type
› filled_amount string amount of order filled
› instrument_name string instrument name of executed order
› is_liquidation bool is a liquidation order
› label string order label
› last_update_timestamp integer last updated timestamp of order
› order_id string a unique id for each order
› order_state string state of order
› order_type string type of order
› post_only bool is order post only
› price string price of order
› reduce_only bool is order reduce only
› time_in_force string time to force order
› unfilled_amount string unfilled amount of order
› Trades Array of object Array of trades
› id string id of given trade
› instrument_name string instrument name of given trade
› price string price name of given trade
› side string side of given trade
› amount string amount of given trade
› timestamp integer timestamp of given trade

private/cancel_all

This method allows to cancell all existing orders.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc" : "2.0",
  "id" : 7365,
  "method" : "private/cancel_all",
  "params" : {
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/cancel_all",
  "params": {}
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/cancel_all",
    "params": {}
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc" : "2.0",
  "id" : 7365,
  "method" : "private/cancel_all",
  "params" : {
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dev-api.syndr.trade/api/v1',
  'headers': {
    'syndr-api-key': 'SYNDR_API_KEY',
    'syndr-api-secret': 'SYNDR_API_SECRET',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/cancel_all",
    "params": {}
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

This method does not require any parameters.

An example of the response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 1,
  "usIn": 1731144056368324,
  "usOut": 1731144056368950,
  "usDiff": 626
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result integer Acknowledgement of the operation (e.g., success).
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/cancel_all_by_instrument

This method cancels all the open orders of a particular instrument.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'syndr-api-key: SYNDR_API_KEY' \
  --header 'syndr-api-secret: SYNDR_API_SECRET' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "private/cancel_all_by_instrument",
    "params" : {
      "instrument_name": "ETH-PERP"
    }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/cancel_all_by_instrument",
    "params": {
      "instrument_name": "ETH-PERP"
    }
  })
  headers = {
    'syndr-api-key': 'SYNDR_API_KEY',
    'syndr-api-secret': 'SYNDR_API_SECRET',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
      headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "private/cancel_all_by_instrument",
      "params": {
          "instrument_name": "ETH-PERP"
      }
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc" : "2.0",
    "id" : 7365,
    "method" : "private/cancel_all_by_instrument",
    "params" : {
      "instrument_name": "ETH-PERP"
    }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
    req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/cancel_all_by_instrument",
    params: {
      instrument_name: "ETH-PERP",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Enum Description
instrument_name true string Instrument name

An example of the response

{
  "jsonrpc": "2.0",
  "result": "All orders cancelled",
  "id": 7365
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result string Acknowledgement of successful order cancellation

private/update_instrument_leverage

This method updates the instrument leverage.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: Ey7wAFRyxbWqaubpei_fuupNd26fchOqOsebY_mUQds=' \
--header 'syndr-api-secret: cb7d8560593939477d0004684a07e6ae7a6c3fe923651f1a2f1e1ac55e5292b4.ed9273e968dceae8415c8b8a793b1efa7e996a393217d9eaf756f7fed621c08a' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc" : "2.0",
  "id" : 7365,
  "method" : "private/update_instrument_leverage",
  "params" : {
    "instrument_id": "1",
    "updated_leverage": 10
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/update_instrument_leverage",
  "params": {
    "instrument_id": "1",
    "updated_leverage": 10
  }
})
headers = {
  'syndr-api-key': 'Ey7wAFRyxbWqaubpei_fuupNd26fchOqOsebY_mUQds=',
  'syndr-api-secret': 'cb7d8560593939477d0004684a07e6ae7a6c3fe923651f1a2f1e1ac55e5292b4.ed9273e968dceae8415c8b8a793b1efa7e996a393217d9eaf756f7fed621c08a',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "Ey7wAFRyxbWqaubpei_fuupNd26fchOqOsebY_mUQds=",
    "syndr-api-secret": "cb7d8560593939477d0004684a07e6ae7a6c3fe923651f1a2f1e1ac55e5292b4.ed9273e968dceae8415c8b8a793b1efa7e996a393217d9eaf756f7fed621c08a",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/update_instrument_leverage",
    params: {
      instrument_id: "1",
      updated_leverage: 10,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/update_instrument_leverage",
    "params": {
      "instrument_id": "1",
      "updated_leverage": 10
    }
  }`)

  client := &http.Client{}
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "Ey7wAFRyxbWqaubpei_fuupNd26fchOqOsebY_mUQds=")
  req.Header.Add("syndr-api-secret", "cb7d8560593939477d0004684a07e6ae7a6c3fe923651f1a2f1e1ac55e5292b4.ed9273e968dceae8415c8b8a793b1efa7e996a393217d9eaf756f7fed621c08a")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "Ey7wAFRyxbWqaubpei_fuupNd26fchOqOsebY_mUQds=".parse()?);
    headers.insert("syndr-api-secret", "cb7d8560593939477d0004684a07e6ae7a6c3fe923651f1a2f1e1ac55e5292b4.ed9273e968dceae8415c8b8a793b1efa7e996a393217d9eaf756f7fed621c08a".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/update_instrument_leverage",
    "params": {
      "instrument_id": "1",
      "updated_leverage": 10
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}

### Parameters

| **Parameter**       | **Required** | **Type** | **Description**                          |
| ------------------- | ------------ | -------- | ---------------------------------------- |
| `instrument_id`     | true         | string   | The unique ID of the instrument to update. |
| `updated_leverage`  | true         | integer  | The new leverage value to set for the instrument. |

> An example of the response

```json
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "success": 1
  },
  "usIn": 1731144056368324,
  "usOut": 1731144056368950,
  "usDiff": 626
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Contains the result of the operation.
> success integer Indicates whether the operation was successful (1 for success, 0 for failure).
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_open_orders

This method gives all the positions.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'syndr-api-key: SYNDR_API_KEY' \
  --header 'syndr-api-secret: SYNDR_API_SECRET' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_open_orders",
    "params": {}
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_open_orders",
    "params": {}
  })
  headers = {
    'syndr-api-key': 'SYNDR_API_KEY',
    'syndr-api-secret': 'SYNDR_API_SECRET',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
      headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "private/get_open_orders",
      "params": {}
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_open_orders",
    "params": {}
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
    req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_open_orders",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [],
  "usIn": 1731171649144521,
  "usOut": 1731171649145129,
  "usDiff": 608
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result object Open orders of instruments of all currencies
› [underlying_currency] object Open orders of instruments of a particular currency
› › [instrument_kind] object Open orders of of a particular instrument
› › › [instrument_name] object Open order
› › › › order_id string Order id of the order
› › › › › amount string trade amount
› › › › › average_price string avg price of trade
› › › › › creation_timestamp integer trade creation timestamp
› › › › › creator string wallet address of account
› › › › › direction string order type
› › › › › filled_amount string amount of order filled
› › › › › instrument_name string instrument name of executed order
› › › › › is_liquidation bool is a liquidation order
› › › › › label string order label
› › › › › last_update_timestamp integer last updated timestamp of order
› › › › › order_id string a unique id for each order
› › › › › order_state string state of order
› › › › › order_type string type of order
› › › › › post_only bool is order post only
› › › › › price string price of order
› › › › › reduce_only bool is order reduce only
› › › › › time_in_force string time to force order
› › › › › unfilled_amount string unfilled amount of order
› › › › › Trades Array of object Array of trades
› › › › › id string id of given trade
› › › › › instrument_name string instrument name of given trade
› › › › › price string price name of given trade
› › › › › side string side of given trade
› › › › › amount string amount of given trade
› › › › › timestamp integer timestamp of given trade
usIn integer Server In Time
usOut integer Server Out Time
usDiff integer Out Time -In Time

private/get_positions

This method gives all the open orders.

  curl --location 'https://dev-api.syndr.trade/api/v1' \
  --header 'syndr-api-key: SYNDR_API_KEY' \
  --header 'syndr-api-secret: SYNDR_API_SECRET' \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_positions",
    "params": {

    }
  }'
  import requests
  import json

  url = "https://dev-api.syndr.trade/api/v1"

  payload = json.dumps({
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_positions",
    "params": {}
  })
  headers = {
    'syndr-api-key': 'SYNDR_API_KEY',
    'syndr-api-secret': 'SYNDR_API_SECRET',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = reqwest::Client::builder()
          .build()?;

      let mut headers = reqwest::header::HeaderMap::new();
      headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
      headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
      headers.insert("Content-Type", "application/json".parse()?);

      let data = r#"{
      "jsonrpc": "2.0",
      "id": 7365,
      "method": "private/get_positions",
      "params": {}
  }"#;

      let json: serde_json::Value = serde_json::from_str(&data)?;

      let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
          .headers(headers)
          .json(&json);

      let response = request.send().await?;
      let body = response.text().await?;

      println!("{}", body);

      Ok(())
  }
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://dev-api.syndr.trade/api/v1"
    method := "POST"

    payload := strings.NewReader(`{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_positions",
    "params": {

    }
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
    req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret":
      "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_positions",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [
    {
      "account": "0x3096E206da35141D5B23aE16C42C070f7df082a8",
      "average_price": "2573.4",
      "cached_funding_index": "0",
      "direction": "buy",
      "index_price": "3025.88612257",
      "instrument_id": 1,
      "instrument_name": "ETH-PERP",
      "is_synced_onchain": false,
      "kind": "perpetual",
      "last_update_timestamp": "1731171867595",
      "mark_price": "3034.08253257",
      "position_delta": "8",
      "realized_funding": "0",
      "realized_pnl": "1",
      "settlement_price": "0",
      "size": "8",
      "total_pnl": "3686.46026056",
      "trade_fee": "77205000000",
      "unrealized_pnl": "3685.46026056"
    }
  ],
  "usIn": 1731171868172673,
  "usOut": 1731171868174309,
  "usDiff": 1636
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id sent in the request.
result array Contains position information for each instrument.
account string Account address associated with the position.
average_price string Average entry price for the position.
cached_funding_index string Cached funding index value.
direction string Direction of the position: buy or sell.
index_price string Current index price of the instrument.
instrument_id integer Unique ID of the instrument.
instrument_name string Name of the instrument (e.g., "ETH-PERP").
is_synced_onchain bool Indicates if the position is synced with the on-chain position.
kind string Type of instrument.
last_update_timestamp string Timestamp of the last update.
mark_price string Current mark price of the instrument.
position_delta string Change in position size.
realized_funding string Total funding payments made (only in perpetuals).
realized_pnl string Realized profit and loss of the position.
settlement_price string Last settlement price of the instrument.
size string Size of the position in contracts.
total_pnl string Total profit and loss for the position.
trade_fee string Total trade fees incurred.
unrealized_pnl string Unrealized profit and loss of the position.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_order_history_by_kind

fetches order history by instrument kind for an account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_order_history_by_kind",
    "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_order_history_by_kind",
    params: {
      kind: "option",
      count: 10,
      offset: 1,
      start_time: 1731222656,
      end_time: 1732000257,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
kind true enum instrument kind for which we need order history. possible enum values: spot, perpetual, option, future, any
count true integer number of records want to fetch. In case of pagination number of records per page.
offset false integer If pagination is required offset is needed as parameter
start_time true integer time from which you want to fetch order history record
end_time true integer Current time in seconds
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [
    {
      "instrument_name": "ETH/USDT",
      "order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "order_type": "limit",
      "order_state": "open",
      "direction": "sell",
      "time_in_force": "GTC",
      "reduce_only": false,
      "is_liquidation": false,
      "post_only": false,
      "account": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
      "order_signer": "0x0000000000000000000000000000000000000000",
      "creation_timestamp": 1728041366138,
      "last_update_timestamp": 1728041366138,
      "expiration": 1729041366138,
      "price": "2380",
      "average_price": "0",
      "trigger_price": "0",
      "trigger_condition": "",
      "triggered": false,
      "original_amount": "0.1",
      "amount": "0.1",
      "unfilled_amount": "0.1",
      "filled_amount": "0",
      "label": "",
      "salt": "396049",
      "signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
    }
  ],
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object
> amount string trade amount
> average_price string avg price of trade
> creation_timestamp integer trade creation timestamp
> creator string wallet address of account
> direction string order type
> filled_amount string amount of order filled
> instrument_name string instrument name of executed order
> is_liquidation bool is a liquidation order
> label string order label
> last_update_timestamp integer last updated timestamp of order
> order_id string a unique id for each order
> order_state string state of order
> order_type string type of order
> post_only bool is order post only
> price string price of order
> reduce_only bool is order reduce only
> time_in_force string time to force order
> unfilled_amount string unfilled amount of order
> Trades Array of object Array of trades
> id string id of given trade
> instrument_name string instrument name of given trade
> price string price name of given trade
> side string side of given trade
> amount string amount of given trade
> timestamp integer timestamp of given trade
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_order_history_by_instrument

fetches order history of an instrument for an account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_order_history_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_order_history_by_instrument",
    "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_time": 1731222656,
      "end_time": 1732000257
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_order_history_by_instrument",
    params: {
      instrument_name: "ETH-PERP",
      count: 10,
      offset: 1,
      start_time: 1731222656,
      end_time: 1732000257,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
instrument_name true string instrument name for which we need order history
count true integer number of records want to fetch. In case of pagination number of records per page.
offset false integer If pagination is required offset is needed as parameter
start_time true integer time from which you want to fetch order history record
end_time true integer Current time in seconds
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [
    {
      "instrument_name": "ETH/USDT",
      "order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "order_type": "limit",
      "order_state": "open",
      "direction": "sell",
      "time_in_force": "GTC",
      "reduce_only": false,
      "is_liquidation": false,
      "post_only": false,
      "account": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
      "order_signer": "0x0000000000000000000000000000000000000000",
      "creation_timestamp": 1728041366138,
      "last_update_timestamp": 1728041366138,
      "expiration": 1729041366138,
      "price": "2380",
      "average_price": "0",
      "trigger_price": "0",
      "trigger_condition": "",
      "triggered": false,
      "original_amount": "0.1",
      "amount": "0.1",
      "unfilled_amount": "0.1",
      "filled_amount": "0",
      "label": "",
      "salt": "396049",
      "signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
    }
  ],
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object
> amount string trade amount
> average_price string avg price of trade
> creation_timestamp integer trade creation timestamp
> creator string wallet address of account
> direction string order type
> filled_amount string amount of order filled
> instrument_name string instrument name of executed order
> is_liquidation bool is a liquidation order
> label string order label
> last_update_timestamp integer last updated timestamp of order
> order_id string a unique id for each order
> order_state string state of order
> order_type string type of order
> post_only bool is order post only
> price string price of order
> reduce_only bool is order reduce only
> time_in_force string time to force order
> unfilled_amount string unfilled amount of order
> Trades Array of object Array of trades
> id string id of given trade
> instrument_name string instrument name of given trade
> price string price name of given trade
> side string side of given trade
> amount string amount of given trade
> timestamp integer timestamp of given trade
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_user_trades_by_order

fetches trade history for a given order

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_order",
  "params": {
      "order-id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "sort_by": "DESC",
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_order",
  "params": {
      "order-id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "sort_by": "DESC",
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_order",
  "params": {
      "order-id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "sort_by": "DESC",
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_user_trades_by_order",
    "params": {
      "order-id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "sort_by": "DESC",
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_user_trades_by_order",
    params: {
      "order-id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      sort_by: "DESC",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
order-id true string id of the order
sort_by false string sorting of trade based on timestamp. Possible values: ASC, DESC
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": [
    {
      "id": "5070a36a-a6d9-4d76-8859-5ff0755ea3c2",
      "trade_sequence": 2,
      "side": "sell",
      "price": "2380",
      "amount": "0.1",
      "incoming_order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "book_order_id": "b914d2d0-b551-4975-a907-61b148e2e2a3",
      "maker": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
      "taker": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
      "maker_order": {
        "instrument_name": "ETH/USDT",
        "order_id": "b914d2d0-b551-4975-a907-61b148e2e2a3",
        "order_type": "limit",
        "order_state": "filled",
        "direction": "buy",
        "time_in_force": "GTC",
        "reduce_only": false,
        "is_liquidation": false,
        "post_only": false,
        "account": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
        "order_signer": "0x0000000000000000000000000000000000000000",
        "creation_timestamp": 1728041366119,
        "last_update_timestamp": 1728041366119,
        "expiration": 1729041366119,
        "price": "2380",
        "average_price": "2380",
        "trigger_price": "0",
        "trigger_condition": "",
        "triggered": false,
        "original_amount": "0.1",
        "amount": "0.1",
        "unfilled_amount": "0.1",
        "filled_amount": "0.1",
        "label": "",
        "salt": "471058",
        "signature": "0x1522f5071eb9e9052a4847585207730ee27d8086859bf3f2b53677718d9ba4646c5a8c58a8067e964666dc002b29b38860086fc4043e1a092bd27df532e0a4ab1b"
      },
      "taker_order": {
        "instrument_name": "ETH/USDT",
        "order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
        "order_type": "limit",
        "order_state": "open",
        "direction": "sell",
        "time_in_force": "GTC",
        "reduce_only": false,
        "is_liquidation": false,
        "post_only": false,
        "account": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
        "order_signer": "0x0000000000000000000000000000000000000000",
        "creation_timestamp": 1728041366138,
        "last_update_timestamp": 1728041366138,
        "expiration": 1729041366138,
        "price": "2380",
        "average_price": "0",
        "trigger_price": "0",
        "trigger_condition": "",
        "triggered": false,
        "original_amount": "0.1",
        "amount": "0.1",
        "unfilled_amount": "0.1",
        "filled_amount": "0",
        "label": "",
        "salt": "396049",
        "signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
      },
      "status": "",
      "timestamp": 1728041366144,
      "instrument_id": 1,
      "instrument_name": "ETH/USDT",
      "tx_hash": "",
      "is_sync": false,
      "salt": "471058",
      "expiration": 1729041366119,
      "maker_signature": "0x1522f5071eb9e9052a4847585207730ee27d8086859bf3f2b53677718d9ba4646c5a8c58a8067e964666dc002b29b38860086fc4043e1a092bd27df532e0a4ab1b",
      "taker_signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
    }
  ],
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object Array of trade execution details.
> id string Unique ID of the trade.
> trade_sequence integer Sequence number of the trade.
> side string The side of the trade, either "buy" or "sell".
> price string The price at which the trade occurred.
> amount string The trade amount.
> incoming_order_id string ID of the incoming order.
> book_order_id string ID of the book order involved in the trade.
> maker string Wallet address of the maker.
> taker string Wallet address of the taker.
> maker_order object Details of the maker's order.
> taker_order object Details of the taker's order.
> status string The status of the trade (e.g., "open", "filled", "cancelled").
> timestamp integer Timestamp of the trade.
> instrument_id integer The ID of the instrument traded.
> instrument_name string The name of the instrument (e.g., "ETH/USDT").
> tx_hash string Transaction hash associated with the trade.
> is_sync bool Indicates if the trade is synchronized.
> salt string A unique salt value associated with the trade.
> expiration integer Expiration timestamp of the trade.
> maker_signature string Signature of the maker.
> taker_signature string Signature of the taker.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_user_trades_by_instrument

fetches trade history of an instrument for an account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_instrument",
  "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_user_trades_by_instrument",
    "params": {
      "instrument_name": "ETH-PERP",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_user_trades_by_instrument",
    params: {
      instrument_name: "ETH-PERP",
      count: 10,
      offset: 1,
      start_timestamp: 1731222656,
      end_timestamp: 1732000257,
      sort_by: "DESC",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
instrument_name true string instrument name for which we need trade history
count true integer number of records want to fetch. In case of pagination number of records per page.
offset false integer If pagination is required offset is needed as parameter
start_timestamp true integer time from which you want to fetch order history record
end_timestamp true integer Current time in seconds
sort_by false string sorting of trade based on timestamp. Possible values: ASC, DESC
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "id": "5070a36a-a6d9-4d76-8859-5ff0755ea3c2",
    "trade_sequence": 2,
    "side": "sell",
    "price": "2380",
    "amount": "0.1",
    "incoming_order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
    "book_order_id": "b914d2d0-b551-4975-a907-61b148e2e2a3",
    "maker": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
    "taker": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
    "status": "",
    "timestamp": 1728041366144,
    "instrument_id": 1,
    "instrument_name": "ETH/USDT",
    "tx_hash": "",
    "is_sync": false,
    "salt": "471058",
    "expiration": 1729041366119,
    "maker_signature": "0x1522f5071eb9e9052a4847585207730ee27d8086859bf3f2b53677718d9ba4646c5a8c58a8067e964666dc002b29b38860086fc4043e1a092bd27df532e0a4ab1b",
    "taker_signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
  },
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object Array of trade execution details.
> id string Unique ID of the trade.
> trade_sequence integer Sequence number of the trade.
> side string The side of the trade, either "buy" or "sell".
> price string The price at which the trade occurred.
> amount string The trade amount.
> incoming_order_id string ID of the incoming order.
> book_order_id string ID of the book order involved in the trade.
> maker string Wallet address of the maker.
> taker string Wallet address of the taker.
> maker_order object Details of the maker's order.
> taker_order object Details of the taker's order.
> status string The status of the trade (e.g., "open", "filled", "cancelled").
> timestamp integer Timestamp of the trade.
> instrument_id integer The ID of the instrument traded.
> instrument_name string The name of the instrument (e.g., "ETH/USDT").
> tx_hash string Transaction hash associated with the trade.
> is_sync bool Indicates if the trade is synchronized.
> salt string A unique salt value associated with the trade.
> expiration integer Expiration timestamp of the trade.
> maker_signature string Signature of the maker.
> taker_signature string Signature of the taker.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_user_trades_by_kind

fetches trade history by instrument kind for an account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_user_trades_by_kind",
  "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_user_trades_by_kind",
    "params": {
      "kind": "option",
      "count": 10,
      "offset": 1,
      "start_timestamp": 1731222656,
      "end_timestamp": 1732000257,
      "sort_by": "DESC",
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_user_trades_by_kind",
    params: {
      kind: "option",
      count: 10,
      offset: 1,
      start_timestamp: 1731222656,
      end_timestamp: 1732000257,
      sort_by: "DESC",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
kind true enum instrument kind for which we need trade history. possible enum values: spot, perpetual, option, future, any
count true integer number of records want to fetch. In case of pagination number of records per page.
offset false integer If pagination is required offset is needed as parameter
start_timestamp true integer time from which you want to fetch order history record
end_timestamp true integer Current time in seconds
sort_by false string sorting of trade based on timestamp. Possible values: ASC, DESC
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "id": "5070a36a-a6d9-4d76-8859-5ff0755ea3c2",
    "trade_sequence": 2,
    "side": "sell",
    "price": "2380",
    "amount": "0.1",
    "incoming_order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
    "book_order_id": "b914d2d0-b551-4975-a907-61b148e2e2a3",
    "maker": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
    "taker": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
    "maker_order": {
      "instrument_name": "ETH/USDT",
      "order_id": "b914d2d0-b551-4975-a907-61b148e2e2a3",
      "order_type": "limit",
      "order_state": "filled",
      "direction": "buy",
      "time_in_force": "GTC",
      "reduce_only": false,
      "is_liquidation": false,
      "post_only": false,
      "account": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
      "order_signer": "0x0000000000000000000000000000000000000000",
      "creation_timestamp": 1728041366119,
      "last_update_timestamp": 1728041366119,
      "expiration": 1729041366119,
      "price": "2380",
      "average_price": "2380",
      "trigger_price": "0",
      "trigger_condition": "",
      "triggered": false,
      "original_amount": "0.1",
      "amount": "0.1",
      "unfilled_amount": "0.1",
      "filled_amount": "0.1",
      "label": "",
      "salt": "471058",
      "signature": "0x1522f5071eb9e9052a4847585207730ee27d8086859bf3f2b53677718d9ba4646c5a8c58a8067e964666dc002b29b38860086fc4043e1a092bd27df532e0a4ab1b"
    },
    "taker_order": {
      "instrument_name": "ETH/USDT",
      "order_id": "8a8221b8-22b2-4771-99e0-964cd73241a5",
      "order_type": "limit",
      "order_state": "open",
      "direction": "sell",
      "time_in_force": "GTC",
      "reduce_only": false,
      "is_liquidation": false,
      "post_only": false,
      "account": "0x83322a4feb99ae47afc4aa93dd85a4ae71e7b9eb",
      "order_signer": "0x0000000000000000000000000000000000000000",
      "creation_timestamp": 1728041366138,
      "last_update_timestamp": 1728041366138,
      "expiration": 1729041366138,
      "price": "2380",
      "average_price": "0",
      "trigger_price": "0",
      "trigger_condition": "",
      "triggered": false,
      "original_amount": "0.1",
      "amount": "0.1",
      "unfilled_amount": "0.1",
      "filled_amount": "0",
      "label": "",
      "salt": "396049",
      "signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
    },
    "status": "",
    "timestamp": 1728041366144,
    "instrument_id": 1,
    "instrument_name": "ETH/USDT",
    "tx_hash": "",
    "is_sync": false,
    "salt": "471058",
    "expiration": 1729041366119,
    "maker_signature": "0x1522f5071eb9e9052a4847585207730ee27d8086859bf3f2b53677718d9ba4646c5a8c58a8067e964666dc002b29b38860086fc4043e1a092bd27df532e0a4ab1b",
    "taker_signature": "0x7afc074666dffd2241e7aaeedfb24e7725c86585c36947ac72b634ae36033b2e646ee1856c228f1ea3383c5ee10d5650377885571872e5259e1c682056d3067c1b"
  },
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result array of object Array of trade execution details.
> id string Unique ID of the trade.
> trade_sequence integer Sequence number of the trade.
> side string The side of the trade, either "buy" or "sell".
> price string The price at which the trade occurred.
> amount string The trade amount.
> incoming_order_id string ID of the incoming order.
> book_order_id string ID of the book order involved in the trade.
> maker string Wallet address of the maker.
> taker string Wallet address of the taker.
> maker_order object Details of the maker's order.
> taker_order object Details of the taker's order.
> status string The status of the trade (e.g., "open", "filled", "cancelled").
> timestamp integer Timestamp of the trade.
> instrument_id integer The ID of the instrument traded.
> instrument_name string The name of the instrument (e.g., "ETH/USDT").
> tx_hash string Transaction hash associated with the trade.
> is_sync bool Indicates if the trade is synchronized.
> salt string A unique salt value associated with the trade.
> expiration integer Expiration timestamp of the trade.
> maker_signature string Signature of the maker.
> taker_signature string Signature of the taker.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

Combo Blocks

Coming Soon ..

Block Trade

Coming Soon ..

Account Management

private/get_deposits

This method returns the deposit information

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_deposits",
  "params": {
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_deposits",
  "params": {}
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_deposits",
    "params": {}
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_deposits",
  "params": {
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_deposits",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

This method does not require any parameters.

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "USDT": [
      {
        "amount": "4000",
        "asset_address": "0xf96ea8426edc799ea7dbf34c86b565722e52ccce",
        "asset_name": "USDT",
        "is_pending": false,
        "timestamp": 1729685765,
        "tx_hash": "0x20af98c73c05d63e3f35cceb9f427c8b13d1e4c7435a741e2095e27198c114e2",
        "user": "0x3096e206da35141d5b23ae16c42c070f7df082a8"
      }
    ]
  },
  "usIn": 1731158986873932,
  "usOut": 1731158986874629,
  "usDiff": 697
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object
asset array List of deposit transactions for asset.
›› amount string The amount of the deposit in the specified asset.
›› asset_address string The address of the asset being deposited.
›› asset_name string The name of the asset
›› is_pending bool Indicates whether the deposit is pending
›› timestamp integer The timestamp of the deposit transaction.
›› tx_hash string The transaction hash of the deposit.
›› user string The address of the user who made the deposit.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/create_api_key

This method returns the api keys and secrets of account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/create_api_key",
  "params": {
    "scope" : 1,
    "name": "api_key_name"
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/create_api_key",
  "params": {
    "scope" : 1,
    "name": "api_key_name"
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/create_api_key",
  "params": {
    "scope" : 1,
    "name": "api_key_name"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/create_api_key",
    "params": {
      "scope" : 1,
      "name": "api_key_name"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/create_api_key",
    params: {
      scope: 1,
      name: "api_key_name",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
scope true integer permission level to be given to the api key. 0 for admin level access, 1 for read-write access and 2 for read-only access
name false string Name you want to give to the api-key

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "account": "0x78deb9225c3f28d12922913fec978e4dc90e1aa4",
    "api_key": "po-tNE_s3OT81LyOH9bSgqNNQGdm8MuHINDFhIycUY4=",
    "api_secret": "9dc8d4ceddca03c8cc8a9971613a80e26b25378e03bf7d11902bad9dde103ea2.f32d98081c9854f1e23a3834d44ebb531b50092e7dd6edacd806d4f8fec0bfe9"
  },
  "usIn": 1731925517114053,
  "usOut": 1731925517162640,
  "usDiff": 48587
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object
account string Account for which api key is generated
api_key string Api key value
api_secret string Api key secret value
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_api_keys

This method returns the api keys and secrets of account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_api_keys",
  "params": {

  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_api_keys",
  "params": {}
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_api_keys",
  "params": {

  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_api_keys",
    "params": {}
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_api_keys",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

This method does not require any parameters.

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "apiKeys": [
      {
        "api_key": "SYNDR_API_KEY",
        "api_secret": "SYNDR_API_SECRET",
        "createdAt": 1729167008,
        "name": "",
        "scope": 1,
        "updatedAt": 1729167008
      },
      {
        "api_key": "64hbiobGyj9gHdiAKtIPuJhoGdx8k3b4JQVjl_qjkzg=",
        "api_secret": "d4a769892eed65eecda5a21ad0497d925c19c55b343f861ed83470d4fe1d52f5.d374136a0edf16b626898013eaa325cc17a91244f33dbf6c5b3d6e7c66b5219b",
        "createdAt": 1729685640,
        "name": "",
        "scope": 1,
        "updatedAt": 1729685640
      },
      {
        "api_key": "KBihoZta-GWKt_ly6mnsXyjcRXJELiK-wDRs9eDTEos=",
        "api_secret": "9cf6d4e289a93538d9077a13ea855a680cb93963d11981659262101166bed3b1.34d16e1d7566ba797baa4d64fa4365c159029648c6246ef15bb00b039f7efd8b",
        "createdAt": 1730811890,
        "name": "",
        "scope": 1,
        "updatedAt": 1730811890
      }
    ]
  },
  "usIn": 1731162594461329,
  "usOut": 1731162594462337,
  "usDiff": 1008
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object
apiKeys array List of api keys currently for an account
›› api_key string Api key value
›› api_secret string Api key secret value
›› created_at integer timestamp when api key was created
›› name string name given to the api key secret pair value
›› updated_at integer last updated timestamp of the api key.
›› scope integer permission level for the key. 0 for Admin level access to the account, 1 for read- write access to the account and 2 for only read access to the account.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/deactivate_api_key

deactivate api keys


curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/deactivate_api_key",
  "params": {
    "api_key": "api-key",
    "api_secret": "api-secret"
  }
}'

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/deactivate_api_key",
    "params": {
        "api_key": "api-key",
        "api_secret": "api-secret"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/deactivate_api_key",
  "params": {
    "api_key": "api-key",
    "api_secret": "api-secret"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/deactivate_api_key",
    "params": {
        "api_key": "api-key",
        "api_secret": "api-secret"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/deactivate_api_key",
    params: {
      api_key: "api-key",
      api_secret: "api-secret",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
api-key true string api-key which needs to be deactivated
api_secret true string secret related to the given api key

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "apiKeys": "Success"
  },
  "usIn": 1731163424662981,
  "usOut": 1731163424663653,
  "usDiff": 672
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_portfolio_margin_data

get portfolio margin data

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_portfolio_margin_data",
  "params": {
    "from": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
    "currency": "USDCUSD"
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_portfolio_margin_data",
  "params": {
    "from": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
    "currency": "USDCUSD"
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_portfolio_margin_data",
  "params": {
    "from": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
    "currency": "USDCUSD"
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_portfolio_margin_data",
    "params": {
        "from": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
        "currency": "USDCUSD"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_portfolio_margin_data",
    params: {
      from: "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
      currency: "USDCUSD",
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
from true string account address of the account
currency true string currency in which portfolio margin needs to be calculated
{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "future_loss_array": [
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0"
    ],
    "futures_contingency": "0",
    "options_contingency": "0",
    "options_loss_array": [
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0",
      "0"
    ],
    "total_loss_array": ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
  },
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object Portfolio margin details- future_loss_array, futures_contingency , options_contingency, options_loss_array, total_loss_array
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

private/get_account_summary

This method returns the account summary.

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_account_summary",
  "params": {
    "timestamp": 915915
  }
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/get_account_summary",
  "params": {
    "timestamp": 915915
  }
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;


    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/get_account_summary",
    "params": {
        "timestamp": 915915
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,

  "method": "private/get_account_summary",
  "params": {
    "timestamp": 915915
  }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/get_account_summary",
    params: {
      timestamp: 915915,
    },
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

Parameter Required Type Description
timestamp true integer Current time in seconds

An example of the response

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "available_balance": "7198.286965975698944",
    "available_withdrawable_funds": "3515.394545175698944",
    "collateral": {
      "USDT": "4000"
    },
    "delta_total": {
      "ETHUSD": "8"
    },
    "equity": "7684.2952608",
    "initial_margin": "486.008294824301056",
    "initial_margin_utilization": "6.3246957375985",
    "is_cancel_on_disconnect": false,
    "is_portfolio_margined": false,
    "maintenance_margin": "243.008035416301056",
    "maintenance_margin_utilization": "3.1623984655556",
    "open_orders_im": "0",
    "realized_pnl": "1",
    "status": "ACTIVE",
    "total_pnl": "3682.8924208",
    "unrealized_pnl": "3681.8924208",
    "updated_at": "915915"
  },
  "usIn": 1731158146707154,
  "usOut": 1731158146708820,
  "usDiff": 1666
}

Response

Name Type Description
jsonrpc string The JSON-RPC version
id integer The ID that was sent in the request.
result object Contains the account information.
available_balance string Total available funds in the account.
available_withdrawable_funds string Total available funds that can be withdrawn.
collateral object The current collateral in different currencies.
delta_total object The sum of position deltas for each currency.
equity string The account's current equity, which represents the total value.
initial_margin string The projected initial margin for the account's positions.
initial_margin_utilization string The percentage of the available margin being utilized.
is_cancel_on_disconnect bool True if orders are canceled when disconnected from the server.
is_portfolio_margined bool True if portfolio margin is enabled for the account.
maintenance_margin string The maintenance margin required to maintain positions.
maintenance_margin_utilization string The percentage of the maintenance margin currently utilized.
open_orders_im string The total initial margin required for open orders.
realized_pnl string The realized profit or loss for the account.
status string The current status of the account (e.g., ACTIVE).
total_pnl string The total profit or loss for the account, including realized and unrealized.
unrealized_pnl string The unrealized profit or loss for the account.
updated_at string The timestamp of the last update to the account information.
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing the request duration.

private/toggle_portfolio_margin

switch margin mode in the account

curl --location 'https://dev-api.syndr.trade/api/v1' \
--header 'syndr-api-key: SYNDR_API_KEY' \
--header 'syndr-api-secret: SYNDR_API_SECRET' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/toggle_portfolio_margin",
  "params": {}
}'
import requests
import json

url = "https://dev-api.syndr.trade/api/v1"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/toggle_portfolio_margin",
  "params": {}
})
headers = {
  'syndr-api-key': 'SYNDR_API_KEY',
  'syndr-api-secret': 'SYNDR_API_SECRET',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://dev-api.syndr.trade/api/v1"
  method := "POST"

  payload := strings.NewReader(`{
  "jsonrpc": "2.0",
  "id": 7365,
  "method": "private/toggle_portfolio_margin",
  "params": {}
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("syndr-api-key", "SYNDR_API_KEY")
  req.Header.Add("syndr-api-secret", "SYNDR_API_SECRET")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("syndr-api-key", "SYNDR_API_KEY".parse()?);
    headers.insert("syndr-api-secret", "SYNDR_API_SECRET".parse()?);
    headers.insert("Content-Type", "application/json".parse()?);

    let data = r#"{
    "jsonrpc": "2.0",
    "id": 7365,
    "method": "private/toggle_portfolio_margin",
    "params": {}
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://dev-api.syndr.trade/api/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
var request = require("request");
var options = {
  method: "POST",
  url: "https://dev-api.syndr.trade/api/v1",
  headers: {
    "syndr-api-key": "SYNDR_API_KEY",
    "syndr-api-secret": "SYNDR_API_SECRET",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 7365,
    method: "private/toggle_portfolio_margin",
    params: {},
  }),
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Parameters

This method does not require any parameters.

{
  "jsonrpc": "2.0",
  "id": 7365,
  "result": {
    "portfolio_margin_toggle": true
  },
  "usIn": 1731162610844027,
  "usOut": 1731162610845220,
  "usDiff": 1193
}

Response

Field Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The ID that was sent in the request.
result object
usIn integer Server request initiation timestamp.
usOut integer Server response completion timestamp.
usDiff integer Time difference (usOut - usIn), representing request duration.

Subscription Management

Our WebSocket API allows real-time communication with our platform, enabling efficient access to data feeds and other updates on various topics through channels. To access these channels, you need to establish a WebSocket connection.

public/subscribe

Can be used to subscribe to one or more channels.

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["ticker.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))

Parameters

Parameter Required Type Enum Description
channels true array channels to subscribe

An example of the response

{
  "jsonrpc": "2.0",
  "id": 3041,
  "result": ["ticker.ETH-PERP"]
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result array array of string.

private/subscribe

Can be used to subscribe to one or more channels.

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3679,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.orders.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
      await websocket.send(msg)
      while websocket.open:
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))

Parameters

Parameter Required Type Enum Description
channels true array channels to subscribe

An example of the response

{
  "jsonrpc": "2.0",
  "id": 3041,
  "result": ["user.orders.ETH-PERP"]
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result array array of string.

public/unsubscribe

Can be used to unsubscribe from one or more channels.

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/unsubscribe",
  "params" : {
    "channels": ["ticker.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
       await websocket.send(msg)
       while websocket.open:
           response = await websocket.recv()
           # do something with the response...
           print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))

Parameters

Parameter Required Type Enum Description
channels true array channels to subscribe

An example of the response

{
  "jsonrpc": "2.0",
  "id": 3041,
  "result": ["ticker.ETH-PERP"]
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result array array of string.

private/unsubscribe

Can be used to subscribe from one or more channels.

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3679,
  "method" : "private/unsubscribe",
  "params" : {
    "channels": ["user.orders.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
       await websocket.send(msg)
       while websocket.open:
           response = await websocket.recv()
           # do something with the response...
           print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))

Parameters

Parameter Required Type Enum Description
channels true array channels to subscribe

An example of the response

{
  "jsonrpc": "2.0",
  "id": 3041,
  "result": ["user.orders.ETH-PERP"]
}

Response

Name Type Description
jsonrpc string The JSON-RPC version (2.0).
id integer The id that was sent in the request.
result array array of string.


SUBSCRIPTIONS

Public Channels

ticker.{instrument_name}

Get updated ticker for any instrument

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["ticker.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["ticker.ETH-PERP"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["ticker.ETH-PERP"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["ticker.ETH-PERP"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "channel": "ticker.ETH-PERP",
    "data": {
      "best_ask_amount": "0",
      "best_ask_price": "0",
      "best_bid_amount": "3",
      "best_bid_price": "2267.5",
      "contract_size": "0.001",
      "funding_8h": "0",
      "funding_rate": "-0.5",
      "index_price": "2315.93869757",
      "instrument_name": "ETH-PERP",
      "last_price": "3152",
      "mark_price": "2304.35900408215",
      "max_price": "2338.92438914338225",
      "min_price": "2269.79361902091775",
      "open_interest": "65.87",
      "stats": {
        "high": "2338.92438914338225",
        "low": "2269.79361902091775",
        "volume": "101.318",
        "volume_usd": "333027.3492"
      },
      "timestamp": "1722849361329"
    }
  }
}

Response

Name Type Description
data object
› instrument_name string Index price
› timestamp integer Timestamp of ticker in milliseconds
› best_ask_amount string Best ask amount
› best_ask_price string Best ask price
› best_bid_amount string Best bid amount
› best_bid_price string Best bid price
› contract_size string Contract size of instrument
› index_price string Price of underlying index
› interest_value string Interest value
› last_price string Price of last trade of instrument
› mark_price string Mark price of instrument
› open_interest string Open interest
› max_price string Max allowed price for new order
› min_price string Min allowed price for new order
› funding_rate string (Only for perpetual) Current funding rate
› best_ask_iv string (Only for option) IV of best ask
› best_ask_delta string (Only for option) delta value for best ask
› best_ask_iv string (Only for option) IV of best ask
› best_bid_delta string (Only for option) delta value for best bid
› best_bid_iv string (Only for option) IV of best bid
› strike string (Only for option) The strike price of the option
› is_call bool (Only for option) Whether the option a call option or not
› delta string (Only for option) The delta value for the option
› gamma string (Only for option) The gamma value for the option
› rho string (Only for option) The rho value for the option
› sigma string (Only for option) The sigma value for the option
› theta string (Only for option) The theta value for the option
› vega string (Only for option) The vega value for the option
› stats object Stats
› › high string 24h high price
› › low string 24h low price
› › price_change string 24h price change
› › volume string 24h volume in underlying
› › volume_usd string 24h volume in USD

book.{instrument_name}.15.raw

Get updated orderbook data of any instrument

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["book.ETH-PERP.15.raw"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["book.ETH-PERP.15.raw"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["book.ETH-PERP.15.raw"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["book.ETH-PERP.15.raw"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "channel": "book.ETH-PERP.15.raw",
    "data": {
      "type": "change",
      "asks": [],
      "bids": [["2332.6", "5"]],
      "change_id": 2,
      "previous_change_id": 1,
      "instrument_name": "ETH-PERP",
      "timestamp": "1722850180027"
    }
  }
}

Response

Name Type Description
data object
› asks array list of asks with their strike price and volume
› bids array list of bids with their strike price and volume
› instrument_name string name of the instrument
› timestamp number Timestamp of ticker in milliseconds
› type string what type of change it is. i.e. update, change
› change_id number unique id of the change send currently in channel
› previous_change_id number unique id of the change send previously in channel

book.{instrument_name}.15.duration

Get updated orderbook data of any instrument

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["book.ETH-PERP.15.100ms"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["book.ETH-PERP.15.100ms"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["book.ETH-PERP.15.100ms"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["book.ETH-PERP.15.100ms"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscription",
  "params": {
    "channel": "book.ETH-PERP.15.100ms",
    "data": {
      "asks": [],
      "bids": [["2332.6", "5"]],
      "instrument_name": "ETH-PERP",
      "timestamp": "1722850180027"
    }
  }
}

Response

Name Type Description
data object
› asks array list of asks with their strike price and volume
› bids array list of bids with their strike price and volume
› instrument_name string name of the instrument
› timestamp integer Timestamp of ticker in milliseconds

trades.{instrument_name}.raw

Notification of new trades for any instrument

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["trades.ETH-PERP.raw"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["trades.ETH-PERP.raw"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["trades.ETH-PERP.raw"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["trades.ETH-PERP.raw"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "trades.ETH-PERP.raw",
    "data": {
      "id": "4820577a-fb67-4f68-8df4-8aff75b2406d",
      "size": "0.1",
      "price": "2093.439999990001",
      "side": "buy",
      "timestamp": 1681659457383,
      "instrument_name": "ETH-PERP"
    }
  }
}

Response

Name Type Description
data object
› id string Unique ID of the trade
› side string Side of trades buy or sell
› size string Size in terms of underlying currency i.e 1ETH, 1.5BTC
› price string Price at which trade executed
› instrument_name string Name of the instrument
› timestamp number The timestamp (milliseconds since the Unix epoch)

quotes.{instrument_name}

Notification of new trades for any instrument

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "public/subscribe",
  "params" : {
    "channels": ["quotes.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["quotes.ETH-PERP"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["quotes.ETH-PERP"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["quotes.ETH-PERP"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "quotes.ETH-PERP",
    "data": {
      "timestamp": 1681659457383,
      "instrument_name": "ETH-PERP",
      "best_bid_price": 2550,
      "best_bid_amount": 2,
      "best_bid_iv": 1.1,
      "best_bid_delta": 0.1,
      "best_ask_price": 2557,
      "best_ask_amount": 3,
      "best_ask_iv": 4,
      "best_ask_delta": 0.1
    }
  }
}

Response

Name Type Description
data object
› instrument_name string Name of the instrument
› timestamp number The timestamp (milliseconds since the Unix epoch)
› best_bid_price number The current best bid price, null if there aren't any bids
› best_bid_amount number It represents the requested order size of all best bids
› best_bid_iv number (Only for option) implied volatility for best bid
› best_bid_delta number (Only for option) The delta value for the best bid
› best_ask_price number The current best ask price, null if there aren't any asks
› best_ask_amount number It represents the requested order size of all best asks
› best_ask_iv number (Only for option) implied volatility for best ask
› best_ask_delta number (Only for option) The delta value for the best ask

Private Channels

user.fills.{instrument_name}

Get notification of new trades for instrument mentioned specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.fills.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.fills.ETH-PERP"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.fills.ETH-PERP"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.fills.ETH-PERP"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.fills.ETH-PERP",
    "data": {
      "id": "799f5759-fb47-4a55-a29e-2a1e1b83ec34,",
      "trade_sequence": 1,
      "side": "sell",
      "price": 2100,
      "amount": 1,
      "incoming_order_id": "9eedb203-d593-4302-8554-cf41f23b0fe0",
      "book_order_id": "45d7c70d-f394-4190-afb7-60ebcba552b2",
      "maker": "0x78Deb9225c3F28D12922913Fec978e4dC90E1aa4",
      "taker": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
      "instrument_id": 527,
      "contract_size": 0.001,
      "timestamp": 1681703006344,
      "instrument_name": "ETH-PERP",
      "txn_hash": "",
      "is_sync": false,
      "salt": 92088,
      "expiration": 1722509314,
      "maker_signature": "0x24785a4907f40da3ca931798736b92703d8665f261c025a075ad9b29458bf54f10e674c622203f5638a7850867878cbc186caec10c82f0229a5f0ed16af784e51b",
      "taker_signature": "0xc429db3d1556b6324d3ee4d9dc712f6c00cfd3c274112187f688fe0e84b0dd7a45e14db4bae3fe49c8fac95ee9fb11cbc7e504366b0285a36a4c3362315167841c"
    }
  }
}

Response

Name Type Description
data object
› side string Side of trades buy or sell
› amount string Size in terms of underlying currency i.e 1ETH, 2.5BTC
› price string Price at which trade executed
› instrument_name string Name of the instrument
› id string Unique ID of the trade
› trade_sequence number Sequence of batch in which trade is executed on chain
› incoming_order_id string Unique ID of the taker order
› book_order_id string Unique ID of the maker order
› maker string public address of maker account
› taker string public address of taker account
› instrument_id number id of the instrument
› contract_size number minimum size of the instrument which is tradable
› txn_hash string hash of the transaction which executed trade on chain
› is_sync bool Is current trade in sync onchain and offchain
› expiration number time in milliseconds after which trade will expire if not executed
› timestamp number The timestamp (milliseconds since the Unix epoch)
› maker_signature string signature which was used to place the order by maker
› taker_signature string signature which was used to place the order by taker

user.fills.ALL

Get notification of new trades for all instruments specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.fills.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.fills.ETH-PERP"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.fills.ETH-PERP"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.fills.ETH-PERP"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.fills.ETH-PERP",
    "data": {
      "id": "799f5759-fb47-4a55-a29e-2a1e1b83ec34,",
      "trade_sequence": 1,
      "side": "sell",
      "price": 2100,
      "amount": 1,
      "incoming_order_id": "9eedb203-d593-4302-8554-cf41f23b0fe0",
      "book_order_id": "45d7c70d-f394-4190-afb7-60ebcba552b2",
      "maker": "0x78Deb9225c3F28D12922913Fec978e4dC90E1aa4",
      "taker": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
      "instrument_id": 527,
      "contract_size": 0.001,
      "timestamp": 1681703006344,
      "instrument_name": "ETH-PERP",
      "txn_hash": "",
      "is_sync": false,
      "salt": 92088,
      "expiration": 1722509314,
      "maker_signature": "0x24785a4907f40da3ca931798736b92703d8665f261c025a075ad9b29458bf54f10e674c622203f5638a7850867878cbc186caec10c82f0229a5f0ed16af784e51b",
      "taker_signature": "0xc429db3d1556b6324d3ee4d9dc712f6c00cfd3c274112187f688fe0e84b0dd7a45e14db4bae3fe49c8fac95ee9fb11cbc7e504366b0285a36a4c3362315167841c"
    }
  }
}

Response

Name Type Description
data object
› side string Side of trades buy or sell
› amount string Size in terms of underlying currency i.e 1ETH, 2.5BTC
› price string Price at which trade executed
› instrument_name string Name of the instrument
› id string Unique ID of the trade
› trade_sequence number Sequence of batch in which trade is executed on chain
› incoming_order_id string Unique ID of the taker order
› book_order_id string Unique ID of the maker order
› maker string public address of maker account
› taker string public address of taker account
› instrument_id number id of the instrument
› contract_size number minimum size of the instrument which is tradable
› txn_hash string hash of the transaction which executed trade on chain
› is_sync bool Is current trade in sync onchain and offchain
› expiration number time in milliseconds after which trade will expire if not executed
› timestamp number The timestamp (milliseconds since the Unix epoch)
› maker_signature string signature which was used to place the order by maker
› taker_signature string signature which was used to place the order by taker

user.orders.{instrument_name}.raw

Get notification about orders for instrument mentioned specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.orders.ETH-PERP.raw"],
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.orders.ETH-PERP.raw"],
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.orders.ETH-PERP.raw"],
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.orders.ETH-PERP.raw"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.orders.ETH-PERP.raw",
    "data": {
      "update_type": "open",
      "order": {
        "instrument_name": "ETH-PERP",
        "order_id": "cd1f2039-61af-4569-b637-69c8309251ef",
        "order_type": "limit",
        "order_state": "open",
        "direction": "buy",
        "time_in_force": "IOC",
        "reduce_only": false,
        "is_liquidation": false,
        "post_only": false,
        "creator": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
        "order_signer": "0x0000000000000000000000000000000000000000",
        "contract_size": 0.001,
        "creation_timestamp": 1722419045,
        "last_update_timestamp": 1722419045,
        "expiration": 1722505445,
        "price": 2500,
        "average_price": 2500,
        "trigger_price": 2500,
        "trigger_condition": "",
        "triggered": false,
        "original_amount": 1000,
        "amount": 1000,
        "unfilled_amount": 1000,
        "filled_amount": 0,
        "label": "BUY-limit order",
        "salt": 78420,
        "signature": "0x6a9e6f0d9c7e354a1e0caafe2cdbf877788a4a7515423a6fd1346c499db6d4276e9ec8b613a142c297c8a847f093be30f8f5344e2a06394763937559486db54e1b"
      }
    }
  }
}

Response

Name Type Description
data object
› update_type string Type of update for the order. i.e. 'open', 'filled' or 'cancelled'
› order object
› › creator string Address of creator of the order
› › direction string Side of order buy or sell
› › instrument_name string name of the instrument
› › amount string quantity of the order requested in terms of underlying currency
› › price string Limit price of the order
› › order_id number unique id for the order
› › order_type string type of order placement. i.e. limit, market, stop order
› › order_state string state in which order is currently. i.e. 'open', 'filled', 'cancelled'
› › time_in_force string Specifies how long the order remains in effect. Currently only GTC supported (good till canceled) IOC and more types coming soon.
› › reduce_only bool Is order reduce only. i.e. reduce open positions quantity
› › is_liquidation bool Is order due to liquidation of open positions
› › post_only bool order will be first put in order book before execution or will be cancelled
› › creator string account address of the user who created the order
› › order_signer string signer of the order for execution on chain
› › contract_size number minimum size of the instrument which is tradable
› › creation_timestamp number The timestamp of the order creation(milliseconds since the Unix epoch)
› › last_update_timestamp number The timestamp when order was last updated(milliseconds since the Unix epoch)
› › expiration number The timestamp of the order creation(milliseconds since the Unix epoch)
› › average_price number Average price of the order
› › trigger_price number Price at which order creation in system should be triggered
› › trigger_condition number Any other condition for order creation trigger apart from trigger price
› › original_amount number total amount of order placed
› › unfilled_amount number amount of order which is not executed yet
› › filled_amount number amount of order which is executed and converted into position
› › label string unique identification of type of order
› › signature number signature created while placing order for onchain execution

user.orders.ALL.raw

Get notification about orders for all instruments specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.orders.ALL.raw"],
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.orders.ALL.raw"],
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.orders.ALL.raw"],
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.orders.ALL.raw"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.orders.ALL.raw",
    "data": {
      "update_type": "open",
      "order": {
        "instrument_name": "ETH-PERP",
        "order_id": "cd1f2039-61af-4569-b637-69c8309251ef",
        "order_type": "limit",
        "order_state": "open",
        "direction": "buy",
        "time_in_force": "IOC",
        "reduce_only": false,
        "is_liquidation": false,
        "post_only": false,
        "creator": "0x83322a4feB99aE47AFC4aA93DD85a4ae71e7B9eB",
        "order_signer": "0x0000000000000000000000000000000000000000",
        "contract_size": 0.001,
        "creation_timestamp": 1722419045,
        "last_update_timestamp": 1722419045,
        "expiration": 1722505445,
        "price": 2500,
        "average_price": 2500,
        "trigger_price": 2500,
        "trigger_condition": "",
        "triggered": false,
        "original_amount": 1000,
        "amount": 1000,
        "unfilled_amount": 1000,
        "filled_amount": 0,
        "label": "BUY-limit order",
        "salt": 78420,
        "signature": "0x6a9e6f0d9c7e354a1e0caafe2cdbf877788a4a7515423a6fd1346c499db6d4276e9ec8b613a142c297c8a847f093be30f8f5344e2a06394763937559486db54e1b"
      }
    }
  }
}

Response

Name Type Description
data object
› update_type string Type of update for the order. i.e. 'open', 'filled' or 'cancelled'
› order object
› › creator string Address of creator of the order
› › direction string Side of order buy or sell
› › instrument_name string name of the instrument
› › amount string quantity of the order requested in terms of underlying currency
› › price string Limit price of the order
› › order_id number unique id for the order
› › order_type string type of order placement. i.e. limit, market, stop order
› › order_state string state in which order is currently. i.e. 'open', 'filled', 'cancelled'
› › time_in_force string Specifies how long the order remains in effect. Currently only GTC supported (good till canceled) IOC and more types coming soon.
› › reduce_only bool Is order reduce only. i.e. reduce open positions quantity
› › is_liquidation bool Is order due to liquidation of open positions
› › post_only bool order will be first put in order book before execution or will be cancelled
› › creator string account address of the user who created the order
› › order_signer string signer of the order for execution on chain
› › contract_size number minimum size of the instrument which is tradable
› › creation_timestamp number The timestamp of the order creation(milliseconds since the Unix epoch)
› › last_update_timestamp number The timestamp when order was last updated(milliseconds since the Unix epoch)
› › expiration number The timestamp of the order creation(milliseconds since the Unix epoch)
› › average_price number Average price of the order
› › trigger_price number Price at which order creation in system should be triggered
› › trigger_condition number Any other condition for order creation trigger apart from trigger price
› › original_amount number total amount of order placed
› › unfilled_amount number amount of order which is not executed yet
› › filled_amount number amount of order which is executed and converted into position
› › label string unique identification of type of order
› › signature number signature created while placing order for onchain execution

user.positions

Get notification about positions updates for all instruments specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.positions"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params": {
            "channels": ["user.positions"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params": {
            "channels": ["user.positions"]
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.positions"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.positions",
    "data": {
      "fills_manager": {
        "pending_fills": [],
        "latest_size": 20,
        "latest_average_price": 12,
        "latest_realized_pnl": 200
      },
      "instrument_name": "ETH_PERP"
    }
  }
}

Response

Name Type Description
data object
› underlying string Underlying currency of the instrument
› instrument_kind string Kind of instrument option, future, perpetual
› instrument_name string Name of the instrument
› updated_position object
› › position_delta string Delta of position
› › average_price string Average price of the position
› › contract_size string Contract size of the instrument
› › direction string Direction of active position buy, sell
› › index_price string Current index price of instrument
› › mark_price string Current mark price of instrument
› › realized_pnl string Realized pnl of the position = (Pnl from position) - trade_fee
› › size string Size of the position in no of contracts
› › size_in_base string Size of the position in terms of underlying
› › total_pnl string Total PNL of position = Unrealized + Realized
› › trade_fee string Total trade fee
› › unrealized_pnl string Unrealized pnl of the position
› › initial_margin string Initial margin blocked by position
› › maintenance_margin string Maintenance margin blocked by position
› › settlement_price string Last settlement price of instrument
› › is_synced_onchain bool Whether the position is in sync with onchain position
› › realized_funding string (only in perpetuals) Total funding payments made starting from last settlement

user.bursts.ALL

Get notification about bursts trades for all instruments specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.bursts.ALL"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.bursts.ALL"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.bursts.ALL"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.bursts.ALL"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.bursts.ALL",
    "data": {
      "instrument_name": "ETH-PERP",
      "sequence": 1,
      "tx_hash": "0x1324901u59013u59135913h95931593u5395913591351935135"
    }
  }
}

Response

Name Type Description
data object
› instrument_name string Name of the instrument
› sequence number Sequence of trade which failed on chain
› tx_hash string hash of the transaction which was executing the trade on chain

user.bursts.{instrument.name}

Get notification about bursts trades for instrument suscribed specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.bursts.ETH-PERP"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.bursts.ETH-PERP"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.bursts.ETH-PERP"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.bursts.ETH-PERP"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.bursts.ETH-PERP",
    "data": {
      "instrument_name": "ETH-PERP",
      "sequence": 1,
      "tx_hash": "0x1324901u59013u59135913h95931593u5395913591351935135"
    }
  }
}

Response

Name Type Description
data object
› instrument_name string Name of the instrument
› sequence number Sequence of trade which failed on chain
› tx_hash string hash of the transaction which was executing the trade on chain

user.transactions

Get notification about bursts trades for instrument suscribed specific to the authenticated account

import asyncio
import websockets
import json

msg = {
  "jsonrpc" : "2.0",
  "id" : 3041,
  "method" : "private/subscribe",
  "params" : {
    "channels": ["user.transactions"]
  }
}

async def call_api(msg):
   async with websockets.connect('wss://dev-api.syndr.trade/api/v1/ws/api/v1') as websocket:
      ###############
        # authenticate the connection before making the request
        # use public/auth method to authenticate the connection
      ###############
        await websocket.send(msg)
        # response of subscription request
        response = await websocket.recv()

        while websocket.open:
          # notifications from subscribed channels
          response = await websocket.recv()
          # do something with the response...
          print(response)

asyncio.get_event_loop().run_until_complete(call_api(json.dumps(msg)))
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
    let (mut websocket, _) = connect_async(url).await?;
    println!("Connected to the WebSocket server");

    // Authentication message
    let auth_message = json!({
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    });

    websocket.send(Message::Text(auth_message.to_string())).await?;
    let auth_response = websocket.next().await.unwrap().unwrap();
    println!("Authentication Response: {:?}", auth_response);

    // Subscription message
    let subscription_message = json!({
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
        "params" : {
          "channels": ["user.transactions"]
        }
    });

    websocket.send(Message::Text(subscription_message.to_string())).await?;
    let subscription_response = websocket.next().await.unwrap().unwrap();
    println!("Subscription Response: {:?}", subscription_response);

    // Listening to notifications
    while let Some(Ok(Message::Text(response))) = websocket.next().await {
        println!("Notification: {}", response);
    }

    Ok(())
}
  package main

import (
    "context"
    "fmt"
    "log"
    "time"

    "github.com/nhooyr/websocket"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
    defer cancel()

    url := "wss://dev-api.syndr.trade/api/v1/ws/api/v1"
    conn, _, err := websocket.Dial(ctx, url, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close(websocket.StatusNormalClosure, "closing")

    // Authenticate the connection
    authMsg := `{
        "jsonrpc": "2.0",
        "id": 3040,
        "method": "public/auth",
        "params": {
            "api_key": "YOUR_API_KEY",
            "api_secret": "YOUR_API_SECRET"
        }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(authMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, authResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Auth Response:", string(authResp))

    // Subscribe to a channel
    subMsg := `{
        "jsonrpc": "2.0",
        "id": 3041,
        "method": "private/subscribe",
    "params" : {
      "channels": ["user.transactions"]
    }
    }`
    err = conn.Write(ctx, websocket.MessageText, []byte(subMsg))
    if err != nil {
        log.Fatal(err)
    }

    _, subResp, err := conn.Read(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Subscription Response:", string(subResp))

    // Listen for notifications
    for {
        _, msg, err := conn.Read(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Println("Notification:", string(msg))
    }
}
const WebSocket = require("ws");

const url = "wss://dev-api.syndr.trade/api/v1/ws/api/v1";
const ws = new WebSocket(url);

ws.on("open", () => {
  console.log("Connected to WebSocket server");

  // Authenticate the connection
  const authMessage = JSON.stringify({
    jsonrpc: "2.0",
    id: 3040,
    method: "public/auth",
    params: {
      api_key: "YOUR_API_KEY",
      api_secret: "YOUR_API_SECRET",
    },
  });
  ws.send(authMessage);

  // Subscribe to a channel after authentication
  ws.on("message", (data) => {
    const response = JSON.parse(data);
    console.log("Response:", response);

    if (response.id === 3040) {
      // Auth response
      const subscriptionMessage = JSON.stringify({
        jsonrpc: "2.0",
        id: 3041,
        method: "private/subscribe",
        params: {
          channels: ["user.transactions"],
        },
      });
      ws.send(subscriptionMessage);
    }
  });

  // Listen for notifications
  ws.on("message", (data) => {
    console.log("Notification:", data);
  });
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", () => {
  console.log("WebSocket connection closed");
});

Response

Name Type Description
data object
› instrument_name string Name of the instrument
› sequence number Sequence of trade which failed on chain
› tx_hash string unique hash of the transaction
› tx_status string status of transaction. i.e. success or failure

An example of the response

{
  "jsonrpc": "2.0",
  "method": "subscriptions",
  "params": {
    "channel": "user.transactions",
    "data": {
      "instrument_name": "ETH-PERP",
      "sequence": 1,
      "tx_hash": "0x1324901u59013u59135913h95931593u5395913591351935135",
      "tx_status": "success"
    }
  }
}

Market Maker

Coming Soon ..