Use Query Pending Positions to retrieve your current positions taking into account your pending orders (ie. buying power) This will not result in continuous position updates (like querypos).
Query Pending Positions
Request
Key | Value | Required | Required |
---|---|---|---|
type | string | querypendingpos | Yes |
security | string | The specific asset or currency. If not supplied, the response will contain pending positions for all securities | No |
userid | string | Query this specific userid's positions. Note: you must be either be user_type of Firm (F) or (S) global admin. O (Operators) can not see positions other than their own pending positions. | No |
Response
Key | Type | Value |
---|---|---|
type | string | querypendingpos |
result | string | "OK" if successful. If not successful, this field will contain the "no position" or "no actual position" |
curpos | string | The current position for the associated security |
security | string | The associated security |
userid | string | The associated userid |
total_rec | number | The number of records contained with the data array |
data | array | The array of securities and the associated position for each |
data.managedpos | string | This is the withheld balance, the amount withheld in open orders. |
data.openpos | string | This field can be ignored and will always be zero (0). |
data.security | string | The associated security |
data.curpos | string | The current position for the associated security (including the value in managedpos). |
data.rec_no | number | The record index |
data.type | string | position |
# Request
{
"type":"querypendingpos"
}
# Response
{
'data': [{'curpos': '2000002168.9072175',
'managedpos': '49',
'openpos': '0',
'rec_no': 1,
'security': 'BTC',
'type': 'position'},
{'curpos': '2000000000',
'managedpos': '0',
'openpos': '0',
'rec_no': 2,
'security': 'USDC',
'type': 'position'},
{'curpos': '1914573360.15',
'managedpos': '2414512.8',
'openpos': '0',
'rec_no': 3,
'security': 'USD',
'type': 'position'},
{'curpos': '4000002577.501926',
'managedpos': '47.40852377',
'openpos': '0',
'rec_no': 4,
'security': 'ETH',
'type': 'position'},
{'curpos': '2000001513.3332746',
'managedpos': '49.55409953',
'openpos': '0',
'rec_no': 5,
'security': 'LTC',
'type': 'position'}],
'result': 'OK',
'total_rec': 5,
'type': 'querypendingpos'
}
# No positions
{
'result': 'no such position',
'security': 'BTC',
'total_rec': 0,
'type': 'querypendingpos'
}