Open Positions

This subscription feed publishes the open positions of the user account.

Authentication is required.

Feed

Event Type

API Keys Original & Signed Challenge
open_positions
subscribe / unsubscribe
Any Yes
Sample Sent Message
{  
    "event":"subscribe",
    "feed":"open_positions",
    "api_key":"CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge":"226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge":"RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+
Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="

}

 

Sample Return if Successful. 

{  
    "event":"subscribed",
    "feed":"open_positions",
    "api_key":"CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge":"226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge":"RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+
Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="

} 

Field

Type Description
event
string The result, subscribed or subscribed_failed or
unsubscribed or unsubscribed_failed
feed string The requested subscription feed
api_key string The user api key
original_challege string The message that is received from a challenge request
signed_challege string The signed challenge message with user api secret

 

Sample Subscription Data
{  
    "feed":"open_positions",
    "account":"DemoUser",
    "positions":[  
        {  
            "instrument":"fi_xbtusd_180316",
            "balance":2000.0,
            "entry_price":11675.86541981,
            "mark_price":11090.0,
            "index_price":12290.550000000001,
            "pnl":-0.00905299
        } ,
    ]
}

Field

Type Description
feed string The subscribed feed
account string The user account
positions list of structures A list containing the user open positions
instrument string The instrument (referred also as symbol or product_id) of the position
balance float The size of the position
entry_price positive float The average entry price of the instrument
mark_price positive float The market price of the position instrument
index_price positive float The index price of the position instrument
pnl float The profit and loss of the position
liquidation_threshold float The mark price of the contract at which the position will be liquidated.
return_on_equity float The percentage gain or loss relative to the initial margin used in the position. Formula: PnL/IM
effective_leverage float How leveraged the net position is in a given margin account. Formula: Position Value at Market / Portfolio Value.

 

Sample Return if Unsuccessful 
{  
    "event":"error",
    "message":"Invalid product id"
}

Field

Type Description
event string Always error
message string

An error message out of:

  • Invalid product id
  • Invalid feed
  • Json Error