NAV Navbar
shell javascript python

Introduction

Welcome to the DSTOQ API. Securities trading is only a few lines away. We'll onboard you with everything you'll need to know to build or integrate awesome trading experience of everything out there that can be tokenized.

It doesn't matter if you are a seasoned algorithmic trader or beginner in the field. We have accumulated crystal clear and easily adaptable examples for you.

Fintech or blockchain novice? Don't sweat, we'll explain the important concepts along the way.

Ping us @dstoq_exchange whenever you get stuck!

Prerequisites

curl https://api.stagestoq.net/core/

# output:
# {"success":true,"message":"Hooray, we're here to deliver awesomeness!"}
import requests

data = requests.get('https://api.stagestoq.net/core/').json()
print(data)

# output:
{'success': True, 'message': "Hooray, we're here to deliver awesomeness!"}
const axios = require('axios')

axios
  .get('https://api.stagestoq.net/core/')
  .then(response => console.log(response.data))
  .catch(console.log)

// output:
{"success":true,"message":"Hooray, we're here to deliver awesomeness!"}

We prepared code snippets to onboard you ASAP. So before we start learning the concepts, let's give it a go!

Copy, paste & play a code snippet from the right side to get comfortable! You'll need the axios library for JavaScript or requests for python.

However: It's a REST API, it should be straightforward to adapt this to your needs & tooling. There are Stellar Wrappers for almost any language around.

All snippets use the stellar testnet and our staging infrastructure.

Basic Concepts

Securities trading is complicated, luckily we abstract away the heavy lifting to a few API endpoints.

DSTOQ is a trading facility platform where partner banks of ours can issue tokens representing securities. Those securities are held in custody by the bank which in turn is regulated and licenced to do so.

However, the D in DSTOQ stands for decentralized. This has a few implications with the important one being that we don't hold customers tokens. They are held on-chain.

Consequently, the customer needs to know something that no one else knows - a private key to verify ownership over assets and transactions need to be signed with said private key before it can be send to the underlying chain.

We'll explain the concept in more depth below and we have an additional section for best practises that will guide you through the process.

For the moment, this document assumes that a user does have ...

We offer the opportunity to sync with your existing customerbase, if they are KYC/AML compliant to our regulatory framework. Reach out to us at it@dstoq.com to discuss the matter further.

Authentication

curl -X POST -H "Content-Type: application/json" -d '{"email": "emailaddressofuser@dstoq.com", "password": "AVerySecretPassword"}' https://api.stagestoq.net/accounts/accounts/obtain-auth-token/

# output
{
    "expiration": "2019-04-11T12:28:09.697167",
    "registration_state": 0,
    "time_to_live": "2592000.0",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTQ4ODU4NTI4LCJqdGkiOiI3ZjcxZTIwYzE1YjE0MDJlODkyZGRkMTdlMWViODYwZCIsInVzZXJfaWQiOjEsInNjb3BlcyI6WyJmb28iLCJiYXIiLCJiYXoiXSwiaXNfc3RhZmYiOnRydWUsImlzX3N1cGVydXNlciI6dHJ1ZSwiYWRkaXRpb25hbCI6ImRhdGEifQ.fkcrKCBlmX4oDsCHy2CUgp-CEv_z2uFOvkrgZilQowurS0fQDrQDtmJu59JJJ4eCbSgLjo3HJovG6-UJ8B3gGwIOpP3mmkijvx-IDeJ44MOIzkGVO2MvhQhHSUCc2U0AQzgQRUhlI6zD7OUn5Vm8LN9AY0E3gg-OS3XmxmFN-MWC_QC93viT5f"
}
const axios = require('axios')

axios
  .post('https://api.stagestoq.net/accounts/accounts/obtain-auth-token/', {
    email: 'emailaddressofuser@dstoq.com',
    password: 'AVerySecretPassword'
  })
  .then(response => console.log(response.data))
  .catch(console.log)

// output
{
  'time_to_live': '2592000.0',
  'expiration': '2019-04-11T12:34:31.678578',
  'registration_state': 0
  'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJ1c2VyX2lkIjo5LCJleHAiOjE1NTQ5ODYwNzEsImVtYWlsIjoibWFpbC5jaHJpc3RpYW5wZXRlcnNAZ21haWwuY29tIiwidXNlcm5hbWUiOiJtYWlsLmNocmlzdGlhbnBldGVyc0BnbWFpbC5jb20iLCJzY29wZXMiOlsidHJhZGUiLCJhY2Nlc3MiXSwic3RlbGxhcl9hY2NvdW50X2lkIjoiR0NIMzNMWVlYT0IzRVdTWEs3VjdRU1lPUjI1SFRVSVhWNU01NjREQzZOVkxSM0VLTVpBNDZEQlgiLCJvcmlnX2lhdCI6MTU1MjM5NDA3MSwiaXNzIjoiRFNUT1EgYXV0aCBzZXJ2aWNlIHYxLjAuMCJ9.tv-Q9SJuPeS5GehYmtnjlYKeLlhDsOqSqmucm91r9kfJQ7qIyW3kFQHjmokhoHwbtuFDwZsgk8svCGbxzMhanA'
}
import requests

data = requests.post('https://api.stagestoq.net/accounts/accounts/obtain-auth-token/', json={
  'email': 'emailaddressofuser@dstoq.com'
  'password': 'AVerySecretPassword'
}).json()
print(data)

# output
{
  'time_to_live': '2592000.0',
  'expiration': '2019-04-11T12:34:31.678578',
  'registration_state': 0
  'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJ1c2VyX2lkIjo5LCJleHAiOjE1NTQ5ODYwNzEsImVtYWlsIjoibWFpbC5jaHJpc3RpYW5wZXRlcnNAZ21haWwuY29tIiwidXNlcm5hbWUiOiJtYWlsLmNocmlzdGlhbnBldGVyc0BnbWFpbC5jb20iLCJzY29wZXMiOlsidHJhZGUiLCJhY2Nlc3MiXSwic3RlbGxhcl9hY2NvdW50X2lkIjoiR0NIMzNMWVlYT0IzRVdTWEs3VjdRU1lPUjI1SFRVSVhWNU01NjREQzZOVkxSM0VLTVpBNDZEQlgiLCJvcmlnX2lhdCI6MTU1MjM5NDA3MSwiaXNzIjoiRFNUT1EgYXV0aCBzZXJ2aWNlIHYxLjAuMCJ9.tv-Q9SJuPeS5GehYmtnjlYKeLlhDsOqSqmucm91r9kfJQ7qIyW3kFQHjmokhoHwbtuFDwZsgk8svCGbxzMhanA'
}

You can obtain a JWT token to use subsequent services that require authentication.

HTTP Request

POST https://api.stagestoq.net/accounts/accounts/obtain-auth-token/

JSON Body

Parameter Description
email The email of the user.
password The password of the user.
curl -H "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTQ4ODU4NTI4LCJqdGkiOiI3ZjcxZTIwYzE1YjE0MDJlODkyZGRkMTdlMWViODYwZCIsInVzZXJfaWQiOjEsInNjb3BlcyI6WyJmb28iLCJiYXIiLCJiYXoiXSwiaXNfc3RhZmYiOnRydWUsImlzX3N1cGVydXNlciI6dHJ1ZSwiYWRkaXRpb25hbCI6ImRhdGEifQ.fkcrKCBlmX4oDsCHy2CUgp-CEv_z2uFOvkrgZilQowurS0fQDrQDtmJu59JJJ4eCbSgLjo3HJovG6-UJ8B3gGwIOpP3mmkijvx-IDeJ44MOIzkGVO2MvhQhHSUCc2U0AQzgQRUhlI6zD7OUn5Vm8LN9AY0E3gg-OS3XmxmFN-MWC_QC93viT5f" https://api.stagestoq.net/accounts/accounts/user/

# output
{
  "email": "emailaddressofuser@dstoq.com",
  "first_name": "Tim",
  "last_name": "Test",
  "is_active": true
}
const axios = require('axios')

axios
  .create({
    headers: {'Authorization': 'JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTQ4ODU4NTI4LCJqdGkiOiI3ZjcxZTIwYzE1YjE0MDJlODkyZGRkMTdlMWViODYwZCIsInVzZXJfaWQiOjEsInNjb3BlcyI6WyJmb28iLCJiYXIiLCJiYXoiXSwiaXNfc3RhZmYiOnRydWUsImlzX3N1cGVydXNlciI6dHJ1ZSwiYWRkaXRpb25hbCI6ImRhdGEifQ.fkcrKCBlmX4oDsCHy2CUgp-CEv_z2uFOvkrgZilQowurS0fQDrQDtmJu59JJJ4eCbSgLjo3HJovG6-UJ8B3gGwIOpP3mmkijvx-IDeJ44MOIzkGVO2MvhQhHSUCc2U0AQzgQRUhlI6zD7OUn5Vm8LN9AY0E3gg-OS3XmxmFN-MWC_QC93viT5f'}
  })
  .get('https://api.stagestoq.net/accounts/accounts/user/')
  .then(response => console.log(response.data))
  .catch(console.log)

// output
{
  "email": "emailaddressofuser@dstoq.com",
  "first_name": "Tim",
  "last_name": "Test",
  "is_active": true
}
import requests

data = requests.get('https://api.stagestoq.net/accounts/accounts/user/', headers={
  'Authorization': 'JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTQ4ODU4NTI4LCJqdGkiOiI3ZjcxZTIwYzE1YjE0MDJlODkyZGRkMTdlMWViODYwZCIsInVzZXJfaWQiOjEsInNjb3BlcyI6WyJmb28iLCJiYXIiLCJiYXoiXSwiaXNfc3RhZmYiOnRydWUsImlzX3N1cGVydXNlciI6dHJ1ZSwiYWRkaXRpb25hbCI6ImRhdGEifQ.fkcrKCBlmX4oDsCHy2CUgp-CEv_z2uFOvkrgZilQowurS0fQDrQDtmJu59JJJ4eCbSgLjo3HJovG6-UJ8B3gGwIOpP3mmkijvx-IDeJ44MOIzkGVO2MvhQhHSUCc2U0AQzgQRUhlI6zD7OUn5Vm8LN9AY0E3gg-OS3XmxmFN-MWC_QC93viT5f'
}).json()
print(data)

# output
{
  "email": "emailaddressofuser@dstoq.com",
  "first_name": "Tim",
  "last_name": "Test",
  "is_active": true
}

The endpoint returns, among other information, a token that can be used to authenticate against the API. Subsequent calls must then send an Authorization header using the given token:

Authorization: JWT TOKEN_GOES_HERE

Try it with the user endpoint that gives you a few basic information about the user behind the given token:

HTTP Request

POST https://api.stagestoq.net/accounts/accounts/user/

Trading

A trading flow is pretty straightforward to implement, as you don't have to wrestle with a lot of details.

Specifically if you want ...

Fortunately that can be done with only a few calls. Let's dive in.

Available Assets

curl https://api.stagestoq.net/core/assets

# output:
{
  "count": 11,
  "next": null,
  "previous": null,
  "results": [
    {
    "code": "DSQ",
    "issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
    "asset_type": "credit_alphanum4",
    "display_decimals": 7,
    "anchor_asset_type": "crypto",
    "anchor_asset": "DSQ",
    "name": "DSQ Token",
    "desc": "DSQ is the network token of DSTOQ and the crypto-based trading pair on the DSTOQ platform.",
    "image": "https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDVFMNNWP%2F20190313%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190313T150113Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEB8aDLS4ae7qOelfl0zMISKoBEOwPc16GzzqBjiwYGnM0is7KmFjiGBFGon8TRBVz1iOR5upu7u%2B%2FUYfQLDz1t2GXKgi4AwpN8QCyb%2FIxcfUF7QiBsaudFAu%2Bn5g0yxKSECwHSiv9H%2FAQaFYSHadbiuztbCWKoL%2BKFPhSZKpmVUH4axoj54gn%2BDLvpnfha9cPlfU5%2FchAg0gxyLCAsUsjhSL7O6ZGsAtl%2B2%2FNMawzJsfTThcF6UrOhw9BDIMho%2BwRB5VCBesoz%2FQurcmXrvT651TCzWNJLQ0qpeyUAMroSgcBif92QPbDXOHHjlyTWkWx4vzLYXs5Vt23hcJUBDAtlWShroci6BK1gXLYM89Ivd%2F1xktZh26U5urQhkm3XTQsPNUEh6Rnu%2BcH0bn%2BqrZzZHEipAZtPp0H2CvmIW%2B1q1XAmRMupLdCMUxiBq0YY9sbSqDGRpMpLXermQXFZcK3EAaQkKc3XOyO1JV%2BbQfCi5Uljgrykf6DPGI76IimlWwHr5AKTpqOzzM2VQkaexDCyZ%2Ftn0LcS%2BZK5hzjrgNjWMHF1pVY4wf8zU7UGNYepoUj5KSwIlP7AM%2B42GMKgHEy4VfYRgAYnWVHYosGkSJrE1DXtDv6lVXe9g2dshRZbUuXn%2BYxT%2BRfaSHkzEA4rEVBHzEJhAPtkGVtzGJHvDEB20zzXZBQ%2FP8e%2FgTjGYZxoXihAiW26eBOnLnRafoILKRlFQnEAVf7HxB6XHMnwhYRKRNpHDnB1C%2FmSLlPyj%2Fj6TkBQ%3D%3D&X-Amz-Signature=e3f429572d00a801470447c402d8cf9b8857e3439879765f06330faa8087c85f",
    "is_trading_pair": true,
    "isin": "",
    "wkn": "",
    "type_of_financial_instrument": "",
    "product_class": "",
    "issuance_currency": "",
    "exchange_segment": "",
    "type_of_financial_instrument_verbose": "",
    "product_class_verbose": "",
    "issuance_currency_verbose": "",
    "exchange_segment_verbose": ""
    }
    ...
  ]
}
const axios = require('axios')

axios.get('https://api.stagestoq.net/core/assets')
  .then(response => console.log(response.data))
  .catch(console.log)

// output:
{
  "count": 11,
  "next": null,
  "previous": null,
  "results": [
    {
    "code": "DSQ",
    "issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
    "asset_type": "credit_alphanum4",
    "display_decimals": 7,
    "anchor_asset_type": "crypto",
    "anchor_asset": "DSQ",
    "name": "DSQ Token",
    "desc": "DSQ is the network token of DSTOQ and the crypto-based trading pair on the DSTOQ platform.",
    "image": "https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDVFMNNWP%2F20190313%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190313T150113Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEB8aDLS4ae7qOelfl0zMISKoBEOwPc16GzzqBjiwYGnM0is7KmFjiGBFGon8TRBVz1iOR5upu7u%2B%2FUYfQLDz1t2GXKgi4AwpN8QCyb%2FIxcfUF7QiBsaudFAu%2Bn5g0yxKSECwHSiv9H%2FAQaFYSHadbiuztbCWKoL%2BKFPhSZKpmVUH4axoj54gn%2BDLvpnfha9cPlfU5%2FchAg0gxyLCAsUsjhSL7O6ZGsAtl%2B2%2FNMawzJsfTThcF6UrOhw9BDIMho%2BwRB5VCBesoz%2FQurcmXrvT651TCzWNJLQ0qpeyUAMroSgcBif92QPbDXOHHjlyTWkWx4vzLYXs5Vt23hcJUBDAtlWShroci6BK1gXLYM89Ivd%2F1xktZh26U5urQhkm3XTQsPNUEh6Rnu%2BcH0bn%2BqrZzZHEipAZtPp0H2CvmIW%2B1q1XAmRMupLdCMUxiBq0YY9sbSqDGRpMpLXermQXFZcK3EAaQkKc3XOyO1JV%2BbQfCi5Uljgrykf6DPGI76IimlWwHr5AKTpqOzzM2VQkaexDCyZ%2Ftn0LcS%2BZK5hzjrgNjWMHF1pVY4wf8zU7UGNYepoUj5KSwIlP7AM%2B42GMKgHEy4VfYRgAYnWVHYosGkSJrE1DXtDv6lVXe9g2dshRZbUuXn%2BYxT%2BRfaSHkzEA4rEVBHzEJhAPtkGVtzGJHvDEB20zzXZBQ%2FP8e%2FgTjGYZxoXihAiW26eBOnLnRafoILKRlFQnEAVf7HxB6XHMnwhYRKRNpHDnB1C%2FmSLlPyj%2Fj6TkBQ%3D%3D&X-Amz-Signature=e3f429572d00a801470447c402d8cf9b8857e3439879765f06330faa8087c85f",
    "is_trading_pair": true,
    "isin": "",
    "wkn": "",
    "type_of_financial_instrument": "",
    "product_class": "",
    "issuance_currency": "",
    "exchange_segment": "",
    "type_of_financial_instrument_verbose": "",
    "product_class_verbose": "",
    "issuance_currency_verbose": "",
    "exchange_segment_verbose": ""
    }
    ...
  ]
}
import requests

data = requests.get('https://api.stagestoq.net/core/assets').json()
print(data)

# output:
{
  "count": 11,
  "next": null,
  "previous": null,
  "results": [
    {
    "code": "DSQ",
    "issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
    "asset_type": "credit_alphanum4",
    "display_decimals": 7,
    "anchor_asset_type": "crypto",
    "anchor_asset": "DSQ",
    "name": "DSQ Token",
    "desc": "DSQ is the network token of DSTOQ and the crypto-based trading pair on the DSTOQ platform.",
    "image": "https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDVFMNNWP%2F20190313%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190313T150113Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEB8aDLS4ae7qOelfl0zMISKoBEOwPc16GzzqBjiwYGnM0is7KmFjiGBFGon8TRBVz1iOR5upu7u%2B%2FUYfQLDz1t2GXKgi4AwpN8QCyb%2FIxcfUF7QiBsaudFAu%2Bn5g0yxKSECwHSiv9H%2FAQaFYSHadbiuztbCWKoL%2BKFPhSZKpmVUH4axoj54gn%2BDLvpnfha9cPlfU5%2FchAg0gxyLCAsUsjhSL7O6ZGsAtl%2B2%2FNMawzJsfTThcF6UrOhw9BDIMho%2BwRB5VCBesoz%2FQurcmXrvT651TCzWNJLQ0qpeyUAMroSgcBif92QPbDXOHHjlyTWkWx4vzLYXs5Vt23hcJUBDAtlWShroci6BK1gXLYM89Ivd%2F1xktZh26U5urQhkm3XTQsPNUEh6Rnu%2BcH0bn%2BqrZzZHEipAZtPp0H2CvmIW%2B1q1XAmRMupLdCMUxiBq0YY9sbSqDGRpMpLXermQXFZcK3EAaQkKc3XOyO1JV%2BbQfCi5Uljgrykf6DPGI76IimlWwHr5AKTpqOzzM2VQkaexDCyZ%2Ftn0LcS%2BZK5hzjrgNjWMHF1pVY4wf8zU7UGNYepoUj5KSwIlP7AM%2B42GMKgHEy4VfYRgAYnWVHYosGkSJrE1DXtDv6lVXe9g2dshRZbUuXn%2BYxT%2BRfaSHkzEA4rEVBHzEJhAPtkGVtzGJHvDEB20zzXZBQ%2FP8e%2FgTjGYZxoXihAiW26eBOnLnRafoILKRlFQnEAVf7HxB6XHMnwhYRKRNpHDnB1C%2FmSLlPyj%2Fj6TkBQ%3D%3D&X-Amz-Signature=e3f429572d00a801470447c402d8cf9b8857e3439879765f06330faa8087c85f",
    "is_trading_pair": True,
    "isin": "",
    "wkn": "",
    "type_of_financial_instrument": "",
    "product_class": "",
    "issuance_currency": "",
    "exchange_segment": "",
    "type_of_financial_instrument_verbose": "",
    "product_class_verbose": "",
    "issuance_currency_verbose": "",
    "exchange_segment_verbose": ""
    }
    ...
  ]
}

This endpoints returns a list of all available assets on the DSTOQ platform.

It's paginated and gives you back previous and next urls (or null if they don't exist) along with the count.

HTTP Request

GET https://api.stagestoq.net/core/assets

URL Params

Parameter Description Default
trading_pairs_only A value of 1 will return only trading pairs 0
securities_only A value of 1 will return only securities 0

Orderbook

curl https://api.stagestoq.net/market-data/orderbook/\?buying_asset_code\=IROB\&buying_asset_issuer\=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM\&selling_asset_code\=DSQ\&selling_asset_issuer\=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF

# output
{
  "bids": [
    {
    "price": "0.0030390",
    "amount": "2905.9551378"
    },
    ...
  ],
  "asks": [
    {
    "price": "0.0031372",
    "amount": "2.3022122"
    },
    ...
  ]
}
const axios = require('axios')

axios.get('https://api.stagestoq.net/market-data/orderbook/?buying_asset_code=IROB&buying_asset_issuer=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM&selling_asset_code=DSQ&selling_asset_issuer=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF')
  .then(response => console.log(response.data))
  .catch(console.log)

// output
{
  "bids": [
    {
    "price": "0.0030390",
    "amount": "2905.9551378"
    },
    ...
  ],
  "asks": [
    {
    "price": "0.0031372",
    "amount": "2.3022122"
    },
    ...
  ]
}
import requests

data = requests.get('https://api.stagestoq.net/market-data/orderbook/?buying_asset_code=IROB&buying_asset_issuer=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM&selling_asset_code=DSQ&selling_asset_issuer=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF').json()
print(data)

// output
{
  "bids": [
    {
    "price": "0.0030390",
    "amount": "2905.9551378"
    },
    ...
  ],
  "asks": [
    {
    "price": "0.0031372",
    "amount": "2.3022122"
    },
    ...
  ]
}

An orderbook is just a list of currents bids and asks for a trading pair against a security. Hence, one of your sides (buying or selling) needs to be a trading pair. Our samples are for DSQ (a trading pair) against IROB (a security).

HTTP Request

GET https://api.stagestoq.net/market-data/orderbook

URL Params

All required URL params can be retrieved from the /core/assets call described above.

Parameter Description Required
buying_asset_code Code of the buying asset, e.g. IROB Yes
buying_asset_issuer Public Key of the issuer of the buying asset Yes
selling_asset_code Code of the selling asset, e.g. DSQ Yes
selling_asset_issuer Public Key of the selling asset Yes

24h Changes

curl -X POST -H "Content-Type: application/json" -d '[{"base_asset_code": "DSQ", "base_asset_issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF", "counter_asset_code": "IROB", "counter_asset_issuer": "GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM"}]' https://api.stagestoq.net/market-data/market-history/24h

# output:
[
   {
      "base_asset_code":"DSQ",
      "base_asset_issuer":"GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
      "counter_asset_code":"IROB",
      "counter_asset_issuer":"GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM",
      "success":true,
      "base_volume":"111047.2697816",
      "base_24h_change":"0.1480214",
      "base_price":"0.0030401",
      "counter_price":"328.9365481",
      "counter_volume":"337.8718553",
      "counter_24_change":"-0.1478027"
   }
]
const axios = require('axios')

axios({
  url: 'https://api.stagestoq.net/market-data/market-history/24h',
  method: 'post',
  data: [{
    base_asset_code: 'DSQ',
    base_asset_issuer: 'GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
    counter_asset_code: 'IROB',
    counter_asset_issuer: 'GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM'
  }]
}).then(response => console.log(response.data))
  .catch(console.log)

// output:
[
   {
      "base_asset_code":"DSQ",
      "base_asset_issuer":"GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
      "counter_asset_code":"IROB",
      "counter_asset_issuer":"GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM",
      "success":true,
      "base_volume":"111047.2697816",
      "base_24h_change":"0.1480214",
      "base_price":"0.0030401",
      "counter_price":"328.9365481",
      "counter_volume":"337.8718553",
      "counter_24_change":"-0.1478027"
   }
]
import requests

data = requests.post('https://api.stagestoq.net/market-data/market-history/24h', json=[dict(
    base_asset_code='DSQ',
    base_asset_issuer='GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
    counter_asset_code='IROB',
    counter_asset_issuer='GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM'
)]).json()
print(data)

# output
[
  {
    'base_asset_code': 'DSQ',
    'base_asset_issuer': 'GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
    'counter_asset_code': 'IROB',
    'counter_asset_issuer': 'GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM',
    'success': True,
    'base_volume': '111047.2697816',
    'base_24h_change': '0.1480214',
    'base_price': '0.0030401',
    'counter_price': '328.9365481',
    'counter_volume': '337.8718553',
    'counter_24_change': '-0.1478027'
  }
]

This endpoint gives you aggregated data for given asset pairs over the past 24 hours.

Note that the endpoint utilizes the POST verb to allow for an array input. Hence you can request multiple aggregates for different asset pairs at once.

HTTP Request

POST https://api.stagestoq.net/market-data/market-history/24h

JSON BODY

An array with the following entries per object:

Parameter Description Required
base_asset_code Code of the base asset, e.g. IROB Yes
base_asset_issuer Public Key of the issuer of the base asset Yes
counter_asset_code Code of the counter asset, e.g. DSQ Yes
counter_asset_issuer Public Key of the counter asset Yes

Charting Data

curl https://api.stagestoq.net/market-data/market-history/chart\?base_asset_code\=IROB\&base_asset_issuer\=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM\&counter_asset_code\=DSQ\&counter_asset_issuer\=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF\&end_time\=1552262400000\&start_time\=1552176000000\&resolution\=60000

# output
[
   {
      "timestamp":1552262340000,
      "price":"322.1375267",
      "base_volume":"0.2642599",
      "counter_volume":"85.1280306"
   },
   {
      "timestamp":1552262220000,
      "price":"322.1375276",
      "base_volume":"0.0825376",
      "counter_volume":"26.5884584"
   },
   ...
]
const axios = require('axios')

axios.get('https://api.stagestoq.net/market-data/market-history/chart?base_asset_code=IROB&base_asset_issuer=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM&counter_asset_code=DSQ&counter_asset_issuer=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF&end_time=1552262400000&start_time=1552176000000&resolution=60000')
  .then(response => console.log(response.data))
  .catch(console.log)

// output
[
   {
      "timestamp":1552262340000,
      "price":"322.1375267",
      "base_volume":"0.2642599",
      "counter_volume":"85.1280306"
   },
   {
      "timestamp":1552262220000,
      "price":"322.1375276",
      "base_volume":"0.0825376",
      "counter_volume":"26.5884584"
   },
   ...
]
import requests

data = requests.get('https://api.stagestoq.net/market-data/market-history/chart?base_asset_code=IROB&base_asset_issuer=GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM&counter_asset_code=DSQ&counter_asset_issuer=GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF&end_time=1552262400000&start_time=1552176000000&resolution=60000').json()
print(data)

# output
[
   {
      "timestamp":1552262340000,
      "price":"322.1375267",
      "base_volume":"0.2642599",
      "counter_volume":"85.1280306"
   },
   {
      "timestamp":1552262220000,
      "price":"322.1375276",
      "base_volume":"0.0825376",
      "counter_volume":"26.5884584"
   },
   ...
]

Charts give your users an easy way to interpret some of the underlying dynamics of an asset. We therefore offer you an endpoint with data optimized for most charting libraries. It gives you back a set of historic data points that you can use to build charts.

HTTP Request

GET https://api.stagestoq.net/market-data/market-history/chart

URL Params

All required URL params can be retrieved from the /core/assets call described above.

Parameter Description Required
base_asset_code Code of the base asset, e.g. IROB Yes
base_asset_issuer Public Key of the issuer of the base asset Yes
counter_asset_code Code of the counter asset, e.g. DSQ Yes
counter_asset_issuer Public Key of the counter asset Yes
start_time starting point of historic data as unix epoch in milliseconds Yes
end_time end point of historic data as unix epoch in milliseconds Yes
resolution segment of data in milliseconds, possible options are 60000, 300000, 900000, 3600000, 86400000, 604800000 Yes

Orders

# check fees
curl -X POST -H "Content-Type: application/json" -H "Authorization: JWT $TOKEN" -d '{"selling": "DSQ", "buying": "IROB", "price": 0.1, "amount": 5.4}' https://api.stagestoq.net/core/sign/offer/fee

# output
{"fee":"0.0050000","trading_pair":"DSQ"}

# create a presigned transaction
curl -X POST -H "Content-Type: application/json" -H "Authorization: JWT $TOKEN" -d '{"selling": "DSQ", "buying": "IROB", "price": 0.1, "amount": 5.4}' https://api.stagestoq.net/core/sign/offer

# output
{"xdr":"AAAAAI+9rxi7g7JaV1fr+EsOjrp50RevWd9wYvNquOyKZkHPAAAAZAAABdkAAAAEAAAAAAAAAAAAAAABAAAAAQAAAACPva8Yu4OyWldX6/hLDo66edEXr1nfcGLzarjsimZBzwAAAAMAAAABRFNRAAAAAABHB84JGCc/5+R3BOlxDMXPzkRrWjzfWQvocgCZlHVYuwAAAAFJUk9CAAAAAI7bUXQQfy8+/TUpZGXkA3E38BnJK2mXAg5qsH9fHgV/AAAAAAM3+YAAAAABAAAACgAAAAAAAAAAAAAAAAAAAAFnd0WGAAAAQInF7N+YotQ1El2+QpHmIm/AJy1o992BRS9rI58TtsU4WpSVb2tVLOpYY7t3tLNSZaaqkQlznLYlHR4UBrXduw8="}

# check JavaScript and Python for examples on how to broadcast that transaction
const StellarSdk = require("stellar-sdk")
const axios = require('axios')

// let's use the test network
StellarSdk.Network.useTestNetwork()
const server = new StellarSdk.Server('https://horizon-testnet.stellar.org')

// lets assume that this is the secret key of the user - see best practises on how to create and store this
const key = Keypair.fromSecret('SBK2VIYYSVG76E7VC3QHYARNFLY2EAQXDHRC7BMXBBGIFG74ARPRMNQM')

// check fees
axios
  .create({
    headers: {'Authorization': `JWT ${TOKEN}`}
  })
  .post('https://api.stagestoq.net/core/sign/offer/fee', {
    "selling": "DSQ",
    "buying": "IROB",
    "price": 0.1,
    "amount": 5.4
  })
  .then(response => console.log(response.data))
  .catch(console.log)

// output
{"fee": "0.0050000", "trading_pair": "DSQ"}

// build and submit a transaction
axios
  .create({
    headers: {'Authorization': `JWT ${TOKEN}`}
  })
  .post('https://api.stagestoq.net/core/sign/offer', {
    "selling": "DSQ",
    "buying": "IROB",
    "price": 0.1,
    "amount": 5.4
  })
  .then(async (response) => {
    // our api gives you a presigned transaction back
    const transaction = new StellarSdk.Transaction(response.data.xdr)
    // you need to sign it with your private key
    transaction.sign(key)

    // and broadcast it to the network
    await server.submitTransaction(transaction)
  })
  .catch(console.log)

// deleting an offer is very similar
axios
  .create({
    headers: {'Authorization': `JWT ${TOKEN}`}
  })
  // offer ids can be queried, check the wallet section!
  .delete('https://api.stagestoq.net/core/sign/offer/12345')
  .then(async (response) => {
    const transaction = new StellarSdk.Transaction(response.data.xdr)
    transaction.sign(key)
    await server.submitTransaction(transaction)
  })
  .catch(console.log)
import requests
from stellar_base import Keypair, Builder

# lets assume that this is the secret key of the user - see best practises on how to store this
secret = 'SBK2VIYYSVG76E7VC3QHYARNFLY2EAQXDHRC7BMXBBGIFG74ARPRMNQM'

# request fees
data = requests.post('https://api.stagestoq.net/core/sign/offer/fee', json={
  "selling": "DSQ",
  "buying": "IROB",
  "price": 0.1,
  "amount": 5.4
}, headers={'Authorization': f'JWT {TOKEN}'}).json()
print(data)

# output
{'fee': '0.0000000', 'trading_pair': 'DSQ'}

# create presigned transaction
data = requests.post('https://api.stagestoq.net/core/sign/offer', json={
  "selling": "DSQ",
  "buying": "IROB",
  "price": 0.1,
  "amount": 5.4
}, headers={'Authorization': f'JWT {TOKEN}'}).json()

# Sign and broadcast to the network
builder = Builder(secret)
builder.import_from_xdr(data['xdr'])
builder.sign()
builder.submit()

# deleting is similar
# offer ids can be queried, check the wallet section!
data = requests.delete('https://api.stagestoq.net/core/sign/offer/12345', headers={'Authorization': f'JWT {TOKEN}'}).json()

# Sign and broadcast to the network
builder = Builder(secret)
builder.import_from_xdr(data['xdr'])
builder.sign()
builder.submit()

We do have an endpoint for offers that returns a stellar transaction. This transaction needs to be signed by the clients private key and can afterwards be broadcasted to the blockchain.

Examples on how to do so are withing the JavaScript and Python examples where we assume you have either the JavaScript or the Python SDK installed. A lot more SDKs exist.

HTTP REQUEST

Request fees for an endpoint - this is POST to be in sync with the offer endpoint:

POST https://api.stagestoq.net/core/sign/offer/fee

Request a presigned transaction:

POST https://api.stagestoq.net/core/sign/offer

Request a presigned transaction delete:

DELETE https://api.stagestoq.net/core/sign/offer/<offer_id>

JSON Body

Parameter Description Required
selling Code of selling pair, e.g. DSQ Yes
buying Code of the buying pair, e.g. IROB Yes
amount Float of the amount of selling you want to offer Yes
price The price, determined as the ratio between buying and selling. If you want to buy 1 IROB and sell 10 DSQ the price would be buying / selling = 1 / 10 = 0.1 Yes

Wallet

Balances

curl -X GET -H "Authorization: JWT $TOKEN" https://api.stagestoq.net/core/accounts/balances

# output
{
   "public_key":"GCH33LYYXOB3EWSXK7V7QSYOR25HTUIXV5M564DC6NVLR3EKMZA46DBX",
   "balances":[
      {
         "balance":"67.0230751",
         "limit":"922337203685.4775807",
         "buying_liabilities":"0.0000000",
         "selling_liabilities":"0.0000000",
         "last_modified_ledger":17933,
         "asset_type":"credit_alphanum4",
         "asset_code":"DSQ",
         "asset_issuer":"GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
         "image":"https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMNSFHQ74O%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104259Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDAaDK9MAeGLwwRCynCswSKoBFAqGMLUY4J%2F4qiEkks5I9Cq9TUiCEeKUx5X7SmnxLD0j1kyMBwXe0KDD8OINURe30ZRQFEjIKGD%2BEaCvLeYr%2FrfcBmxpIh888lYdzUkrjsxpo8HDmJGi%2Bl9S3I0LQy7BltjV6pGWfBc3PGMjeHAZ20DK7r7ekrMLMIvjCg%2B%2FGcIeVnUWturpPKG%2BPkiScldw1VSTq3n1xB9k6rQTQDbkT%2BACWRBqYDXF6pqAGknPxr%2BWGxWuPJpVjPTKD9CmtTTm8ZqVDPZCNKQ1oDTDfWXVOGXetLdnCrivkZE2I9HT%2F50a0akmqHJMAZKmtxY4g9MOlpTUz0ZAel4PGcmKliS%2BC7dKwFEQU2XG8H0fu2ASGOxvBpgnNZ1spX5AzwuH5KkaOOnWwOFMnwXc4EPzzqD7R90VS8hgfduO1IOQR%2BiEKp5vIm%2BkehF43e5a5gmrI1hjC8WJf%2BJNiIiZh0D13I5BkyvkHNYdCJfWIjR3YVq2D3tnAbBHIjFz1K5%2By2I0051m7pk8ksFC6vOYgEXNdzOT8QjbG7NX6QFFu8BgI5mt7KXR%2BlBRxuoUvuyQP%2FIihLKLSW%2Fzdn3lE0EObfuDANm9Jfq2VMyKNdmFLeO2f%2BKmdqRs0XO6vQZ%2BMJXPSXD%2FHvcoVnLLrsNwGh6R8HQvVGV1wVVp2IBOP5jUf6u4ebiMV8wn%2F1JWy5VTGbW3qA90mHdNVUvpqmErEd6HaOGy%2FgiaL5s%2FYcmeBATpyig5qfkBQ%3D%3D&X-Amz-Signature=f183d97dc309b6ada083b14b953db82b134b0d58b3ae0924e62043482af981bc",
         "name":"DSQ Token",
         "is_trading_pair":true
      },
      {
         "balance":"0.0999999",
         "limit":"922337203685.4775807",
         "buying_liabilities":"0.0000000",
         "selling_liabilities":"0.0000000",
         "last_modified_ledger":17933,
         "asset_type":"credit_alphanum4",
         "asset_code":"IROB",
         "asset_issuer":"GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM",
         "image":"https://dstoq-stg-core-storage.s3.amazonaws.com/IROB.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMNSFHQ74O%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104259Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDAaDK9MAeGLwwRCynCswSKoBFAqGMLUY4J%2F4qiEkks5I9Cq9TUiCEeKUx5X7SmnxLD0j1kyMBwXe0KDD8OINURe30ZRQFEjIKGD%2BEaCvLeYr%2FrfcBmxpIh888lYdzUkrjsxpo8HDmJGi%2Bl9S3I0LQy7BltjV6pGWfBc3PGMjeHAZ20DK7r7ekrMLMIvjCg%2B%2FGcIeVnUWturpPKG%2BPkiScldw1VSTq3n1xB9k6rQTQDbkT%2BACWRBqYDXF6pqAGknPxr%2BWGxWuPJpVjPTKD9CmtTTm8ZqVDPZCNKQ1oDTDfWXVOGXetLdnCrivkZE2I9HT%2F50a0akmqHJMAZKmtxY4g9MOlpTUz0ZAel4PGcmKliS%2BC7dKwFEQU2XG8H0fu2ASGOxvBpgnNZ1spX5AzwuH5KkaOOnWwOFMnwXc4EPzzqD7R90VS8hgfduO1IOQR%2BiEKp5vIm%2BkehF43e5a5gmrI1hjC8WJf%2BJNiIiZh0D13I5BkyvkHNYdCJfWIjR3YVq2D3tnAbBHIjFz1K5%2By2I0051m7pk8ksFC6vOYgEXNdzOT8QjbG7NX6QFFu8BgI5mt7KXR%2BlBRxuoUvuyQP%2FIihLKLSW%2Fzdn3lE0EObfuDANm9Jfq2VMyKNdmFLeO2f%2BKmdqRs0XO6vQZ%2BMJXPSXD%2FHvcoVnLLrsNwGh6R8HQvVGV1wVVp2IBOP5jUf6u4ebiMV8wn%2F1JWy5VTGbW3qA90mHdNVUvpqmErEd6HaOGy%2FgiaL5s%2FYcmeBATpyig5qfkBQ%3D%3D&X-Amz-Signature=21a4181beca9c65c7defb309b75a76662033d01800cdfa78c6d4de06bf0919b4",
         "name":"L&G ROBO Global Robotics and Automation UCITS ETF",
         "is_trading_pair":false
      },
      ...
   ]
}
const axios = require('axios')

axios
  .create({
    headers: {'Authorization': `JWT ${TOKEN}`}
  })
  .get('https://api.stagestoq.net/core/accounts/balances')
  .then(response => console.log(response.data))
  .catch(console.log)

  // output
  {
     "public_key":"GCH33LYYXOB3EWSXK7V7QSYOR25HTUIXV5M564DC6NVLR3EKMZA46DBX",
     "balances":[
        {
           "balance":"67.0230751",
           "limit":"922337203685.4775807",
           "buying_liabilities":"0.0000000",
           "selling_liabilities":"0.0000000",
           "last_modified_ledger":17933,
           "asset_type":"credit_alphanum4",
           "asset_code":"DSQ",
           "asset_issuer":"GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
           "image":"https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMNSFHQ74O%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104259Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDAaDK9MAeGLwwRCynCswSKoBFAqGMLUY4J%2F4qiEkks5I9Cq9TUiCEeKUx5X7SmnxLD0j1kyMBwXe0KDD8OINURe30ZRQFEjIKGD%2BEaCvLeYr%2FrfcBmxpIh888lYdzUkrjsxpo8HDmJGi%2Bl9S3I0LQy7BltjV6pGWfBc3PGMjeHAZ20DK7r7ekrMLMIvjCg%2B%2FGcIeVnUWturpPKG%2BPkiScldw1VSTq3n1xB9k6rQTQDbkT%2BACWRBqYDXF6pqAGknPxr%2BWGxWuPJpVjPTKD9CmtTTm8ZqVDPZCNKQ1oDTDfWXVOGXetLdnCrivkZE2I9HT%2F50a0akmqHJMAZKmtxY4g9MOlpTUz0ZAel4PGcmKliS%2BC7dKwFEQU2XG8H0fu2ASGOxvBpgnNZ1spX5AzwuH5KkaOOnWwOFMnwXc4EPzzqD7R90VS8hgfduO1IOQR%2BiEKp5vIm%2BkehF43e5a5gmrI1hjC8WJf%2BJNiIiZh0D13I5BkyvkHNYdCJfWIjR3YVq2D3tnAbBHIjFz1K5%2By2I0051m7pk8ksFC6vOYgEXNdzOT8QjbG7NX6QFFu8BgI5mt7KXR%2BlBRxuoUvuyQP%2FIihLKLSW%2Fzdn3lE0EObfuDANm9Jfq2VMyKNdmFLeO2f%2BKmdqRs0XO6vQZ%2BMJXPSXD%2FHvcoVnLLrsNwGh6R8HQvVGV1wVVp2IBOP5jUf6u4ebiMV8wn%2F1JWy5VTGbW3qA90mHdNVUvpqmErEd6HaOGy%2FgiaL5s%2FYcmeBATpyig5qfkBQ%3D%3D&X-Amz-Signature=f183d97dc309b6ada083b14b953db82b134b0d58b3ae0924e62043482af981bc",
           "name":"DSQ Token",
           "is_trading_pair":true
        },
        {
           "balance":"0.0999999",
           "limit":"922337203685.4775807",
           "buying_liabilities":"0.0000000",
           "selling_liabilities":"0.0000000",
           "last_modified_ledger":17933,
           "asset_type":"credit_alphanum4",
           "asset_code":"IROB",
           "asset_issuer":"GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM",
           "image":"https://dstoq-stg-core-storage.s3.amazonaws.com/IROB.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMNSFHQ74O%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104259Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDAaDK9MAeGLwwRCynCswSKoBFAqGMLUY4J%2F4qiEkks5I9Cq9TUiCEeKUx5X7SmnxLD0j1kyMBwXe0KDD8OINURe30ZRQFEjIKGD%2BEaCvLeYr%2FrfcBmxpIh888lYdzUkrjsxpo8HDmJGi%2Bl9S3I0LQy7BltjV6pGWfBc3PGMjeHAZ20DK7r7ekrMLMIvjCg%2B%2FGcIeVnUWturpPKG%2BPkiScldw1VSTq3n1xB9k6rQTQDbkT%2BACWRBqYDXF6pqAGknPxr%2BWGxWuPJpVjPTKD9CmtTTm8ZqVDPZCNKQ1oDTDfWXVOGXetLdnCrivkZE2I9HT%2F50a0akmqHJMAZKmtxY4g9MOlpTUz0ZAel4PGcmKliS%2BC7dKwFEQU2XG8H0fu2ASGOxvBpgnNZ1spX5AzwuH5KkaOOnWwOFMnwXc4EPzzqD7R90VS8hgfduO1IOQR%2BiEKp5vIm%2BkehF43e5a5gmrI1hjC8WJf%2BJNiIiZh0D13I5BkyvkHNYdCJfWIjR3YVq2D3tnAbBHIjFz1K5%2By2I0051m7pk8ksFC6vOYgEXNdzOT8QjbG7NX6QFFu8BgI5mt7KXR%2BlBRxuoUvuyQP%2FIihLKLSW%2Fzdn3lE0EObfuDANm9Jfq2VMyKNdmFLeO2f%2BKmdqRs0XO6vQZ%2BMJXPSXD%2FHvcoVnLLrsNwGh6R8HQvVGV1wVVp2IBOP5jUf6u4ebiMV8wn%2F1JWy5VTGbW3qA90mHdNVUvpqmErEd6HaOGy%2FgiaL5s%2FYcmeBATpyig5qfkBQ%3D%3D&X-Amz-Signature=21a4181beca9c65c7defb309b75a76662033d01800cdfa78c6d4de06bf0919b4",
           "name":"L&G ROBO Global Robotics and Automation UCITS ETF",
           "is_trading_pair":false
        },
        ...
     ]
  }
import requests

data = requests.get(
  'https://api.stagestoq.net/core/accounts/balances',
  headers={'Authorization': f'JWT {TOKEN}'}
).json()
print(data)

# output
{
  'public_key': 'GCH33LYYXOB3EWSXK7V7QSYOR25HTUIXV5M564DC6NVLR3EKMZA46DBX',
  'balances': [{
      'balance': '67.0230751',
      'limit': '922337203685.4775807',
      'buying_liabilities': '0.0000000',
      'selling_liabilities': '0.0000000',
      'last_modified_ledger': 17933,
      'asset_type': 'credit_alphanum4',
      'asset_code': 'DSQ',
      'asset_issuer': 'GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
      'image': 'https://dstoq-stg-core-storage.s3.amazonaws.com/dstoq.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDFW6H76L%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104703Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDMaDK%2BTT7tEuyWdOdnJcyKoBOKaDH1rBQD3TwTujcKjcY8oMW%2FZAL2QE0DUdpTCqhhr0cg9KGjv3wxiQsyj0JfHHZ2NbpHeQlBp4ICjaCgJKuZQ044KCj%2F31IMDNiDVsHagW2GHrzndkEy2ftGCikSemPbK9Bmy0mIMnEth2dDWDqJ4DBfGfuPz59I5xEGBjqDLUelk8rBme5MObsElEZeXf25MIXGa0JE3HtDjyp2z5pLT02VwxFE0%2FM04VIJlYBoMNdZGxWQjXo3pgpKmH8QmoQkXT63CcP1pi0%2F9MLcprJi4pKLSytygfRPiqQHd0RxTzAwihRI3AIiYdXUWpXUIbsXGBPMrJ1XHNlFtA%2FocDBCwDtqEkBZHoQDOP6hEZC5H%2F5KtuTFPBLljRz0Fj3TLyVI3PqgUthaCO6KH3mZAWXxjFBims4ILU1D8TLt3lhBdc8kJkRWV2l12LJy7G8%2BQjznKXfEpws2iOEYwKpGR5awd8E0ve9NsL9HBDjmelX9tG7VoHwdj4OqAIq9vF2SiubwP%2FaRIhVQf%2FJA4tZg4tytuJXEWuzirZO9t0Jt3b5Ji%2BcJikmkQh%2FLjGgAAw9YMWcWg7h%2Fxd6ZoSWMx7KyjIU8oWhm42jnPL14BYXtF9WvF5YYcx3yVGtJUgxj0ah4gB%2FlipSVetOT2jDNUgmMU3e4eGmANqWbUNJs1%2BWTtUnz1xGbLK7u61fRUqcXn3FL94C6EaB%2BNrXFFc2%2BadO%2FVdEAH%2Fhx50VILQiiyuajkBQ%3D%3D&X-Amz-Signature=241d461c599007bf11384a097f57ab70f49d0b4d18bd18d15b4bb744694fdf6e',
      'name': 'DSQ Token',
      'is_trading_pair': True
    },
    {
      'balance': '0.0000000',
      'limit': '922337203685.4775807',
      'buying_liabilities': '0.0000000',
      'selling_liabilities': '0.0000000',
      'last_modified_ledger': 1847,
      'asset_type': 'credit_alphanum4',
      'asset_code': 'USD',
      'asset_issuer': 'GAA4MFNZGUPJAVLWWG6G5XZJFZDHLKQNG3Q6KB24BAD6JHNNVXDCF4XG',
      'image': 'https://dstoq-stg-core-storage.s3.amazonaws.com/dollar.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDFW6H76L%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104703Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDMaDK%2BTT7tEuyWdOdnJcyKoBOKaDH1rBQD3TwTujcKjcY8oMW%2FZAL2QE0DUdpTCqhhr0cg9KGjv3wxiQsyj0JfHHZ2NbpHeQlBp4ICjaCgJKuZQ044KCj%2F31IMDNiDVsHagW2GHrzndkEy2ftGCikSemPbK9Bmy0mIMnEth2dDWDqJ4DBfGfuPz59I5xEGBjqDLUelk8rBme5MObsElEZeXf25MIXGa0JE3HtDjyp2z5pLT02VwxFE0%2FM04VIJlYBoMNdZGxWQjXo3pgpKmH8QmoQkXT63CcP1pi0%2F9MLcprJi4pKLSytygfRPiqQHd0RxTzAwihRI3AIiYdXUWpXUIbsXGBPMrJ1XHNlFtA%2FocDBCwDtqEkBZHoQDOP6hEZC5H%2F5KtuTFPBLljRz0Fj3TLyVI3PqgUthaCO6KH3mZAWXxjFBims4ILU1D8TLt3lhBdc8kJkRWV2l12LJy7G8%2BQjznKXfEpws2iOEYwKpGR5awd8E0ve9NsL9HBDjmelX9tG7VoHwdj4OqAIq9vF2SiubwP%2FaRIhVQf%2FJA4tZg4tytuJXEWuzirZO9t0Jt3b5Ji%2BcJikmkQh%2FLjGgAAw9YMWcWg7h%2Fxd6ZoSWMx7KyjIU8oWhm42jnPL14BYXtF9WvF5YYcx3yVGtJUgxj0ah4gB%2FlipSVetOT2jDNUgmMU3e4eGmANqWbUNJs1%2BWTtUnz1xGbLK7u61fRUqcXn3FL94C6EaB%2BNrXFFc2%2BadO%2FVdEAH%2Fhx50VILQiiyuajkBQ%3D%3D&X-Amz-Signature=de68ecf0ff52fa841f4ed5d8970773ad6f5f1bd0324e9f06b6d1f577670913a1', 'name': 'US Dollar', 'is_trading_pair': True}, {'balance': '0.0999999', 'limit': '922337203685.4775807', 'buying_liabilities': '0.0000000', 'selling_liabilities': '0.0000000', 'last_modified_ledger': 17933, 'asset_type': 'credit_alphanum4', 'asset_code': 'IROB', 'asset_issuer': 'GCHNWULUCB7S6PX5GUUWIZPEANYTP4AZZEVWTFYCBZVLA727DYCX7RZM', 'image': 'https://dstoq-stg-core-storage.s3.amazonaws.com/IROB.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAXCUIDBVMDFW6H76L%2F20190314%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20190314T104703Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEDMaDK%2BTT7tEuyWdOdnJcyKoBOKaDH1rBQD3TwTujcKjcY8oMW%2FZAL2QE0DUdpTCqhhr0cg9KGjv3wxiQsyj0JfHHZ2NbpHeQlBp4ICjaCgJKuZQ044KCj%2F31IMDNiDVsHagW2GHrzndkEy2ftGCikSemPbK9Bmy0mIMnEth2dDWDqJ4DBfGfuPz59I5xEGBjqDLUelk8rBme5MObsElEZeXf25MIXGa0JE3HtDjyp2z5pLT02VwxFE0%2FM04VIJlYBoMNdZGxWQjXo3pgpKmH8QmoQkXT63CcP1pi0%2F9MLcprJi4pKLSytygfRPiqQHd0RxTzAwihRI3AIiYdXUWpXUIbsXGBPMrJ1XHNlFtA%2FocDBCwDtqEkBZHoQDOP6hEZC5H%2F5KtuTFPBLljRz0Fj3TLyVI3PqgUthaCO6KH3mZAWXxjFBims4ILU1D8TLt3lhBdc8kJkRWV2l12LJy7G8%2BQjznKXfEpws2iOEYwKpGR5awd8E0ve9NsL9HBDjmelX9tG7VoHwdj4OqAIq9vF2SiubwP%2FaRIhVQf%2FJA4tZg4tytuJXEWuzirZO9t0Jt3b5Ji%2BcJikmkQh%2FLjGgAAw9YMWcWg7h%2Fxd6ZoSWMx7KyjIU8oWhm42jnPL14BYXtF9WvF5YYcx3yVGtJUgxj0ah4gB%2FlipSVetOT2jDNUgmMU3e4eGmANqWbUNJs1%2BWTtUnz1xGbLK7u61fRUqcXn3FL94C6EaB%2BNrXFFc2%2BadO%2FVdEAH%2Fhx50VILQiiyuajkBQ%3D%3D&X-Amz-Signature=fadb3c0f1cdc8a808d63712265904662a4c9f611908c07f134eb3866a1623673',
      'name': 'L&G ROBO Global Robotics and Automation UCITS ETF',
      'is_trading_pair': False
    },
    ...
  ]
}

You can find out about the current balances that the user has in his or her wallet by querying this endpoint.

Useful information such as liabillities (part of the balance that is in pending offers) images and so on are included.

HTTP Request

GET https://api.stagestoq.net/core/accounts/balances

History

curl https://api.stagestoq.net/market-data/transaction-history/GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL

# output
{
  "pending": [
    {
      "type": "offer",
      "created_at": "2019-03-07T15:03:36Z",
      "base_asset_type": "credit_alphanum4",
      "base_asset_code": "DSQ",
      "base_asset_issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
      "counter_asset_code": "USD",
      "counter_asset_type": "credit_alphanum4",
      "counter_asset_issuer": "GAA4MFNZGUPJAVLWWG6G5XZJFZDHLKQNG3Q6KB24BAD6JHNNVXDCF4XG",
      "amount": "2000.0000000",
      "price": "0.0410000",
      "id": 748557
    },
    ...
  ],
  "completed": [
    {
    "type": "account_credited",
    "created_at": "2019-03-07T18:38:38Z",
    "asset_type": "native",
    "asset_code": "XLM",
    "asset_issuer": null,
    "from": "GCU4S76C6TOY76EORMKA7G3PKUQZJWG5ORE2TDUVW6XCEIZHHPZAZVHH",
    "to": "GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL",
    "amount": "0.5000400"
    }
  ],
  "pagination": {
    "operations": {
      "next": {
      "cursor": "593268127580163",
      "limit": 10,
      "order": "desc"
      },
      "prev": {
      "cursor": "750141808062465",
      "limit": 10,
      "order": "asc"
      }
    },
    "trades": {
      "next": {
        "cursor": "144684563304451-0",
        "limit": 10,
        "order": "desc"
      },
      "prev": {
        "cursor": "750141808062465-0",
        "limit": 10,
        "order": "asc"
      }
    },
    "offers": {
        "next": {
        "cursor": "310275",
        "limit": 10,
        "order": "desc"
        },
        "prev": {
        "cursor": "748557",
        "limit": 10,
        "order": "asc"
      }
    }
  }
}
const axios = require('axios')

axios.get('https://api.stagestoq.net/market-data/transaction-history/GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL')
  .then(response => console.log(response.data))
  .catch(console.log)

// output
{
  "pending": [
    {
      "type": "offer",
      "created_at": "2019-03-07T15:03:36Z",
      "base_asset_type": "credit_alphanum4",
      "base_asset_code": "DSQ",
      "base_asset_issuer": "GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF",
      "counter_asset_code": "USD",
      "counter_asset_type": "credit_alphanum4",
      "counter_asset_issuer": "GAA4MFNZGUPJAVLWWG6G5XZJFZDHLKQNG3Q6KB24BAD6JHNNVXDCF4XG",
      "amount": "2000.0000000",
      "price": "0.0410000",
      "id": 748557
    },
    ...
  ],
  "completed": [
    {
    "type": "account_credited",
    "created_at": "2019-03-07T18:38:38Z",
    "asset_type": "native",
    "asset_code": "XLM",
    "asset_issuer": null,
    "from": "GCU4S76C6TOY76EORMKA7G3PKUQZJWG5ORE2TDUVW6XCEIZHHPZAZVHH",
    "to": "GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL",
    "amount": "0.5000400"
    }
  ],
  "pagination": {
    "operations": {
      "next": {
      "cursor": "593268127580163",
      "limit": 10,
      "order": "desc"
      },
      "prev": {
      "cursor": "750141808062465",
      "limit": 10,
      "order": "asc"
      }
    },
    "trades": {
      "next": {
        "cursor": "144684563304451-0",
        "limit": 10,
        "order": "desc"
      },
      "prev": {
        "cursor": "750141808062465-0",
        "limit": 10,
        "order": "asc"
      }
    },
    "offers": {
        "next": {
        "cursor": "310275",
        "limit": 10,
        "order": "desc"
        },
        "prev": {
        "cursor": "748557",
        "limit": 10,
        "order": "asc"
      }
    }
  }
}
import requests

data = requests.get('https://api.stagestoq.net/market-data/transaction-history/GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL').json()
print(data)

# output
{
  'completed': [
    {
      'amount': '0.5000400',
      'asset_code': 'XLM',
      'asset_issuer': None,
      'asset_type': 'native',
      'created_at': '2019-03-07T18:38:38Z',
      'from': 'GCU4S76C6TOY76EORMKA7G3PKUQZJWG5ORE2TDUVW6XCEIZHHPZAZVHH',
      'to': 'GAPX7I6E75T3HI3KJAXJLWOQXWMS4XVC3NOVVQDC2QJQ236N6ZOFL2LL',
      'type': 'account_credited'
    },
    ...
  ],
  'pending': [
    {
      'amount': '2000.0000000',
      'base_asset_code': 'DSQ',
      'base_asset_issuer': 'GBDQPTQJDATT7Z7EO4COS4IMYXH44RDLLI6N6WIL5BZABGMUOVMLWMQF',
      'base_asset_type': 'credit_alphanum4',
      'counter_asset_code': 'USD',
      'counter_asset_issuer': 'GAA4MFNZGUPJAVLWWG6G5XZJFZDHLKQNG3Q6KB24BAD6JHNNVXDCF4XG',
      'counter_asset_type': 'credit_alphanum4',
      'created_at': '2019-03-07T15:03:36Z',
      'id': 748557,
      'price': '0.0410000',
      'type': 'offer'
    },
    ...
  ]
  'pagination': {
    'offers': {
      'next': {
        'cursor': '310275',
        'limit': 10,
        'order': 'desc'
      },
      'prev': {
        'cursor': '748557',
        'limit': 10,
        'order': 'asc'
      }
    },
    'operations': {
      'next': {
        'cursor': '593268127580163',
        'include_failed': 'false',
        'limit': 10,
        'order': 'desc'
      },
      'prev': {
        'cursor': '750141808062465',
        'include_failed': 'false',
        'limit': 10,
        'order': 'asc'
      }
    },
    'trades': {
      'next': {
        'cursor': '144684563304451-0',
        'limit': 10,
        'order': 'desc'},
      'prev': {
        'cursor': '750141808062465-0',
        'limit': 10,
        'order': 'asc'
      }
    }
  }
}

You can use this endpoint to retrieve the complete, paginated transaction history for a given account.

The pagination can be managed on a transaction type level for trades, offers and operations.

HTTP Requests

GET https://api.stagestoq.net/market-data/transaction-history/<PUBLIC_KEY>

URL Params

Parameter Description Required
operation_exclude A value of 1 will exclude transaction of type operations, defaults to 0 No
operation_cursor A cursor on where to start the pagination, can be retrieved from the pagination object of the previous result No
operation_order Order type, asc for ascending, desc for decending No
trade_exclude A value of 1 will exclude transaction of type trade, defaults to 0 No
trade_cursor A cursor on where to start the pagination, can be retrieved from the pagination object of the previous result No
trade_order Order type, asc for ascending, desc for decending No
offer_exclude A value of 1 will exclude transaction of type offer, defaults to 0 No
offer_cursor A cursor on where to start the pagination, can be retrieved from the pagination object of the previous result No
offer_order Order type, asc for ascending, desc for decending No

Best Practices

Key Management

Unless partner the is not licensed under their domestic regulations to hold customers fund, key managment of customer is not possible. Depending on the juristdication it can be provided through our collaboration partners.

In general, keys shouldn't be stored on the partners end but only held by their customers (e.g. on device or on a hard wallet).

Customer Onboarding

Customer onboarding is subject to mutual recognition of a process of KYC/AML of all partners and subject to case by case analysis and collaboaration.