Positions


GET positions

Description

Get all position information accessible to the requester.

Resource URL

https://api.optionscity.com/positions
Authentication Required
HTTP Methods GET
Media Types application/json
Response Object Position
Response Type Standard

Parameters

NameDescriptionRequired?Type
acct_id The account for which to fetch positions. If not provided, position information across all accounts to which the authenticated user has access will be provided. No Number
instrument_id Filter results to only include positions on the specified instrument ID. No Number
product_id Filter results to only include positions on instruments with the specified product ID. No Number
product_group_id Filter results to only include positions on instruments with the specified product group ID. No Number
embed_instrument Whether instrument, product and product group details should be embedded in each position definition. No Boolean
date Get positions as of the specified date. If not provided, the current position is assumed. No LocalDate*

Example Request

GET https://api.optionscity.com/positions

Example Response

[ {
  "instrument_id" : 1,
  "acct_id" : 1,
  "quantity" : 5,
  "trade_prices" : [ {
    "price" : 10,
    "quantity" : 7
  }, {
    "price" : 11,
    "quantity" : -2
  } ]
} ]

POST refpositions

Description

Post a complete reference position snapshot for an account. The current position will be determined by the most recent reference position added, accounting for any transactions that have occurred since.

Resource URL

https://api.optionscity.com/refpositions
Authentication Required
HTTP Methods POST
Media Types application/json
Response Object None
Response Type Standard
Request Object RefPosition

Example Request

POST https://api.optionscity.com/refpositions
{
  "position" : [ {
    "instrument_id" : 1,
    "quantity" : 5,
    "price" : 4.5
  }, {
    "instrument_id" : 1,
    "quantity" : -2,
    "price" : 4.75
  } ],
  "acct_id" : 1,
  "as_of" : "2018-08-21"
}

Position Object

Description

The current position information for a single instrument/account pair. Used when reporting positions in an API query (as opposed to setting a reference position with the API).

Fields

Field Type Optional Description
instrument_id Number No The City API assigned instrument ID.
acct_id Number No The City API assigned trading account ID.
quantity Number No The position volume. A negative number indicates a net short position.
trade_prices ObjectArray No A breakdown of the quantity-price pairs traded to reach this net position.

JSON Sample

{
  "instrument_id" : 1,
  "acct_id" : 1,
  "quantity" : 5,
  "trade_prices" : [ {
    "price" : 10,
    "quantity" : 7
  }, {
    "price" : 11,
    "quantity" : -2
  } ]
}

RefPosition Object

Description

A complete reference position for an account. This is a snapshot accurate at the end of trading for the specified date. More recent transactions are applied to this position to determine the current position.

Fields

Field Type Optional Description
position ObjectArray No An array of all position reference components.
acct_id Number No The City API assigned account ID.
as_of LocalDate* No The trading date following which this position is accurate.

JSON Sample

{
  "position" : [ {
    "instrument_id" : 1,
    "quantity" : 5,
    "price" : 4.5
  }, {
    "instrument_id" : 1,
    "quantity" : -2,
    "price" : 4.75
  } ],
  "acct_id" : 1,
  "as_of" : "2018-08-21"
}

RefPositionComp Object

Description

A component of a reference position (the quantity held for a single instrument and price). Used when inputing a new reference position from an external source.

Fields

Field Type Optional Description
instrument_id Number No The City API assigned instrument ID.
quantity Number No The position volume. A negative number indicates a net short position.
price Number No The price at which this component of the position was acquired (reference positions are broken down by price).

JSON Sample

{
  "instrument_id" : 1,
  "quantity" : 5,
  "price" : 4.5
}

* Date and time elements are ISO-8601 string representations