Trading Sessions
curl --request GET \
--url https://api.tickdb.ai/v1/market/trading-sessions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/trading-sessions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/market/trading-sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tickdb.ai/v1/market/trading-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tickdb.ai/v1/market/trading-sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/market/trading-sessions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/trading-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": [
{
"market": "US",
"trading_sessions": [
{
"begin_time": 400,
"end_time": 930,
"trade_session": 1
},
{
"begin_time": 930,
"end_time": 1600
},
{
"begin_time": 1600,
"end_time": 2000,
"trade_session": 2
}
]
}
]
}Stock Market APIs
Trading Sessions
Query trading session information for a specified market, including opening time, closing time, etc.
GET
/
v1
/
market
/
trading-sessions
Trading Sessions
curl --request GET \
--url https://api.tickdb.ai/v1/market/trading-sessions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/trading-sessions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/market/trading-sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tickdb.ai/v1/market/trading-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tickdb.ai/v1/market/trading-sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/market/trading-sessions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/trading-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": [
{
"market": "US",
"trading_sessions": [
{
"begin_time": 400,
"end_time": 930,
"trade_session": 1
},
{
"begin_time": 930,
"end_time": 1600
},
{
"begin_time": 1600,
"end_time": 2000,
"trade_session": 2
}
]
}
]
}Notes
- Market code is case-insensitive
- All returned times are in the local timezone of each market
Supported Markets
- US - US Stock Market
- HK - Hong Kong Stock Exchange
- CN - A-Share Market
Request Parameters
| Parameter | Required | Description |
|---|---|---|
| market | Yes | Market code, options: US, HK, CN |
Response Fields
| Field | Description |
|---|---|
| market | Market (US - US Stock Market, HK - Hong Kong Stock Exchange, CN - A-Share Market) |
| trading_sessions | Trading sessions array |
| └─ begin_time | Trading start time, format: hhmm, e.g., 900 |
| └─ end_time | Trading end time, format: hhmm, e.g., 1400 |
| └─ trade_session | Trading session type (0 - Normal Trading, 1 - Pre-Market, 2 - After-Hours, 3 - Overnight) |
Authorizations
Query Parameters
Market code (US, HK, CN)
Available options:
US, HK, CN Example:
"US"
Response
200 - application/json
Successful response
Example:
0
Example:
"success"
Show child attributes
Show child attributes
Example:
[
{
"market": "US",
"trading_sessions": [
{
"begin_time": 400,
"end_time": 930,
"trade_session": 1
},
{ "begin_time": 930, "end_time": 1600 },
{
"begin_time": 1600,
"end_time": 2000,
"trade_session": 2
}
]
}
]
⌘I
