Account Position Details
Interface Description
Function description: Query the position detail list according to the account ID and ticker ID page, the position_details.contract_id in the returned data can be used for closing positions, corresponding to close_detracts.contract_id.
Applicable objects: Customers who connect to Webull through the OpenApi development platform.
Request URL:
/openapi/account/position/details
Request method: GET
Frequency limit: The calling frequency of each AppId is limited to 10 times per second.
parameters
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
account_id | String | Yes | Account ID | 863417315629211648 |
instrument_id | String | Yes | Ticker ID,[instrument_id] from /account/positions | 123456 |
size | int | No | Number of entries per page: default value is 20, and the maximum value is 100 with integers being filled. | 20 |
last_instrument_id | String | No | The last position id of the previous page, if not passed, the first page is checked by default | 123456 |
Request example
- Python
- Java
from webullsdkcore.client import ApiClient
from webullsdktrade.api import API
api_client = ApiClient(your_app_key, your_app_secret, Region.JP.value)
api = API(api_client)
res = api.account_v2.get_account_position_details(account_id, size, ticker_id, last_instrument_id)
if res.status_code == 200:
account_position = res.json()
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.jp.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
OAuthCommonPositionContractVO positions = apiService.getCommonPositionDetail(accountId, tickerId, startId, size);
Response
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
last_instrument_id | String | Yes | next page query id,if has next page | "fqweqwq" |
position_details | [ ]OAuthCommonPositionDetailVO | No | Contract list of this ticker |
OAuthCommonPositionDetailVO:
Parameter | Type | Description | Example value |
---|---|---|---|
id | String | Unique identifier for the account position | 123456 |
symbol | String | Ticker symbol | AAPL |
account_id | String | Account ID | sdfwedw3412 |
currency | String | Currency | USD |
account_tax_type | String | Account tax type refers to the dictionary value AccountTaxType. For cash account only. | SPECIFIC |
ticker_id | String | Ticker ID | 913256135 |
contract_id | String | Contract id, can be used for closing positions, corresponding to close_detracts.contract_id | wdgfwew234123 |
hold_type | String | Position side,long or short | long |
margin_type | String | ONE_DAY/INDEFINITE | INDEFINITE |
qty | int | Number of this contract shares | 20 |
average_price | Bigdecimal | Average buy price of this contract | 176.84 |
unrealized_pl | Bigdecimal | Floating profit and loss | 1530.80 |