跳到主要內容

获取基金持仓

该接口用于获取包括账户、基金代码、持有份额、成本净值、当前净值、币种在内的基金持仓信息。

SDK Links

Python
longport.openapi.TradeContext.fund_positions
Rust
longport::trade::TradeContext#fund_positions
Go
TradeContext.FundPositions
Node.js
TradeContext#fundPositions

Request

HTTP MethodGET
HTTP URL/v1/asset/fund

Parameters

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

NameTypeRequiredDescription
symbolstring[]NO基金代码,使用 ISIN 格式,例如:HK0000676327 ISIN 解释

Request Example

# 获取基金持仓
# https://open.longportapp.com/docs/trade/asset/fund
from longport.openapi import TradeContext, Config

config = Config.from_env()
ctx = TradeContext(config)
resp = ctx.fund_positions()
print(resp)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0,
"data": {
"list": [
{
"account_channel": "lb",
"fund_info": [
{
"symbol": "HK0000447943",
"symbol_name": "高腾亚洲收益基金",
"currency": "USD",
"holding_units": "5.000",
"current_net_asset_value": "0",
"cost_net_asset_value": "0.00",
"net_asset_value_day": "1649865600"
}
]
}
]
}
}

Response Status

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

Schemas

fund_rsp

NameTypeRequiredDescription
listobject[]false股票持仓信息
∟ account_channelstringtrue账户类型
∟ fund_infoobject[]false基金详情
∟∟ symbolstringtrue基金 ISIN 代码
∟∟ current_net_asset_valuestringtrue当前净值
∟∟ net_asset_value_daystringtrue当前净值时间
∟∟ symbol_namestringtrue基金名称
∟∟ currencystringtrue币种
∟∟ cost_net_asset_valuestringtrue成本净值