POSTaliyunmarket-cmapi00066016-finance-a-shares-price
中国A株株価
中国A株株価
導入ドキュメント
中国A株株価
実装サンプルコード
Shell、Python、Go、Java、PHP の呼び出し例をまとめ、既存プロジェクトに組み込みやすくしています。
Shell 例
curl --request POST \
--url 'https://openapi.toolkk.com/v1/aliyunmarket-cmapi00066016-finance-a-shares-price' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{\n "symbol": "品种代码,以英文逗号分割,如:sz000002,bj430047"\n}'Python 例
import os
import requests
url = "https://openapi.toolkk.com/v1/aliyunmarket-cmapi00066016-finance-a-shares-price"
payload = {
"symbol": "品种代码,以英文逗号分割,如:sz000002,bj430047"
}
headers = {
"Content-Type": "application/json",
"X-API-Key": os.getenv("TOOLKK_API_KEY", "YOUR_API_KEY"),
}
response = requests.request("POST", url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json())Go 例
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://openapi.toolkk.com/v1/aliyunmarket-cmapi00066016-finance-a-shares-price"
payload := []byte("{\n \"symbol\": \"品种代码,以英文逗号分割,如:sz000002,bj430047\"\n}")
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}Java 例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolkkExample {
public static void main(String[] args) throws Exception {
String payload = "{\n \"symbol\": \"品种代码,以英文逗号分割,如:sz000002,bj430047\"\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.toolkk.com/v1/aliyunmarket-cmapi00066016-finance-a-shares-price"))
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP 例
<?php
$endpoint = 'https://openapi.toolkk.com/v1/aliyunmarket-cmapi00066016-finance-a-shares-price';
$payload = "{\n \"symbol\": \"品种代码,以英文逗号分割,如:sz000002,bj430047\"\n}";
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;リクエスト例
{
"symbol": "品种代码,以英文逗号分割,如:sz000002,bj430047"
}レスポンス例
{
"msg": "成功",
"code": 200,
"taskNo": "202960247220113090298671",
"data": {
"sh688193": {
"name": "仁度生物",
"bid1_vol": "3850",
"high": "28.670",
"update_time": 1713336733,
"low": "26.710",
"price": "27.910",
"ask1_vol": "454",
"bid2_vol": "700",
"changeRate": "4.6887",
"ask5_vol": "600",
"value": "8457252.000",
"bid4_vol": "40",
"change": "1.2500",
"bid3_vol": "1400",
"ask2_vol": "843",
"volume": "303488",
"bid5_vol": "1400",
"ask4_vol": "2064",
"ask5": "28.160",
"ask2": "28.010",
"ask1": "28.000",
"bid5": "27.780",
"ask4": "28.130",
"ask3": "28.020",
"ask": "28.000",
"bid3": "27.840",
"bid4": "27.830",
"bid1": "27.900",
"bid2": "27.850",
"preclose": "26.660",
"bid": "27.900",
"open": "26.880",
"ask3_vol": "1400"
}
}
}リクエスト項目
以下の項目はサンプル JSON から自動抽出した参考情報です。
| パス | 型 | サンプル値 |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.symbol | object | {...} |
| properties.symbol.type | string | string |
| properties.symbol.description | string | 品种代码,以英文逗号分割,如:sz000002,bj430047 |
| required | array | "symbol" |
| required[] | string | symbol |
レスポンス項目
以下の項目はサンプル JSON から自動抽出した参考情報です。
| パス | 型 | サンプル値 |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.msg | object | {...} |
| properties.msg.type | string | string |
| properties.msg.example | string | 成功 |
| properties.msg.description | string | 接口返回码对应的描述信息 |
| properties.code | object | {...} |