Transactions


GET transactions

Description

Get recent history of transactions, sorted descending by ID (corresponds to processing by City API, not necessarily execution order).

Resource URL

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

Parameters

NameDescriptionRequired?Type
instrument_id Filters results to only include transactions on the specified instrument. No Number
product_id Filters results to only include transactions on instruments with the specified product. No Number
product_group_id Filters results to only include transactions on instruments with the specified product group. No Number
order_id Filters results to only include transactions for the given order_id. No Number
session_start_date Get all transactions happening on or after this exchange-local date. No LocalDate*
session_end_date Get all transactions happening before this exchange-local date. No LocalDate*
acct_id Return transactions for this account only. Default is all accounts accessible by user making request. No Number
org_id Return transactions for this organization only. Default is all organizations accessible by user making request. No Number
user_id Return transactions for this user only. Default is all users accessible by user making request. No Number
internal_origin Filter results by transaction origin. No Boolean
confirmed Filter results by transaction confirmation status. No Boolean
page 1-based page number of results to return. Default is 1. No Number
per_page Number of transactions to include in a page. Default is 30, maximum is 100. No Number

Example Request

GET https://api.optionscity.com/transactions?acct_id=1

Example Response

[ {
  "id" : 1,
  "acct_id" : 1,
  "instrument_id" : 1,
  "order_id" : "1",
  "transaction_type" : "Trade",
  "quantity" : 10,
  "session_end_date" : "2019-09-23",
  "price" : 50,
  "internal_origin" : true,
  "confirmed" : true,
  "commission" : 0,
  "exchange_fee" : 0
} ]

GET transactions/:id

Description

Get a single transactions by ID.

Resource URL

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

Parameters

NameDescriptionRequired?Type
id The transaction's City API assigned ID. Yes Number

Example Request

GET https://api.optionscity.com/transactions/1

Example Response

{
  "id" : 1,
  "acct_id" : 1,
  "instrument_id" : 1,
  "order_id" : "1",
  "transaction_type" : "Trade",
  "quantity" : 10,
  "session_end_date" : "2019-09-23",
  "price" : 50,
  "internal_origin" : true,
  "confirmed" : true,
  "commission" : 0,
  "exchange_fee" : 0
}

POST transactions

Description

This resource allows for adding transactions from external systems. Note that specifying an order ID is optional to support cases where it is not known or relevant (internally, City API will assign an ID).

Resource URL

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

Example Request

POST https://api.optionscity.com/transactions
{
  "acct_id" : 1,
  "instrument_id" : 1,
  "transaction_type" : "Trade",
  "quantity" : 10,
  "session_end_date" : "2019-09-23",
  "price" : 50,
  "internal_origin" : true,
  "confirmed" : true,
  "commission" : 0,
  "exchange_fee" : 0
}

Example Response

{
  "id" : 1,
  "acct_id" : 1,
  "instrument_id" : 1,
  "order_id" : "1",
  "transaction_type" : "Trade",
  "quantity" : 10,
  "session_end_date" : "2019-09-23",
  "price" : 50,
  "internal_origin" : true,
  "confirmed" : true,
  "commission" : 0,
  "exchange_fee" : 0
}

DELETE transactions

Description

Delete an errant transaction by its ID.

Resource URL

https://api.optionscity.com/transactions/:id
Authentication Required
HTTP Methods DELETE
Media Types application/json
Response Object None
Response Type Standard

Example Request

DELETE https://api.optionscity.com/transactions/1

Transaction Object

Description

'Transaction' is loosely defined as something that changes an account's position. There are three general types of transactions: trades, assignments and expirations. A trade is the execution of an order. There is a notable oddity with trades, however: they may or may not be a group of partial fills form a single order. That is, if a limit order to buy two contracts results in two one-lot partial fills, it may be represented as a single trade transaction. The reason for this is that some data sources only offer this level of granularity. An assignment is the buying or selling of a future as the result of an option expiration. An expiration is simply an event representing the expiration of a derivative. Conceptually, a complete history of transactions can be used to determine an account's position.

Fields

Field Type Optional Subtypes Description
id Number No All The City API assigned transaction ID. Should not be provided for POST operations.
acct_id Number No All The account ID associated with the transaction.
instrument_id Number No All The City API assigned instrument ID.
order_id String No Trade A trade's initiating order ID.
transaction_type String No All 'Trade', 'Assignment' or 'Expiration'.
quantity Number No All Quantity/volume associated with the transaction.
session_end_date LocalDate* No All The exchange-local session end date during which the transaction occurred.
price Number No Trade Assignment The buy/sell price of a trade or assignment.
internal_origin Boolean No true false Whether a transaction was submitted from within the City eco system.
confirmed Boolean No true false Whether a transaction has been verified by the syncing process.
commission Number Yes All The commission amount on the trade.
exchange_fee Number Yes All The exchange fee for the trade.

JSON Sample

{
  "id" : 1,
  "acct_id" : 1,
  "instrument_id" : 1,
  "order_id" : "1",
  "transaction_type" : "Trade",
  "quantity" : 10,
  "session_end_date" : "2019-09-23",
  "price" : 50,
  "internal_origin" : true,
  "confirmed" : true,
  "commission" : 0,
  "exchange_fee" : 0
}

* Date and time elements are ISO-8601 string representations