账户持仓
接口说明
功能说明:根据账户id分页查询账户持仓列表。
适用对象:通过OpenApi开发平台对接webull的客户。
请求URL:/account/positions
请求方式:GET
频次限制:每个AppId调用频次限制为2秒2次。
请求参数
参数 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
account_id | String | 是 | 账户id | 20150320010101001 |
page_size | int | 否 | 每页条数。默认值:10;最大值:100,可填整数。 | 10 |
last_instrument_id | String | 否 | 上一页最后一个的标的id,不传默认查第一页 | 202202180001 |
响应参数
参数 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
has_next | Boolean | true | 是否还有下一页 | true |
holdings | [ ]Holding | 否 | 持仓列表 |
Holding:
参数 | 类型 | 描述 | 示例值 |
---|---|---|---|
instrument_id | String | 标的id | 913252773 |
symbol | String | 标的代码 | 00001 |
instrument_type | String | 标的类型:STOCK股票 | STOCK |
short_name | String | 股票简称,取英文 | CKH HOLDINGS |
currency | String | 持仓币种 | HKD |
unit_cost | String | 持仓成本价 | 9.5460000000 |
qty | String | 标的数量,股数 | 11000 |
total_cost | String | 持仓总成本 | 105006.00000000000000000000 |
last_price | String | 市价 | 52.250 |
market_value | String | 市值 | 574750.0000000000000 |
unrealized_profit_loss | String | 浮动盈亏 | 469744.00000000000000000000 |
unrealized_profit_loss_rate | String | 浮动盈亏率 | 4.4735 |
holding_proportion | String | 持仓占比 | 0.9854 |
请求示例
- Python
- Java
from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region
api_client = ApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(api_client)
response = api.account.get_account_position(account_id)
if response.status_code == 200:
account_position = response.json()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.hk.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
AccountPositions accountPositions = apiService.getAccountPositions(accountId, pageSize, lastInstrumentId);
响应示例
{
"has_next":
false
"holdings":[
0:{
"instrument_id":
"913252773"
"symbol":
"00001"
"instrument_type":
"STOCK"
"short_name":
"CKH HOLDINGS"
"qty":
"11000.0"
"unit_cost":
"9.5460000000"
"currency":
"HKD"
"total_cost":
"105006.00000000000000000000"
"last_price":
"52.250"
"market_value":
"574750.0000000000000"
"unrealized_profit_loss":
"469744.00000000000000000000"
"unrealized_profit_loss_rate":
"4.4735"
"holding_proportion":
"0.9854"
1:{
"instrument_id":
"950146898"
"symbol":
"09988"
"instrument_type":
"STOCK"
"short_name":
"BABA-SW"
"qty":
"100.0"
"unit_cost":
"100.0000000000"
"currency":
"HKD"
"total_cost":
"10000.00000000000000000000"
"last_price":
"85.250"
"market_value":
"8525.0000000000000"
"unrealized_profit_loss":
"-1475.00000000000000000000"
"unrealized_profit_loss_rate":
"-0.1475"
"holding_proportion":
"0.0146"
异常示例
{
"error_code":
"INVALID_TOKEN"
"message":
"401 UNAUTHORIZED "app_id and account_id not related""