TY 太一数据 OneShare 接口文档

日期工具

交易日偏移

计算交易日偏移

版本 1 更新于 2026-07-16 18:19

接口基本信息

  • 接口名称: offset_trading_date
  • 功能描述: 计算基准日期偏移若干个交易日/周/月后的日期
  • 数据更新频率: 实时
  • 请求方法: POST
  • API 路径: https://api.wanxingai.com/openapi/offset_trading_date/


使用示例

import requests

url = "https://api.wanxingai.com/openapi/offset_trading_date/"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-********"
}
# 基准日 2026-04-18,前推 5 个交易日
payload = {
    "marketcode": "212001",
    "startdate": "2026-04-18",
    "offset": "-5"
}

resp = requests.post(url, json=payload, headers=headers)
print(resp.json())
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
String json = """
    {"marketcode": "212001", "startdate": "2026-04-18", "offset": "-5"}
    """;

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.wanxingai.com/openapi/offset_trading_date/"))
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer sk-********")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
curl -X POST https://api.wanxingai.com/openapi/offset_trading_date/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-********" \
  -d '{"marketcode": "212001", "startdate": "2026-04-18", "offset": "-5"}'

输入参数说明

参数名 类型 必选 默认值 描述 示例
marketcode str 交易所代码(如 212001-上交所) 212001
startdate str 基准日期,格式 YYYY-MM-DD 2026-04-18
offset str 偏移量,前推为负数(如 "-5"),后推为正数(如 "5") -5
period str "D" 时间周期:D-日, W-周, M-月, Q-季, S-半年, Y-年 D
date_type str "0" 日期类型:"0"-交易日, "1"-日历日 0
date_format str "0" 返回日期格式:"0"-YYYY-MM-DD, "1"-YYYY/MM/DD, "2"-YYYYMMDD 0
output str "singledate" "singledate"-返回单个日期, "sequencedate"-返回所有日期序列 singledate

返回数据说明

返回 JSON 数组,格式为 [{code, data: [{indicator, description, value}]}]

字段名 类型 描述
code str 标准股票代码
data array[object] 指标数组,每项含 indicator、description、value

完整指标列表(共 25 项)

分类 indicator description
基础信息 stock_short_name_stock 股票简称
en_short_name_stock 英文简称
phonetic_short_name_stock 简称首拼
sec_name_used_before_stock 证券曾用名
stock_code_stock 股票代码
关联市场 corp_hshare_short_name_stock 同公司H股简称
corp_hshare_code_stock 同公司H股代码
us_ticker_stock 同公司美股简称
us_stock_code_stock 同公司美股代码
上市信息 stock_varieties_stock 股票种类(如A股)
ipo_date_stock 首发上市日期
backdoor_listing_date_stock 借壳上市日期
listing_exchange_stock 上市交易所
listedsector_stock 上市板块
trade_currency_stock 交易币种
概念分类 the_concept_stock 所属概念
corp_cb_stock 同公司可转债简称
状态标识 listed_status_stock 上市状态
is_risk_warning_board_stock 是否属于风险警示板
is_important_index_constituent_stock 是否属于重要指数成分
index_weight_stock 所属指数权重
is_mt_ss_underlying_stock 是否融资融券标的
is_shhk_buy_underlying_stock 是否沪港通买入标的

(其余指标:is_szhk_buy_underlying_stock 是否深港通买入标的、is_subnew_stock_stock 是否为次新股)