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).