Register Account

Positions positions

Request and subscribe to position updates from your connected exchange accounts.

Request

Request active and recent positions.

Send

message array ["request", "positions", requestId?]
instruction string = "request"
Specify that message is a request for data.
topic string = "positions"
The positions topic.
requestId string
(Optional) Any string to correlate the response.

Example:

socket.send('["request", "positions"]');

Receive

The response will take the form:

message array [topic, data]
topic string
The positions topic.
positions array [position, ...]
An array of positions.
position object
The position data with fields below.

Where no requestId is sent, a separate message will be received on the positions channel for each connected exchange. This matches the behavior of the initial snapshot messages after subscription, described below.

Where requestId is sent, a single message will be received with position from all exchanges once they have all responded.

See Message Structure for the format of responses to requests made with a requestId.

Subscribe

Subscribe to position updates.

Send

message array ["subscribe", "positions"]
instruction string = "subscribe"
Specify that message is an instruction to begin streaming data.
topic string
The positions topic.

Example:

socket.send('["subscribe", "positions"]');

Receive

Subscription updates are identical to the response above. When first subscribing, the server will also respond with open positions snapshots from each connected exchange. These will have their property snapshot set to true, which can be used to distinguish from live position updates.

Fields

FieldTypeValuesFXCMOANDABitMEXBinanceBitfinex
brokerstringFXCM
OANDA
BitMEX
Binance [1]
Bitfinex
idstring
accountNostring
sessionIdstring
instrumentIdstring
symbolstring
quantitynumber
directionstringLONG
SHORT
statusstringOPEN
CLOSED
profitnumber
openTimestring
openPricenumber
valuenumber
currencystring
dealtCurrencystring
quoteCurrencystring
feenumber
initialMarginnumber
maintenanceMarginnumber
riskLimitnumber
leveragenumber
crossMarginnumber
currentCostnumber
markPricenumber
quoteValuenumber
liquidationPricenumber
bankruptPricenumber
brokerCommissionnumber
usedMarginnumber
interestnumber
detailnumber
closeTimestring
closePricenumber
snapshotboolean

Notes

[1] Binance does not implement positions.

Was this page useful? If you find any errors or have any questions please get in touch at support@cloud9trader.com.