Overview
This guide walks you through placing your first order using the Pro API. You’ll learn to fetch market data, check your account, and execute a trade.Prerequisites: You need a Pro account and an API key with Trade scope. Contact support@daya.co to request access. See Authentication for details.
Step 1: Fetch Available Markets
First, check which markets are available. This endpoint doesn’t require authentication:curl --request GET \
--url https://api.pro.daya.co/public/v1/markets
const response = await fetch('https://api.pro.daya.co/public/v1/markets');
const result = await response.json();
console.log(result.data);
import requests
response = requests.get('https://api.pro.daya.co/public/v1/markets')
result = response.json()
print(result['data'])
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://api.pro.daya.co/public/v1/markets")
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["data"])
}
{
"success": true,
"message": "Markets retrieved successfully",
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"symbol": "USD-NGN",
"base_asset": "USD",
"quote_asset": "NGN",
"status": "active",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
],
"timestamp": "2024-01-15T10:30:00Z"
}
Step 2: Check the Orderbook
View current market depth for your chosen pair:curl --request GET \
--url 'https://api.pro.daya.co/public/v1/orderbook/USDT-NGN?depth=10'
const response = await fetch(
'https://api.pro.daya.co/public/v1/orderbook/USDT-NGN?depth=10'
);
const result = await response.json();
console.log('Best bid:', result.data.bids[0]);
console.log('Best ask:', result.data.asks[0]);
import requests
response = requests.get(
'https://api.pro.daya.co/public/v1/orderbook/USDT-NGN',
params={'depth': 10}
)
result = response.json()
print(f"Best bid: {result['data']['bids'][0]}")
print(f"Best ask: {result['data']['asks'][0]}")
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://api.pro.daya.co/public/v1/orderbook/USDT-NGN?depth=10")
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
data := result["data"].(map[string]interface{})
bids := data["bids"].([]interface{})
asks := data["asks"].([]interface{})
fmt.Println("Best bid:", bids[0])
fmt.Println("Best ask:", asks[0])
}
Step 3: Place a Limit Order
Now place an order. This requires an API key with Trade scope:curl --request POST \
--url https://api.pro.daya.co/public/v1/orders \
--header 'X-Api-Key: daya_sk_YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"symbol": "USDT-NGN",
"side": "buy",
"type": "limit",
"price": "1545.00",
"quantity": "100.00"
}'
const response = await fetch('https://api.pro.daya.co/public/v1/orders', {
method: 'POST',
headers: {
'X-Api-Key': 'daya_sk_YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
symbol: 'USDT-NGN',
side: 'buy',
type: 'limit',
price: '1545.00',
quantity: '100.00'
})
});
const order = await response.json();
console.log('Order placed:', order);
import requests
headers = {
'X-Api-Key': 'daya_sk_YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
'symbol': 'USDT-NGN',
'side': 'buy',
'type': 'limit',
'price': '1545.00',
'quantity': '100.00'
}
response = requests.post(
'https://api.pro.daya.co/public/v1/orders',
headers=headers,
json=data
)
order = response.json()
print(f"Order placed: {order}")
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
order := map[string]string{
"symbol": "USDT-NGN",
"side": "buy",
"type": "limit",
"price": "1545.00",
"quantity": "100.00",
}
body, _ := json.Marshal(order)
req, _ := http.NewRequest("POST", "https://api.pro.daya.co/public/v1/orders", bytes.NewBuffer(body))
req.Header.Set("X-Api-Key", "daya_sk_YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println("Order placed:", result)
}
{
"success": true,
"message": "Order placed successfully",
"data": {
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending_settlement",
"side": "buy",
"type": "limit",
"symbol": "USD-NGN",
"requested_quantity": "100.00000000",
"filled_quantity": "0.00000000",
"remaining_quantity": "100.00000000",
"avg_fill_price": "",
"total_fee_charged": "",
"created_at": "2024-01-15T10:35:00Z",
"updated_at": "2024-01-15T10:35:00Z"
},
"timestamp": "2024-01-15T10:35:00Z"
}
Step 4: Check Your Orders
View your open orders:curl --request GET \
--url 'https://api.pro.daya.co/public/v1/orders?symbol=USDT-NGN' \
--header 'X-Api-Key: daya_sk_YOUR_API_KEY'
const response = await fetch(
'https://api.pro.daya.co/public/v1/orders?symbol=USDT-NGN',
{
headers: { 'X-Api-Key': 'daya_sk_YOUR_API_KEY' }
}
);
const data = await response.json();
console.log('Your orders:', data.data);
import requests
headers = {'X-Api-Key': 'daya_sk_YOUR_API_KEY'}
response = requests.get(
'https://api.pro.daya.co/public/v1/orders',
headers=headers,
params={'symbol': 'USDT-NGN'}
)
orders = response.json()
print(f"Your orders: {orders['data']}")
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.pro.daya.co/public/v1/orders?symbol=USDT-NGN", nil)
req.Header.Set("X-Api-Key", "daya_sk_YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println("Your orders:", data["data"])
}
Step 5: Cancel an Order
Cancel an open order if needed:curl --request DELETE \
--url https://api.pro.daya.co/public/v1/orders/550e8400-e29b-41d4-a716-446655440000 \
--header 'X-Api-Key: daya_sk_YOUR_API_KEY'
const response = await fetch(
'https://api.pro.daya.co/public/v1/orders/550e8400-e29b-41d4-a716-446655440000',
{
method: 'DELETE',
headers: { 'X-Api-Key': 'daya_sk_YOUR_API_KEY' }
}
);
if (response.ok) {
console.log('Order cancelled');
}
import requests
headers = {'X-Api-Key': 'daya_sk_YOUR_API_KEY'}
response = requests.delete(
'https://api.pro.daya.co/public/v1/orders/550e8400-e29b-41d4-a716-446655440000',
headers=headers
)
if response.ok:
print('Order cancelled')
package main
import (
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://api.pro.daya.co/public/v1/orders/550e8400-e29b-41d4-a716-446655440000", nil)
req.Header.Set("X-Api-Key", "daya_sk_YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
fmt.Println("Order cancelled")
}
}
Order Types
| Type | Description | Required Fields |
|---|---|---|
| limit | Execute at specified price or better | price, quantity |
| market | Execute immediately at best available price | quantity |
Order Status
| Status | Description |
|---|---|
pending_settlement | Order is awaiting settlement |
new | Order has been created |
open | Order is active on the orderbook |
partially_filled | Order is partially executed |
filled | Order is completely executed |
cancelled | Order was cancelled by user |
rejected | Order was rejected by the system |
failed | Order failed to execute |
Next Steps
Markets API
Full markets and orderbook reference
Orders API
Complete order management reference