跳到主要內容

获取资金流水

该接口用于获取资金流入/流出方向、资金类别、资金金额、发生时间、关联股票代码和资金流水说明信息

Request

HTTP MethodGET
HTTP URL/v1/asset/cashflow

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
start_timestringYES开始时间,时间戳,以 为单位,例如:1650037563
end_timestringYES结束时间,时间戳,以 为单位,例如:1650747581
business_typestringNO资金类型

可选值:
1 - 现金
2 - 股票
3 - 基金
symbolstringNO标的代码,例如:AAPL.US
pagestringNO起始页

默认值: 1
数据校验规则:
取值范围: >=1
sizestringNO每页大小

默认值: 50
数据校验规则: 1~10000

Request Example

# 获取资金流水
# https://open.longportapp.com/docs/trade/asset/cashflow
from datetime import datetime
from longport.openapi import TradeContext, Config

config = Config.from_env()
ctx = TradeContext(config)
resp = ctx.cash_flow(
start_at = datetime(2022, 5, 9),
end_at = datetime(2022, 5, 12),
)
print(resp)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0,
"data": {
"list": [
{
"transaction_flow_name": "股票买入成交",
"direction": 1,
"balance": "-248.60",
"currency": "USD",
"business_time": "1621507957",
"symbol": "AAPL.US",
"description": "AAPL"
},
{
"transaction_flow_name": "股票买入成交",
"direction": 1,
"balance": "-125.16",
"currency": "USD",
"business_time": "1621504824",
"symbol": "AAPL.US",
"description": "AAPL"
}
]
}
}

Response Status

StatusDescriptionSchema
200返回成功cashflow_rsp
400内部错误None

Schemas

cashflow_rsp

NameTypeRequiredDescription
listobject[]false流水信息
∟ transaction_flow_namestringtrue流水名称
∟ directionstringtrue流出方向

可选值:
1 - 流出
2 - 流入
∟ business_typestringtrue资金类别

可选值:
1 - 现金
2 - 股票
3 - 基金
∟ balancestringtrue资金金额
∟ currencystringtrue资金币种
∟ business_timestringtrue业务时间
∟ symbolstringfalse关联股票代码信息
∟ descriptionstringfalse资金流水说明