![](https://img-blog.csdnimg.cn/direct/0bb87da56e6745fbbb8833232918575e.jpeg)
1. 历史现金流量表(年度)
# Restful API
https://tsanghi.com/api/fin/stock/{exchange_code}/cash/flow/yearly?token={token}&ticker={ticker}
指定交易所和股票代码,获取该只股票的现金流量表(年度)。默认返回全部历史数据,也可以使用参数start_date和end_date选择特定时间段。此接口可方便地获取全球股票的历史数据,可用于数据初始化。交易所详见交易所清单接口,股票代码详见股票清单接口。
更新周期:每周。
请求方式:GET。
# 示例:测试JSON
https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly?token=demo&ticker=600519&order=2
# 示例:测试CSV
https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly?token=demo&ticker=600519&order=2&fmt=csv
注:测试返回不超过10条数据(2年历史)
Request请求参数
参数名称 | 参数类型 | 参数选项 | 参数说明 |
token | 字符串 | 必选 | API Token。登录后获取。 |
exchange_code | 字符串 | 必选 | 交易所代码。详见交易所清单接口。 例如:XSHG(上交所)、XSHE(深交所)、XNAS(纳斯达克)。 |
ticker | 字符串 | 必选 | 股票代码。详见股票清单接口。 例如:600519(贵州茅台)、AAPL(苹果)。 |
start_date | 字符串 | 可选 | 起始日期(报告期)。格式“yyyy-mm-dd”,默认:最早日期。 |
end_date | 字符串 | 可选 | 终止日期(报告期)。格式“yyyy-mm-dd”,默认:最新日期。 |
fmt | 字符串 | 可选 | 输出格式。支持json和csv两种标准输出格式,默认:json。 |
columns | 字符串 | 可选 | 输出字段。支持自定义输出,多个字段以半角逗号分隔,默认:所有字段。 |
order | 整数 | 可选 | 按日期排序。0:不排序,1:升序,2:降序,默认:0。 |
Response响应参数
参数名称 | 参数类型 | 参数说明 |
ticker | 字符串 | 股票代码 |
report_date | 日期 | 报告期。格式“yyyy-mm-dd”。 |
currency_code | 字符串 | 币种代码。详见币种接口。 |
net_cash_flow_operating | 小数 | 经营活动产生的现金流量净额 |
net_cash_flow_invest | 小数 | 投资活动产生的现金流量净额 |
net_cash_flow_finance | 小数 | 筹资活动产生的现金流量净额 |
cash_equivalent_increase | 小数 | 现金及现金等价物净增加额 |
cash_equivalents_begin_period | 小数 | 期初现金及现金等价物余额 |
cash_equivalents_end_period | 小数 | 期末现金及现金等价物余额 |
Python示例
import requests
url = f"https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly?token=demo&ticker=600519"
data = requests.get(url).json()
print(data)
Response示例
{
"msg": "操作成功",
"code": 200,
"data": [
{
"ticker": "600519",
"report_date": "2022-12-31",
"currency_code": "CNY",
"net_cash_flow_operating": 36698595828,
"net_cash_flow_invest": -5536826334,
"net_cash_flow_finance": -57424528979,
"cash_equivalent_increase": -26261848396,
"cash_equivalents_begin_period": 178640587379.52,
"cash_equivalents_end_period": 152378738982.83
}
]
}
2. 增量现金流量表(年度)
# Restful API
https://tsanghi.com/api/fin/stock/{exchange_code}/cash/flow/yearly/latest?token={token}
指定交易所和日期(报告期),获取全部股票的现金流量表(年度)。不指定日期时,默认返回最新数据。此接口可方便地获取增量数据。
更新周期:每周。
请求方式:GET。
# 示例:测试JSON
https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly/latest?token=demo
# 示例:测试CSV
https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly/latest?token=demo&fmt=csv
注:测试返回不超过10条数据(2年历史)
Request请求参数
参数名称 | 参数类型 | 参数选项 | 参数说明 |
token | 字符串 | 必选 | API Token。登录后获取。 |
exchange_code | 字符串 | 必选 | 交易所代码。详见交易所接口。 例如:XSHG(上交所)、XSHE(深交所)、XNAS(纳斯达克)。 |
report_date | 日期 | 可选 | 报告期。格式“yyyy-mm-dd”,默认:最新日期。 |
fmt | 字符串 | 可选 | 输出格式。支持json和csv两种标准输出格式,默认:json。 |
columns | 字符串 | 可选 | 输出字段。支持自定义输出,多个字段以半角逗号分隔,默认:所有字段。 |
Response响应参数
参数名称 | 参数类型 | 参数说明 |
ticker | 字符串 | 股票代码 |
report_date | 日期 | 报告期。格式“yyyy-mm-dd”。 |
currency_code | 字符串 | 币种代码。详见币种接口。 |
net_cash_flow_operating | 小数 | 经营活动产生的现金流量净额 |
net_cash_flow_invest | 小数 | 投资活动产生的现金流量净额 |
net_cash_flow_finance | 小数 | 筹资活动产生的现金流量净额 |
cash_equivalent_increase | 小数 | 现金及现金等价物净增加额 |
cash_equivalents_begin_period | 小数 | 期初现金及现金等价物余额 |
cash_equivalents_end_period | 小数 | 期末现金及现金等价物余额 |
Python示例
import requests
url = f"https://tsanghi.com/api/fin/stock/XSHG/cash/flow/yearly/latest?token=demo"
data = requests.get(url).json()
print(data)
Response示例
{
"msg": "操作成功",
"code": 200,
"data": [
{
"ticker": "600196",
"report_date": "2022-12-31",
"currency_code": "CNY",
"net_cash_flow_operating": 4217570888,
"net_cash_flow_invest": -4064038163,
"net_cash_flow_finance": 4428474735,
"cash_equivalent_increase": 4710349923,
"cash_equivalents_begin_period": 6459717065.1,
"cash_equivalents_end_period": 11170066988.55
},
{
"ticker": "600320",
"report_date": "2022-12-31",
"currency_code": "CNY",
"net_cash_flow_operating": 2568564023,
"net_cash_flow_invest": -83719029,
"net_cash_flow_finance": -4723159537,
"cash_equivalent_increase": -2074736440,
"cash_equivalents_begin_period": 4449837877,
"cash_equivalents_end_period": 2375101437
}
]
}
更多详情:tsanghi.com