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:
- JSON-RPC over websockets
- JSON-RPC over HTTP
Support for FIX(Financial Information eXchange) is also planned and will be available in the future.
Syndr's testnet environment, test.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:
- Testnet(REST):
https://stage-api.syndr.trade/api/v1
- Testnet(WSS):
wss://stage-api.syndr.trade/api/v1/ws
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, DMMMYY is 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
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 101,
"method": "public/register_signing_key",
"params": {
"account": "0x3e08cb7cE50C1DcE66d5D22d23BcA063487A6e8e",
"account_signature": "0x0d8eede0e4bf1e6108e255e384269d5d6d200c78190047e1e7c970cb61aad4b17d336b3d156d59de6cd4be79fadc6ac0a6dd1167ff3ee521a03b243fbecca9d51c",
"signer_public_address": "0x1867a1b331D94297007b6a9825f44403ca3CE87C",
"signing_key_signature": "0xf539f4625847f23fb4d16ab892aaf0ddc980279194d4358163a1616bfff258c510ceb3d00d144143393b72e88f663cc81e4a1c36aaf31603c9ad4aa8930ec2301b",
"expires_at": "0xe"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 101,
"method": "public/register_signing_key",
"params": {
"account": "0x3e08cb7cE50C1DcE66d5D22d23BcA063487A6e8e",
"account_signature": "0x0d8eede0e4bf1e6108e255e384269d5d6d200c78190047e1e7c970cb61aad4b17d336b3d156d59de6cd4be79fadc6ac0a6dd1167ff3ee521a03b243fbecca9d51c",
"signer_public_address": "0x1867a1b331D94297007b6a9825f44403ca3CE87C",
"signing_key_signature": "0xf539f4625847f23fb4d16ab892aaf0ddc980279194d4358163a1616bfff258c510ceb3d00d144143393b72e88f663cc81e4a1c36aaf31603c9ad4aa8930ec2301b",
"expires_at": "0xe"
}
})
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": 101,
"method": "public/register_signing_key",
"params": {
"account": "0x3e08cb7cE50C1DcE66d5D22d23BcA063487A6e8e",
"account_signature": "0x0d8eede0e4bf1e6108e255e384269d5d6d200c78190047e1e7c970cb61aad4b17d336b3d156d59de6cd4be79fadc6ac0a6dd1167ff3ee521a03b243fbecca9d51c",
"signer_public_address": "0x1867a1b331D94297007b6a9825f44403ca3CE87C",
"signing_key_signature": "0xf539f4625847f23fb4d16ab892aaf0ddc980279194d4358163a1616bfff258c510ceb3d00d144143393b72e88f663cc81e4a1c36aaf31603c9ad4aa8930ec2301b",
"expires_at": "0xe"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc": "2.0",
"id": 101,
"method": "public/register_signing_key",
"params": {
"account": "0x3e08cb7cE50C1DcE66d5D22d23BcA063487A6e8e",
"account_signature": "0x0d8eede0e4bf1e6108e255e384269d5d6d200c78190047e1e7c970cb61aad4b17d336b3d156d59de6cd4be79fadc6ac0a6dd1167ff3ee521a03b243fbecca9d51c",
"signer_public_address": "0x1867a1b331D94297007b6a9825f44403ca3CE87C",
"signing_key_signature": "0xf539f4625847f23fb4d16ab892aaf0ddc980279194d4358163a1616bfff258c510ceb3d00d144143393b72e88f663cc81e4a1c36aaf31603c9ad4aa8930ec2301b",
"expires_at": "0xe"
}
}`)
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stage-api.syndr.trade/api/v1',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 101,
"method": "public/register_signing_key",
"params": {
"account": "0x3e08cb7cE50C1DcE66d5D22d23BcA063487A6e8e",
"account_signature": "0x0d8eede0e4bf1e6108e255e384269d5d6d200c78190047e1e7c970cb61aad4b17d336b3d156d59de6cd4be79fadc6ac0a6dd1167ff3ee521a03b243fbecca9d51c",
"signer_public_address": "0x1867a1b331D94297007b6a9825f44403ca3CE87C",
"signing_key_signature": "0xf539f4625847f23fb4d16ab892aaf0ddc980279194d4358163a1616bfff258c510ceb3d00d144143393b72e88f663cc81e4a1c36aaf31603c9ad4aa8930ec2301b",
"expires_at": "0xe"
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
To start trading on Syndr via the API, you'll need to register a signer using the public/register_signing_key
method with a JSON-RPC request. It's important to note that authentication is not required as it is a public method, and it can only be accessed through a POST request.
We've provided a Python script that you can use to generate the signatures needed for the request. Simply edit the ACCOUNT_PRIVATE_KEY
and ACCOUNT_PUBLIC_ADDRESS
variables, and the script will generate the necessary parameters. Be sure to save these parameters locally for future requests.
Request Parameters
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
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | ||
› apiKey | string | API key |
› apiSecret | string | API secret |
› signingKey | string | Address that has the authority to sign orders on behalf of your account |
› txHash | 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://stage-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://stage-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
syndr-api-key
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://stage-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.
- Method naming convention:
public/<method>
.
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.
- Method naming convention:
private/<method>
.
Market Data
public/get_all_instrument_names
This method returns all the instrument names presently available.
curl --location 'https://stage-api.syndr.trade/api/v1/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://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"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": 7365,
"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://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
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": 7365,
"result": [
"ETH-PERP",
"BTC-PERP",
"ETH-30DEC22-1100-C",
"ETH-30DEC22-1100-P",
"ETH-30DEC22-1150-C",
"ETH-30DEC22-1150-P",
"ETH-30DEC22-1200-C",
"ETH-30DEC22-1200-P",
"ETH-30DEC22-1250-C",
"ETH-30DEC22-1250-P"
],
"usIn": 1702375832825770,
"usOut": 1702375832827130,
"usDiff": 1360
}
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 20 trades for an instrument
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_trades",
"params" : {
"instrument_name":"ETH-PREP"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_trades",
"params": {
"instrument_name": "ETH-PREP"
}
})
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_trades",
"params": {
"instrument_name": "ETH-PREP"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_trades",
"params" : {
"instrument_name":"ETH-PREP"
}
}`)
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
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 | Name of the instrument |
An example of the response
{
"jsonrpc": "2.0",
"id": 7365,
"result": [
{
"id": "85e5059e-f230-49ba-aa76-06ca76707b65",
"size": "1",
"price": "2100",
"side": "sell",
"timestamp": 1681809246412,
"instrument_name": "ETH-PERP"
},
{
"id": "d04b2aed-8fa9-4a0a-b4e1-01adfdeb668f",
"size": "1",
"price": "2100",
"side": "sell",
"timestamp": 1681809246084,
"instrument_name": "ETH-PERP"
},
{
"id": "32e19697-4929-4d78-8319-a525f95ec288",
"size": "1",
"price": "2100",
"side": "sell",
"timestamp": 1681809245653,
"instrument_name": "ETH-PERP"
},
{
"id": "bf851ca3-0811-477c-a9de-664056b633e7",
"size": "1",
"price": "2100",
"side": "sell",
"timestamp": 1681809239653,
"instrument_name": "ETH-PERP"
}
],
"usIn": 1702375832825770,
"usOut": 1702375832827130,
"usDiff": 1360
}
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 trades |
› id | string | Unique ID of the trade |
› timestamp | number | Timestamp of the trade |
› side | string | Side at which the trade is filled (buy/sell) |
› price | string | Price at which trade is settled |
› size | string | Size in terms of underlying currency |
usIn | integer | Server In Time |
usOut | integer | Server Out Time |
usDiff | integer | Out Time -In Time |
public/get_instruments
This method lists all the active instruments of a particular kind.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_instruments",
"params" : {
"kind": "future"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_instruments",
"params": {
"kind": "future"
}
})
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": "future"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_instruments",
"params" : {
"kind": "future"
}
}`)
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "public/get_instruments",
params: {
kind: "future",
},
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Parameters
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
kind | true | string | option future |
kind of instruments |
An example of the response
{
"jsonrpc": "2.0",
"id": 7365,
"result": {
"45": {
"id": 45,
"base_currency": "ETH",
"quote_currency": "USD",
"index": "ETH/USD",
"name": "ETH-26MAY23",
"kind": "future",
"expiry": "1685088000",
"settlement_period": 2,
"tick_size": "0.01",
"contract_size": "0.1",
"max_leverage": "50",
"maker_commission": "0.0002",
"taker_commission": "0.0005",
"block_trade_commission": "0.0003",
"max_liquidation_commission": "0.0075",
"created_at": 1681808858
}
},
"usIn": 1702375832825770,
"usOut": 1702375832827130,
"usDiff": 1360
}
Response
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | object | Instruments object |
› [id] | object | Object with keys as instrument id and value as instrument data |
› › id | integer | Instrument ID |
› › quote_currency | string | Quote currency of the instrument. |
› › index | string | Name of the underlying index. |
› › base_currency | string | Base currency of the instrument. |
› › name | string | Name of the instrument. |
› › kind | string | Instrument kind. |
› › expiry | integer | Expiration timestamp of the option (Only for options). |
› › settlement_period | string | Settlement period of the instrument. |
› › tick_size | string | Tick size of the instrument. |
› › contract_size | string | Contract size of the instrument. |
› › max_leverage | string | Maximum leverage for the instrument (Only for futures). |
› › maker_commission | string | Maker commission of the instrument. |
› › taker_commission | string | Taker commission of the instrument. |
› › block_trade_commission | string | Block trade commission of the instrument. |
› › max_liquidation_commission | string | Max liquidation commission of the instrument. |
› › created_at | string | Timestamp when instrument was created. |
› › strike | string | (only if kind=option) Strike of option instrument. |
› › is_call | bool | (only in kind=option) Whether the option is a call option |
usIn | integer | Server In Time |
usOut | integer | Server Out Time |
usDiff | integer | Out Time -In Time |
public/get_instruments_by_currency
This method lists all the active instruments of a particular kind and currency.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_instruments_by_currency",
"params" : {
"kind": "future",
"currency": "ETH"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_instruments_by_currency",
"params": {
"kind": "future",
"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": "future",
"currency": "ETH"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_instruments_by_currency",
"params" : {
"kind": "future",
"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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "public/get_instruments",
params: {
kind: "future",
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 | option future |
kind of instruments |
currency | true | string | ETH BTC |
currency name |
An example of the response
{
"jsonrpc": "2.0",
"id": 7365,
"result": {
"45": {
"id": 45,
"base_currency": "ETH",
"quote_currency": "USD",
"index": "ETH/USD",
"name": "ETH-26MAY23",
"kind": "future",
"expiry": "1685088000",
"settlement_period": 2,
"tick_size": "0.01",
"contract_size": "0.1",
"max_leverage": "50",
"maker_commission": "0.0002",
"taker_commission": "0.0005",
"block_trade_commission": "0.0003",
"max_liquidation_commission": "0.0075",
"created_at": 1681808858
}
},
"usIn": 1702375832825770,
"usOut": 1702375832827130,
"usDiff": 1360
}
Response
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | object | Instruments object |
› [id] | object | Object with keys as instrument id and value as instrument data |
› › id | integer | Instrument ID |
› › quote_currency | string | Quote currency of the instrument. |
› › index | string | Name of the index used |
› › base_currency | string | Base currency of the instrument. |
› › name | string | Base currency of the instrument. |
› › kind | string | Instrument kind. |
› › expiry | integer | Expiration timestamp of the option (Only for options). |
› › settlement_period | string | Settlement period of the instrument. |
› › tick_size | string | Tick size of the instrument. |
› › contract_size | string | Contract size of the instrument. |
› › max_leverage | string | Maximum leverage for the instrument (Only for futures). |
› › maker_commission | string | Maker commission of the instrument. |
› › taker_commission | string | Taker commission of the instrument. |
› › block_trade_commission | string | Block trade commission of the instrument. |
› › max_liquidation_commission | string | Max liquidation commission of the instrument. |
› › created_at | string | Timestamp when instrument was created. |
› › strike | string | (only if kind=option) Strike of option instrument. |
› › is_call | bool | (only in kind=option) Whether the option is a call option |
usIn | integer | Server In Time |
usOut | integer | Server Out Time |
usDiff | integer | Out Time -In Time |
public/get_order_book
Retrieves the order book, along with other market values for a given instrument.
curl --location 'https://stage-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-PREP"
}
}
'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_order_book",
"params": {
"instrument_name": "ETH-PREP"
}
})
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-PREP"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_order_book",
"params" : {
"instrument_name":"ETH-PREP"
}
}
`)
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-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-PREP",
},
}),
};
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": {
"asks": {
"depth": 0,
"numOrders": 0,
"prices": {},
"volume": "0"
},
"best_ask_amount": "0",
"best_ask_price": "0",
"best_bid_amount": "0",
"best_bid_price": "0",
"bids": {
"depth": 0,
"numOrders": 1,
"prices": {
"2100": {
"price": "2100",
"volume": "60"
}
},
"volume": "0"
},
"ema_1min": "0",
"ema_30s": "-0.00007",
"funding_rate": "0",
"high": "2229.3",
"instrument_name": "ETH-PERP",
"last_price": "2229.3",
"last_settled_at": 0,
"low": "0",
"mark_price": "2224.91993",
"max_price": "2258.29372895",
"min_price": "2191.54613105",
"open_interest": "20",
"paused": false,
"volume": "2",
"volume_24h": "2",
"volume_timestamp": 1702300066359277,
"volume_usd": "4458.6",
"volume_usd_24h": "4458.6"
},
"usIn": 1702378799783912,
"usOut": 1702378799786195,
"usDiff": 2283
}
Response
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | object | |
› asks | array | object of asks |
› bids | array | object of bids |
› best_bid_amount | string | It represents the requested order size at best bid price |
› best_bid_price | string | The current best bid price |
› best_ask_amount | string | It represents the requested order size at best ask price |
› best_ask_price | string | The current best ask price |
› instrument_name | string | Name of the instrument |
› index_price | string | The index price of the instrument. |
› mark_price | string | The mark price of the instrument. |
› ema_1min | string | 1 min ema |
› ema_30s | string | 30 sec ema |
› max_price | string | The minimum allowed price for any new order |
› min_price | string | The maximum allowed price for any new order |
› last_price | string | The price of the last trade |
› open_interest | string | The Open Interest of the instrument. |
› volume_usd | string | Volume in usd |
› volume_usd_24h | string | Volume in usd for past 24 hr |
› volume | string | Volume during last 24h in base currency |
› volume_24h | string | Volume during last 24h in base currency |
› volume_timestamp | integer | Unix timestam at at time of exceution |
› price_change | string | 24-hour price change |
› last_settled_at | integer | last settled at timestamp |
› low | string | Lowest price during 24h |
› high | string | Highest price during 24h |
› paused | bool | Whether the instrument is open for trade |
› funding_rate | string | ( Only for perpetual ) Current funding rate |
› ask_iv | string | ( Only for option ) Ask IV of the option instrument |
› bid_iv | string | ( Only for option ) Bid IV of the option instrument |
› mark_iv | string | ( Only for option ) Mark IV of the option instrument |
› delta | string | ( Only for option ) Delta of the option instrument |
usIn | integer | Server In Time |
usOut | integer | Server Out Time |
usDiff | integer | Out Time -In Time |
public/get_tradingview_chart_data
Publicly available market data used to generate a TradingView candle chart.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_tradingview_chart_data",
"params": {
"instrument_name": "ETH-PERP",
"resolution": "5",
"from": 1699601880000,
"to": 1699602480000
}
}'
import requests
import json
url = "https://stage-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": "5",
"from": 1699601880000,
"to": 1699602480000
}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".parse()?);
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": "5",
"from": 1699601880000,
"to": 1699602480000
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-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": "5",
"from": 1699601880000,
"to": 1699602480000
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("syndr-api-key", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "public/get_tradingview_chart_data",
params: {
instrument_name: "ETH-PERP",
resolution: "5",
from: 1699601880000,
to: 1699602480000,
},
}),
};
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 | |
from | true | integer | The earliest timestamp to return result for | Unix timestamp from |
to | true | integer | The most recent timestamp to return result for | Unix timestamp to |
resolution | true | string | 1,5,30,60,240,1D | Resolution of candel |
An example of the response
{
"jsonrpc": "2.0",
"id": 7365,
"result": [
{
"time": 1699602000000,
"open": 0,
"high": 0,
"low": 0,
"close": 0,
"volume": 0
},
{
"time": 1699602300000,
"open": 0,
"high": 0,
"low": 0,
"close": 0,
"volume": 0
}
],
"usIn": 1700168586288171,
"usOut": 1700168586291742,
"usDiff": 3571
}
public/get_ticker
Gives ticker for the instrument
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_ticker",
"params" : {
"instrument_name": "ETH-29DEC23-3800-C"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "public/get_ticker",
"params": {
"instrument_name": "ETH-29DEC23-3800-C"
}
})
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_ticker",
"params": {
"instrument_name": "ETH-29DEC23-3800-C"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "public/get_ticker",
"params" : {
"instrument_name": "ETH-29DEC23-3800-C"
}
}`)
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "public/get_ticker",
params: {
instrument_name: "ETH-29DEC23-3800-C",
},
}),
};
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",
"best_ask_delta": "0.9901215230045103",
"best_ask_iv": "10",
"best_ask_price": "0",
"best_bid_amount": "0",
"best_bid_delta": "0.9901215230045103",
"best_bid_iv": "10",
"best_bid_price": "0",
"contract_size": "0.1",
"delta": "0.0007919980589284071",
"gamma": "0.000006502796648404901",
"index_price": "1674.84739476",
"instrument_name": "ETH-29DEC23-3800-C",
"interest_value": null,
"is_call": true,
"last_price": "0",
"mark_price": "0.0846692920995511",
"max_price": "0.088902756704528655",
"min_price": "0.080435827494573545",
"open_interest": "0",
"rho": "0.003092340483989572",
"sigma": "0.5",
"stats": {
"high": "0",
"low": "0",
"price_change": null,
"volume": "0",
"volume_usd": "0"
},
"strike": "3800",
"theta": "-0.006246769941628693",
"timestamp": 1695713327821,
"vega": "0.022711628642662417"
},
"usIn": 1702375832825770,
"usOut": 1702375832827130,
"usDiff": 1360
}
Response
Name |
Type |
Description |
---|---|---|
data | object | |
› instrument_name | string | Index price |
› timestamp | number | 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 |
usIn | integer | Server In Time |
usOut | integer | Server Out Time |
usDiff | integer | Out Time -In Time |
Trading
private/buy
This method places a buy order.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/buy",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/buy",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
let data = r#"{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/buy",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/buy",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("syndr-api-key", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "private/buy",
params: {
price: 2200,
order_type: "limit",
instrument_name: "ETH-PERP",
amount: 0.1,
time_in_force: "GTC",
},
}),
};
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. |
order_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": {
"Order": {
"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"
},
"Trades": [
{
"id": "720c060b-78ae-480f-b873-2fff22724802",
"instrument_name": "ETH-PERP",
"price": "2200",
"side": "buy",
"amount": "0.1",
"timestamp": 1702383895830
}
]
},
"usIn": 1702383895823821,
"usOut": 1702383895830862,
"usDiff": 7041
}
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://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/sell",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/sell",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
let data = r#"{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/sell",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/sell",
"params": {
"price": 2200,
"order_type": "limit",
"instrument_name": "ETH-PERP",
"amount": 0.1,
"time_in_force": "GTC"
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("syndr-api-key", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "private/sell",
params: {
price: 2200,
order_type: "limit",
instrument_name: "ETH-PERP",
amount: 0.1,
time_in_force: "GTC",
},
}),
};
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": {
"Order": {
"amount": "1",
"average_price": "0",
"creation_timestamp": 1702383885146,
"creator": "0x770e486038da4d6dce7d781e3ab0421dac34ddd9",
"direction": "sell",
"filled_amount": "0",
"instrument_name": "",
"is_liquidation": false,
"label": "",
"last_update_timestamp": 1702383885146,
"order_id": "ca2ca4d4-e87f-4d8e-b104-8ad74dc9793a",
"order_state": "open",
"order_type": "Limit",
"post_only": false,
"price": "2200",
"reduce_only": false,
"time_in_force": "",
"unfilled_amount": "1"
},
"Trades": null
},
"usIn": 1702383885140136,
"usOut": 1702383885147019,
"usDiff": 6883
}
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://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/edit",
"params" : {
"order_id": "2c6b4503-f40c-485e-b9c3-bc0fec6b8c8c",
"instrument_name": "ETH-PERP",
"amount" : 1,
"price" : 1870
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/edit",
"params": {
"order_id": "2c6b4503-f40c-485e-b9c3-bc0fec6b8c8c",
"instrument_name": "ETH-PERP",
"amount": 1,
"price": 1870
}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
let data = r#"{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/edit",
"params": {
"order_id": "2c6b4503-f40c-485e-b9c3-bc0fec6b8c8c",
"instrument_name": "ETH-PERP",
"amount": 1,
"price": 1870
}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/edit",
"params" : {
"order_id": "2c6b4503-f40c-485e-b9c3-bc0fec6b8c8c",
"instrument_name": "ETH-PERP",
"amount" : 1,
"price" : 1870
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("syndr-api-key", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 7365,
method: "private/edit",
params: {
order_id: "2c6b4503-f40c-485e-b9c3-bc0fec6b8c8c",
instrument_name: "ETH-PERP",
amount: 1,
price: 1870,
},
}),
};
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://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--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://stage-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': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".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://stage-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/ioutil"
)
func main() {
url := "https://stage-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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"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_by_instrument
This method cancels all the open orders of a particular instrument.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--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://stage-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': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".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://stage-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/ioutil"
)
func main() {
url := "https://stage-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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"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/get_open_orders
This method gives all the positions.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/get_open_orders",
"params" : {
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/get_open_orders",
"params": {}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".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://stage-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/ioutil"
)
func main() {
url := "https://stage-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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"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": {
"ETH": {
"ETH-PERP": {
"1d249e27-1d1f-4acb-afca-84599b94fc19": {
"amount": "1",
"average_price": "0",
"creation_timestamp": 1702385151318,
"creator": "0x770e486038da4d6dce7d781e3ab0421dac34ddd9",
"direction": "sell",
"filled_amount": "0",
"instrument_name": "",
"is_liquidation": false,
"label": "",
"last_update_timestamp": 1702385151318,
"order_id": "1d249e27-1d1f-4acb-afca-84599b94fc19",
"order_state": "open",
"order_type": "Limit",
"post_only": false,
"price": "2200",
"reduce_only": false,
"time_in_force": "",
"unfilled_amount": "0.3"
},
"69677251-092e-41f3-a1d1-2ebf06bc4f39": {
"amount": "0.1",
"average_price": "0",
"creation_timestamp": 1702383849860,
"creator": "0x770e486038da4d6dce7d781e3ab0421dac34ddd9",
"direction": "sell",
"filled_amount": "0",
"instrument_name": "",
"is_liquidation": false,
"label": "",
"last_update_timestamp": 1702383849860,
"order_id": "69677251-092e-41f3-a1d1-2ebf06bc4f39",
"order_state": "open",
"order_type": "Limit",
"post_only": false,
"price": "2249.2",
"reduce_only": false,
"time_in_force": "",
"unfilled_amount": "0.1"
}
}
}
},
"usIn": 1702387203205468,
"usOut": 1702387203206833,
"usDiff": 1365
}
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://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/get_positions",
"params" : {
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/get_positions",
"params": {}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".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://stage-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/ioutil"
)
func main() {
url := "https://stage-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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require("request");
var options = {
method: "POST",
url: "https://stage-api.syndr.trade/api/v1",
headers: {
"syndr-api-key": "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=",
"syndr-api-secret":
"75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df",
"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": {
"ETH": {
"perpetual": {
"ETH-PERP": {
"average_price": "1570",
"contract_size": "0.1",
"direction": "buy",
"index_price": "1673.7525",
"initial_margin": "544.0528484244",
"instrument_name": "ETH-PERP",
"is_synced_onchain": false,
"maintenance_margin": "272.9049434244",
"mark_price": "1665.38125",
"position_delta": "16.2",
"realized_funding": "0",
"realized_pnl": "-718.636402688626308555",
"settlement_price": "0",
"amount": "162",
"amount_in_base": "16.2",
"total_pnl": "826.539847311373691445",
"trade_fee": "718.636402688626308555",
"unrealized_pnl": "1545.17625"
}
}
}
}
}
Response
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | object | Positions of instruments of all currencies |
› [underlying_currency] | object | Positions of instruments of a particular currency |
› › [instrument_name] | object | Positions of instrument |
› › › 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 |
› › › amount | string | Amount of the position in no of contracts |
› › › amount_in_base | string | Amount 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 |
Combo Blocks
Coming Soon ..
Block Trade
Coming Soon ..
Account Management
private/get_account_summary
This method returns the account summary.
curl --location 'https://stage-api.syndr.trade/api/v1' \
--header 'syndr-api-key: fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=' \
--header 'syndr-api-secret: 75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/get_account_summary",
"params" : {
}
}'
import requests
import json
url = "https://stage-api.syndr.trade/api/v1"
payload = json.dumps({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/get_account_summary",
"params": {}
})
headers = {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'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", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=".parse()?);
headers.insert("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df".parse()?);
headers.insert("Content-Type", "application/json".parse()?);
let data = r#"{
"jsonrpc": "2.0",
"id": 7365,
"method": "private/get_account_summary",
"params": {}
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://stage-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/ioutil"
)
func main() {
url := "https://stage-api.syndr.trade/api/v1"
method := "POST"
payload := strings.NewReader(`{
"jsonrpc" : "2.0",
"id" : 7365,
"method" : "private/get_account_summary",
"params" : {
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("syndr-api-key", "fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=")
req.Header.Add("syndr-api-secret", "75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df")
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 := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stage-api.syndr.trade/api/v1',
'headers': {
'syndr-api-key': 'fJHQ772sCslUHeNq6B_B5OA1hldxDD-fEb0ub41Q5eo=',
'syndr-api-secret': '75ee172471d466a68d6f919e2103fb27769dbe091ce38f19c9eb3810eaaa6499.9c0278a230afa1074f1ac6fcec7b53c1baf7acb219244151fbdd9aa8517f50df',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 7365,
"method": "private/get_account_summary",
"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": {
"available_balance": "8956.7872611729396037",
"available_withdrawable_funds": "8977.7735111729396037",
"collateral": {
"DAI": "3000",
"USDC": "3000",
"USDT": "3000"
},
"delta_total": {
"ETH": "1"
},
"equity": "8998.7681556729396037",
"initial_margin": "41.9808945",
"initial_margin_utilization": "0.466518236427",
"is_portfolio_margined": false,
"maintenance_margin": "20.9946445",
"maintenance_margin_utilization": "0.23330576070864",
"open_orders_im": "0",
"realized_pnl": "-0.4190537359783963",
"total_pnl": "-1.3100243270603963",
"unrealized_pnl": "-1.31004001"
}
}
Response
Name |
Type |
Description |
---|---|---|
jsonrpc | string | The JSON-RPC version (2.0). |
id | integer | The id that was sent in the request. |
result | object | |
› available_balance | string | Total available funds of the account |
› available_withdrawal_funds | string | Total available withdrawal funds |
› collateral | object | Current collateral in all currencies |
› delta_total | object | The sum of position deltas for each currency |
› equity | string | The account's current equity |
› initial_margin | string | Projected initial margin of the account |
› initial_margin_utilization | string | Total available funds of the account |
› is_portfolio_margined | bool | True if portfolio margin is enabled |
› maintenance_margin | string | The maintenance margin |
› maintenance_margin_utilization | string | Total available funds of the account |
› open_orders_im | string | Total initial margin for open orders |
› realized_pnl | string | realized profit and loss |
› total_pnl | string | Profit and loss |
› unrealized_pnl | string | unrealized profit and loss |
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://stage-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://stage-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://stage-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://stage-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://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"id": 3041,
"params": {
"channel": "ticker.ETH_PERP",
"data": {
"instrument_name": "ETH-PERP",
"timestamp": 1681654801079,
"best_ask_amount": "123",
"best_ask_price": "2,079.41",
"best_bid_amount": "213",
"best_bid_price": "2,093.40",
"contract_size": "0.1",
"index_price": "2086.0375",
"interest_value": null,
"last_price": "0",
"mark_price": "2086.0375",
"open_interest": "0",
"max_price": "2117.3280625",
"min_price": "2054.7469375",
"funding_rate": "0.13",
"stats": {
"high": "0",
"low": "0",
"price_change": null,
"volume": "0",
"volume_usd": "0"
}
}
}
}
Channel Parameters
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
instrument_name | true | string | Name of the instrument |
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 |
index.{index_symbol}
Get realtime price for index
import asyncio
import websockets
import json
msg = {
"jsonrpc" : "2.0",
"id" : 3041,
"method" : "public/subscribe",
"params" : {
"channels": ["index.ETH/USD"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "index.ETH/USD",
"data": {
"symbol": "ETH/USD",
"price": "2089.105"
}
}
}
Channel Parameters
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
index_symbol | true | string | Symbol of the index |
Response
Name |
Type |
Description |
---|---|---|
data | object | |
› symbol | string | Index symbol |
› price | number | Current value of index |
orderbook.{instrument_name}
Get updated orderbook data of any instrument
import asyncio
import websockets
import json
msg = {
"jsonrpc" : "2.0",
"id" : 3041,
"method" : "public/subscribe",
"params" : {
"channels": ["orderbook.ETH-PERP"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "orderbook.ETH-PERP",
"data": {
"asks": {
"prices": {
"2093.439999990001": {
"volume": "2",
"price": "2093.439999990001"
},
"2093.444999990001": {
"volume": "1",
"price": "2093.444999990001"
},
"2093.4499999900013": {
"volume": "2",
"price": "2093.4499999900013"
}
},
"volume": "5",
"numOrders": 13,
"depth": 3
},
"bids": {
"prices": {
"2079.3131374999975": {
"volume": "2",
"price": "2079.3131374999975"
},
"2079.3181374999976": {
"volume": "1",
"price": "2079.3181374999976"
},
"2079.3231374999978": {
"volume": "2",
"price": "2079.3231374999978"
}
},
"volume": "4",
"numOrders": 20,
"depth": 3
},
"best_bid_amount": "1",
"best_bid_price": "2079.4081374999996",
"best_ask_amount": "2",
"best_ask_price": "2093.439999990001",
"instrument_name": "ETH-PERP",
"index_price": "2090.585",
"mark_price": "2080.132075",
"max_price": "2111.334056125",
"min_price": "2048.930093875",
"last_price": "2093.434999990001",
"funding_rate": "-0.45",
"open_interest": "1",
"paused": false,
"stats": {
"high": "2093.434999990001",
"low": "0",
"price_change": null,
"volume": "1",
"volume_usd": "2093.41999999000065"
}
}
}
}
Channel Parameters
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
instrument_name | true | string | Name of the instrument |
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 |
trades.{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": ["trades.ETH-PERP"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "trades.ETH-PERP",
"data": {
"id": "4820577a-fb67-4f68-8df4-8aff75b2406d",
"size": "0.1",
"price": "2093.439999990001",
"side": "buy",
"timestamp": 1681659457383,
"instrument_name": "ETH-PERP"
}
}
}
Channel Parameters
Parameter | Required | Type | Enum | Description |
---|---|---|---|---|
instrument_name | true | string | Name of the instrument |
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) |
Private Channels
user.trades
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" : "public/subscribe",
"params" : {
"channels": ["user.trades"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "user.trades.ETH-PERP",
"data": {
"side": "sell",
"price": "2100",
"size": "0.1",
"liquidity": "taker",
"timestamp": 1681703006344,
"instrument_name": "ETH-PERP"
}
}
}
Response
Name |
Type |
Description |
---|---|---|
data | object | |
› side | string | Side of trades buy or sell |
› size | string | Size in terms of underlying currency i.e 1ETH , 2.5BTC |
› price | string | Price at which trade executed |
› liquidity | string | Side of trade in context of the orderbook maker or taker |
› instrument_name | string | Name of the instrument |
› timestamp | number | The timestamp (milliseconds since the Unix epoch) |
user.orders
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" : "public/subscribe",
"params" : {
"channels": ["user.orders"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "user.orders",
"data": {
"underlying": "ETH",
"order_update_type": "open",
"instrument_name": "ETH-PERP",
"updated_order": {
"id": "cf0f677b-1e7e-48b3-b04e-08b8241bde93",
"creator": "0x0000000000000000000000000000000000000000",
"side": "sell",
"timestamp": 1681713568937,
"requested_quantity": "1",
"quantity": "1",
"price": "2100"
}
}
}
}
Response
Name |
Type |
Description |
---|---|---|
data | object | |
› underlying | string | Underlying currency of the instrument |
› order_update_type | string | Type of update - open , cancel , filled |
› instrument_name | string | Name of the instrument |
› updated_order | object | |
› › creator | string | Address of creator of the order |
› › side | string | Side of order buy or sell |
› › requested_quantity | string | Initial quantity of the order in terms of underlying currency |
› › quantity | string | Unfilled quantity of the order in terms of underlying currency |
› › price | string | Limit price of the order |
› › timestamp | integer | The timestamp (milliseconds since the Unix epoch) |
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" : "public/subscribe",
"params" : {
"channels": ["user.positions"]
}
}
async def call_api(msg):
async with websockets.connect('wss://stage-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)))
An example of the response
{
"jsonrpc": "2.0",
"method": "subscriptions",
"params": {
"channel": "user.positions",
"data": {
"underlying": "ETH",
"instrument_kind": "perpetual",
"instrument_name": "ETH-PERP",
"updated_position": {
"position_delta": "0.3",
"average_price": "2099.930333333334",
"contract_size": "0.1",
"direction": "buy",
"index_price": "2097.01",
"instrument_name": "ETH-PERP",
"mark_price": "2086.53987499005",
"realized_pnl": "-0.3145515",
"size": "3",
"size_in_base": "0.3",
"total_pnl": "-4.3316890029852",
"trade_fee": "0.3145515",
"unrealized_pnl": "-4.0171375029852",
"initial_margin": "12.5828149236",
"maintenance_margin": "6.2917849236",
"settlement_price": "0",
"is_synced_onchain": false,
"realized_funding": "0"
}
}
}
}
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 |