Introduction
ActiveTick MarketFeed is a suite of easy-to-use market data services comprising of real-time and delayed data feeds, snapshot, real-time, historical and fundamental data. ActiveTick MarketFeed was created specifically for software developers, independent software vendors, and companies looking for dependable source of market data.
The MarketFeed API is organized around REST, has predictable URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Our API has a wide range of endpoints that developers can use to interact with the system, such as retrieving static data snapshots, query for historical data, and subscribing to real-time streams. The API endpoints are well-documented and easy to understand, making it simple for developers to get started and quickly integrate the API into their applications.
To ensure quick responses and high availability, our API runs on a farm of load-balanced servers. This infrastructure allows the API to handle a large number of requests and provide quick responses, even during periods of high traffic. The load balancing also ensures that if one server goes down, the others can take over, minimizing downtime and ensuring that the API is always available to developers.
All data in MarketFeed is accessible via a single address. This documentation describes each endpoint available with detailed examples.
All timestamps represented in MarketFeed API are UTC-based unless otherwise noted.
In order to access the API and its datasets, a valid active MarketFeed account is required. To sign up for one, please visit our MarketFeed Signup page.
Developer Support
ActiveTick provides development support for MarketFeed API through various channels including online web chat, phone, and email. Developers can connect with our tech support team in real-time through chat, speak with a representative by phone, or document their issues through email. Our goal is to provide developers with the support they need to successfully implement and use our API.
Please visit Contact Us for more information.
Connectivity
Developers can access MarketFeed API by connecting to it over the internet using the HTTPS protocol. This protocol ensures that all data exchanged between the developer's client and our API is encrypted using Transport Layer Security (TLS) encryption.
Our primary production API endpoint is
https://api.activetick.com
Compression
A server can require that certain requests that produce a large response, include an "Accept-Encoding"
in request. This header specifies the types of compression that the client is able to handle. This allows the server to compress the response before sending it to the client, reducing the amount of data that needs to be transferred for large responses. The two most commonly supported types of compression are "gzip" and "deflate".
When a client sends a request to a server that requires the "Accept-Encoding"
header, it must include the header and list the types of compression that it is able to handle. For example, a client that supports both "gzip" and "deflate" would include the following header in its request: "Accept-Encoding: gzip, deflate"
.
If the server chooses to compress the response using one of the methods listed in the "Accept-Encoding"
header, it will do so and include a "Content-Encoding"
header in the response to indicate the type of compression used. The client can then decompress the response before processing it.
If a client sends a request to a server that requires the "Accept-Encoding"
header, and the header is not included in the request, the server will typically return a "400 Bad Request" error.
Limits
To ensure stable and reliable service for all users, the implements reasonable rate limiting when making requests to the server. Rate limiting is a technique used to control the rate at which a user or an application can make requests to an API. This is done to ensure that all users have a positive experience when using MarketFeed API and to prevent any single user or application from overwhelming the API with too many requests, which can cause slow response times, errors, and even outages.
In most cases, a rate limit can be bypassed by using a different API call or leveraging other API features, such as using streaming API instead of polling for data. This allows developers to continue to access the data they need, while also ensuring that the API remains stable and reliable for all users.
The MarketFeed API limits the number of requests that can be made by a user or application to 200 per minute.
The request counter is reset on a rolling basis each minute, giving full 200 requests at the beginning of each minute. If a user or application exceeds the rate limit, the server will return a 429 HTTP "Too many requests" error. This error message will include the number of requests remaining and when the rate limit will reset. Developers can check the remaining requests and reset time using the response headers in the HTTP headers, which will help them to implement smart retry mechanisms in their application.
In certain situations, when too many 429 errors are generated, the originating IP or session token might be temporarily added to a ban list, blocking further requests. This is done to prevent any malicious or automated requests from overwhelming the API. However, if a user believes that they have been banned mistakenly, they can contact our support team to review the ban.
The server returns a custom X-Available-Requests-Left
header in the response to indicate the number of requests that are left in the current minute. This header can be used to track the rate limit of the API and prevent exceeding the maximum number of requests per minute. By checking this header, the client can determine how many requests they have left before they need to wait for the rate limit to reset.
Errors
MarketFeed API uses conventional HTTP response codes to communicate the success or failure of an API request to the developer. These codes are standard codes that are used across the web and are recognized by most programming languages and development environments.
In general, codes in the 2xx range indicate success, which means the request was processed successfully and the desired outcome was achieved. Codes in the 4xx range indicate an error that failed given the information provided, such as a missing required parameter, exceeding a limit, and so on. These errors are generally caused by the developer and can be resolved by fixing the request. Codes in the 5xx range indicate an error with MarketFeed servers, which is rare. These errors are usually caused by internal issues on the server side and are beyond the control of the developer.
When error codes are returned, the API includes a description of the code and the reason message for failure. This message is intended to give a user-friendly explanation of the error, so that developers can understand the error and take the appropriate action. The error codes are designed to be machine-readable codes that applications can use to better understand the context of the error and react accordingly.
Code | Code Meaning |
---|---|
400 Bad Request | The request contains errors. |
401 Unauthorized | The authentication process failed, or the access token is not valid. |
403 Forbidden | Access to this resource is restricted for the given caller. |
404 Not Found | The specified resource could not be found. |
405 Method Not Allowed | An invalid method was used to access a resource. |
406 Not Acceptable | An unsupported format was requested. |
408 Request Timed out | Request took too much time to respond and timed-out. |
409 Conflict | The requested operation on the resource cannot be made due the resource state. |
429 Too Many Requests | Exceeded maximum allowed request limit per minute. Try again next minute. |
500 Internal Server Error | There was a problem with the API host server. Try again later. |
503 Service Unavailable | API is temporarily offline for maintenance. Try again later. |
Guides
REST How-To
An example for creating a new SessionId token.
curl -X GET 'https://api.activetick.com/authorize.json?username=YOUR_LOGIN_USERNAME&password=YOUR_PASSWORD&apikey=YOUR_API_KEY' \
-H "Connection: Keep-Alive" \
-H "Accept: application/json"
HTTP/1.1 200 OK
Content-Type: application/json
Connection: Keep-Alive
Content-Length: 128
{
"type":"authorize",
"status":"ok",
"sessionid":"8e63353316d343bf9d4ce816ec67c1e7",
"created_at":"2022-01-20T12:18:04"
}
Making a REST API call is a straightforward process that can be done easily using any programming language or directly from a web browser. To make an API call, developers will need to have an active MarketFeed account with their credentials and API key. Additionally, they will need to have a valid SessionId token which is used for authentication and authorization. The SessionId token ensures that only authorized users can access the API and prevents unauthorized access to the data.
To initiate a request, developers will also need to know the endpoint URL for the dataset they wish to access and any endpoint-specific parameters that may be required. The endpoint URL is the address of the specific resource or data that the developer wants to access. The endpoint-specific parameters are used to filter or query the data, and the format of these parameters may vary depending on the endpoint.
When initiating a REST request, a sender (for example, a browser or a program) creates a standard HTTP GET request and sends it to the server. The server in turn responds with a standard HTTP response code, headers, and response payload. The HTTP response code will indicate the success or failure of the request, headers will contain additional information about the response, and the response payload will contain the actual data that was requested.
It is important to note that REST API calls are stateless, meaning that each request is self-contained and contains all the information needed for the server to understand and respond to the request. This allows for flexibility and scalability, as the server does not need to maintain a stateful connection with the client.
Multiple Requests
When making multiple API requests, it is highly recommended to reuse the same HTTP session rather than closing down the session and opening a new one for each request. This approach is more efficient and can help reduce the overall latency of the API calls.
In order to reuse the same session, developers must include a "Connection: Keep-Alive"
header in each request. This header tells the server to keep the connection open after sending the response, allowing the client to reuse the same session for subsequent requests. If the "Connection: Keep-Alive" header is omitted, the server will close the socket after sending the response, and the session cannot be reused for another request.
To reuse the same session, developers simply need to send another request after the previous response has been received. The server will use the same session and will not need to re-authenticate or establish a new connection. This approach can significantly improve the performance of the API calls, especially when making multiple requests in a short period of time.
Query Parameters
A query in the MarketFeed API typically consists of an endpoint name followed by query parameters. These parameters are used to filter or specify the data that should be returned by the API. Most MarketFeed endpoints require a few parameters to be passed inside the query in the form of name/value pairs. When multiple parameters are present in the query, they are combined into a single query string using an ampersand character (&), for example: param1=123¶m2=abc.
The MarketFeed API supports both GET and POST HTTP requests. GET requests are used when query string is small, while POST requests are used to submit query strings that are large and complex in size to the server. Depending on the endpoint and the type of data being accessed, a developer may need to use a specific type of request.
Some endpoints require a list of values inside a single parameter. For example, the snapshot endpoint accepts a list of symbols and columns to return in a dataset. In cases where a list of values is required, the MarketFeed API uses commas to separate the values. For example: symbols=A,B,C,D&columns=1,2,3,4.
It is important to note that the format of the query parameters may vary depending on the endpoint and type of requests. Developers should consult the API documentation for more information on the required parameters for each endpoint and type of requests, as well as for guidance on how to format the query string. Additionally, the API documentation also provides examples of query string for each endpoint which can be helpful to understand how to format the query string.
Data Formats
The MarketFeed API returns all response data in JSON format.
Symbology
ActiveTick MarketFeed API supports a wide range of financial instruments including stocks, indices, currencies, futures, stock options, future options, and futures spreads.
The formatting for each instrument type is made up of an instrument-specific body, followed by a 3-character code representing the type, exchange, and country of the instrument. The body and 3-character code are joined together by an underscore '_' character.
For example, the symbol for Apple Inc. stock traded on the NASDAQ exchange would be "AAPL_SQU"
, where "AAPL" is the symbol for Apple Inc., “S” represents Stock, “Q” represents NASDAQ exchange, and "U" represents United States.
Instruments that trade on multiple exchanges use a special exchange code called Consolidated Exchange.
The following tables provide codes for different types of instruments, exchanges, and countries that the MarketFeed API supports.
Instrument Types
Type Code | Description |
---|---|
'S' | Stock |
'I' | Index |
'C' | Currency |
'F' | Future |
'O' | Stock Option |
'P' | Future Option |
'D' | Future Spread |
Instrument Countries
Country Code | Description |
---|---|
'U' | United States |
'C' | Canada |
'I' | International (Used for Currencies) |
Stocks
Stock symbols are constructed from an instrument body, an instrument type code for "Stock", an exchange code, and a country code. They are the most basic form of instrument symbols in the MarketFeed API.
US-based Stock Exchanges
Exchange Code | Description |
---|---|
' ' | Consolidated Exchange |
'A' | NYSE American, LLC (NYSE American) |
'B' | NASDAQ OMX BX, Inc. (NASDAQ OMX BX) |
'C' | NYSE National, Inc. (NYSE National) |
'D' | FINRA Alternative Display Facility (ADF) |
'H' | MIAX Pearl Exchange, LLC (MIAX) |
'I' | International Securities Exchange, LLC (ISE) |
'J' | Cboe EDGA Exchange, Inc. (Cboe EDGA) |
'K' | Cboe EDGX Exchange, Inc. (Cboe EDGX) |
'L' | Long-Term Stock Exchange, Inc. (LTSE) |
'M' | NYSE Chicago, Inc. (NYSE Chicago) |
'N' | New York Stock Exchange, LLC (NYSE) |
'P' | NYSE Arca, Inc. (NYSE Arca) |
'Q' | NASDAQ Stock Market, LLC (NASDAQ) |
'T' | OTC Markets, LLC |
'U' | Members Exchange, LLC (MEMX) |
'V' | Investors’ Exchange, LLC. (IEX) |
'W' | CBOE Stock Exchange, Inc. (CBSX) |
'X' | NASDAQ OMX PSX, Inc. (NASDAQ OMX PSX) |
'Y' | Cboe BYX Exchange, Inc. (Cboe BYX) |
'Z' | Cboe BZX Exchange, Inc. (Cboe BZX) |
Some examples of stock instrument symbols:
Symbol | Description |
---|---|
AAPL_S U | This is the symbol for Apple Inc. traded on consolidated exchanges |
MSFT_SZU | This is the symbol for Microsoft Corp. traded on Cboe BZX Exchange |
Indices
Index symbols in the MarketFeed API are similar to stock symbols, with the only exception of using an instrument type code for "Index". They are constructed from an instrument body, an instrument type code for "Index", and a country code.
Additionally, all index instruments use the Consolidated Exchange code.
Some examples of index instrument symbols:
Symbol | Description |
---|---|
DJI_I U | This is the symbol for Dow Jones Industrial Index |
SPX_I U | This is the symbol for S&P 500 index |
Currencies
Currency symbols in the MarketFeed API are composed of a pair of currencies as its body, followed by an instrument type code for "Currency", a country code for "International" (used for currencies), and an exchange code for "Forex".
Currency Exchanges
Exchange Code | Description |
---|---|
'F' | Forex |
Some examples of currency instrument symbols:
Symbol | Description |
---|---|
EUR/USD_CFI | This is the symbol for the Euro/US dollar currency pair |
USD/CAD_CFI | This is the symbol for the US dollar/Canadian dollar currency pair |
Futures
Future symbols in the MarketFeed API are composed of a future group, maturity date, an instrument type code for "Future", an exchange code for the specific exchange on which the future is traded and a country code. An underscore character, ‘_’, is used as a separator between the group, maturity date, and 3-character code.
The group portion of the symbol represents an exchange-specific group, such as “ES” for CME e-Minis, “CL” for NYMEX oil, etc. The maturity portion of the symbol is represented in the format of YYMMDD. For instruments with standard maturity month, the day portion is set to “00”.
The format of future instrument symbols is as follows:
AAAA_YYMMDD_IEC
Where:
- AAAA is the underlying group,
- YYMMDD is the maturity date,
- I is the instrument code,
- E is the exchange code,
- X is the country code
For example, for the future instrument symbol "GC_220200_FXU"
AAAA = "GC" representing the underlying group YYMMDD = "220200" representing the maturity date of February 2022 I = "F" representing the Future instrument code E = "X" representing the COMEX exchange X = "U" representing the United States
US-based Futures Exchanges
Exchange Code | Description |
---|---|
'C' | CME Exchange |
'K' | KCBT Exchange |
'N' | NYMEX Exchange |
'O' | CBOT Exchange |
'X' | COMEX Exchange |
Some more examples of future instrument symbols:
Symbol | Description |
---|---|
ES_220300_FCU | This is the symbol for ESH2 CME e-Mini S&P 500 contract with March 2022 maturity |
GC_220200_FXU | This is the symbol for GCG2 COMEX Gold contract with February 2022 maturity. |
Options
Option symbols in the MarketFeed API are composed of the underlying symbol, expiration date, call/put indicator, strike price, strike price decimal code, followed by 3-character code. The format of the symbols is as follows:
AAAA_YYMMDDXNNNNNP_IEC
Where:
- AAAA is the underlying symbol, representing the symbol of the stock, index, future, or other instrument on which the option is based on.
- YYMMDD is the expiration date, in the format of year, month, and day
- X is the call/put code, representing whether the option is a call option or a put option
- NNNNN is the strike price, representing the price at which the option can be exercised
- P is the precision code, indicating how many digits are used for the decimal portion of the strike price.
- I is the instrument code, representing the type of instrument (i.e. "Option")
- E is the exchange code, representing the exchange on which the option is traded
- C is the country code, representing the country in which the option is traded
If the option is a weekly option, the DD portion of the expiration date will indicate the week number in which the option expires, from W1 through W5.
Call/Put Codes
The call/put code included in option symbols, indicates whether the option is a call option or a put option.
Code | Description |
---|---|
'C' | Call |
'P' | Put |
US-based Stock Options Exchanges
Exchange Code | Description |
---|---|
' ' | Consolidated OPRA |
US-based Future Options Exchanges
Exchange Code | Description |
---|---|
'C' | CME Exchange |
'K' | KCBT Exchange |
'N' | NYMEX Exchange |
'O' | CBOT Exchange |
'X' | COMEX Exchange |
Strike Price Precision Code
The precision code in option symbols represents the number of decimal places used in the strike price, which can range from 0 to 4. The following table shows the different codes used for precision and their corresponding decimal places:
Precision Code | Decimal Places |
---|---|
'A' | 0 decimals |
'B' | 1 decimal |
'C' | 2 decimals |
'D' | 3 decimals |
'E' | 4 decimals |
'I' | 0 decimals (negative) |
'J' | 1 decimal (negative) |
'K' | 2 decimals (negative) |
'L' | 3 decimals (negative) |
'M' | 4 decimals (negative) |
Option symbols in the MarketFeed API are composed of the underlying symbol, expiration date, call/put indicator, strike price, strike price decimal code, followed by 3-character code. Here are some examples of option instrument symbols:
Symbol | Symbol Description |
---|---|
JNJ_211022C14700C_O U | This is a symbol for a JNJ stock call option with an expiration date of October 22nd, 2021 and a strike price of 147.00. The 'C' in the symbol represents that this is a call option, and the 'O U' at the end of the symbol indicates that this option is traded on consolidated exchanges in the United States. |
MSFT_220114P31000C_O U | This is a symbol for a MSFT stock put option with an expiration date of January 14th, 2022 and a strike price of 310.00. The 'P' in the symbol represents that this is a put option, and the 'O U' at the end of the symbol indicates that this option is traded on consolidated exchanges in the United States. |
AAPL_1203W3C1234567B_O U | This is a symbol for a AAPL weekly stock call option with an expiration date of the third week of March, 2012 and a strike price of 12345.67. The 'W3' in the symbol represents that this is a weekly option and the third week of March is the expiration date. 'C' in the symbol represents that this is a call option, and the 'O U' at the end of the symbol indicates that this option is traded on consolidated exchanges in the United States. |
ES_120331C1234567A_PCU | This is a symbol for a ES e-Mini S&P 500 call option with an expiration date of March 31st, 2012 and a strike price of 12345.67. The 'C' in the symbol represents that this is a call option, the 'PCU' at the end of the symbol indicates that this option is traded on CME exchange in the United States. |
Authentication
To use the MarketFeed API, a user must first have an active SessionId token. This token is a unique string of hexadecimal characters that is required for every API call. It acts as an authentication mechanism that verifies the user's identity and grants access to the API's resources.
The token can be generated by calling the authorize endpoint with the user's login credentials and API key. The authorize endpoint is responsible for validating the user's credentials, and if successful, it returns a SessionId token that can be used to make subsequent API calls. Once generated, the token is valid for 24 hours, after which it will expire. This is done to ensure the security of the API by regularly invalidating tokens that may have been compromised.
If the token has expired, a new token must be generated through another authorize API call to continue using the API. It's important to note that if multiple calls to the authorize API are made within 24 hours of creating the initial token, the same session token information will be returned. To avoid unnecessary calls, it's recommended to only generate a new token when the previous one has expired. Additionally, each call to the authorize API will decrement the number of available API calls that can be made, so it's recommended to minimize the number of authorize calls made.
IP-based Authentication
The MarketFeed API has a security feature that stores the IP address of the device that made the initial authorize API call to create a SessionId token. For all subsequent API calls, the API compares the source IP address of the request with this stored IP address. If the source IP address does not match the stored IP address, the API will reject the request with a 401 - Unauthorized error.
This means that the API can only be accessed from the device that made the initial authorize API call.
This security feature is designed to prevent unauthorized access to the API by ensuring that only the device that has been granted access can make API calls.
Users who are unable to access the API due to this security feature should contact the MarketFeed support team to have their sessions reset.
Requesting Session Tokens
Example authorize request:
curl -i -X GET 'https://api.activetick.com/authorize.json?username=MY_USERNAME&password=MY_PASSWORD&apikey=MY_APIKEY'
$.ajax({
url: "https://api.activetick.com/authorize.json",
method: "GET",
data: {
username: "MY_USERNAME",
password: "MY_PASSWORD",
apikey: "MY_APIKEY"
},
success: function(response) {
console.log("Authorization status: " + response.status);
console.log("Session ID: " + response.sessionid);
console.log("Real-time data: " + response.is_realtime);
},
error: function(xhr, status, error) {
console.log("Error: " + error);
}
});
import requests
# Define the API endpoint
url = "https://api.activetick.com/authorize.json"
# Define the request parameters
params = {
"username": "MY_USERNAME",
"password": "MY_PASSWORD",
"apikey": "MY_APIKEY"
}
# Send the GET request
response = requests.get(url, params=params)
# Extract the JSON response
data = response.json()
# Print the output
print("Type: ", data["type"])
print("Status: ", data["status"])
print("Session ID: ", data["sessionid"])
print("Created At: ", data["created_at"])
print("Is Realtime: ", data["is_realtime"])
using System;
using System.Net;
using Newtonsoft.Json.Linq;
class Program
{
static void Main(string[] args)
{
// Get parameters from command prompt
string username = args[0];
string password = args[1];
string apikey = args[2];
// Create the request URL
string requestUrl = "https://api.activetick.com/authorize.json?username=" + username + "&password=" + password + "&apikey=" + apikey;
// Make the request
using (WebClient client = new WebClient())
{
// Get the response as a string
string response = client.DownloadString(requestUrl);
// Parse the response JSON
JObject json = JObject.Parse(response);
// Get the values from the JSON and print them to the console
Console.WriteLine("Type: " + json["type"]);
Console.WriteLine("Status: " + json["status"]);
Console.WriteLine("Session ID: " + json["sessionid"]);
Console.WriteLine("Created At: " + json["created_at"]);
Console.WriteLine("Is Realtime: " + json["is_realtime"]);
}
}
}
Example authorize response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 151
{
"type":"authorize",
"status":"ok",
"sessionid":"581a01a4c5004a8490d89ff8737faafd",
"created_at":"2023-01-27T17:38:23",
"is_realtime":"true"
}
Authorization status: ok
Session ID: 581a01a4c5004a8490d89ff8737faafd
Real-time data: true
Type: authorize
Status: ok
Session ID: 581a01a4c5004a8490d89ff8737faafd
Created At: 2023-01-27T17:38:23
Is Realtime: true
Type: authorize
Status: ok
Session ID: 581a01a4c5004a8490d89ff8737faafd
Created At: 1/27/2023 5:38:23 PM
Is Realtime: true
Authorization Request Endpoint
https://api.activetick.com/authorize.json?username=<username>&password=<password>&apikey=<apikey>
Authorization Request Parameters
Parameter | Required | Description |
---|---|---|
username | yes | ActiveTick client username |
password | yes | ActiveTick client password |
apikey | yes | Alpha-numeric API key |
Response
The following table lists the fields returned in the response of an authorize API call:
Name | Description |
---|---|
type | This field will always have the value of "authorize" |
status | Indicates the success or failure of the authorization process. The possible values are "ok" and "fail". |
sessionid | A 24-hour session token that is required for all subsequent API requests. |
created_at | The time when the initial authorization was created. |
is_realtime | Indicates if the market data is real-time. The possible values are "true" and "false". |
Core Data
The MarketFeed API uses the snapshot endpoint to return core market datasets. This includes data such as:
- Intraday pricing data, which updates throughout the day.
- Various calculated data fields, such as option greeks.
- Company information and dividends.
To access this data, the snapshot endpoint accepts a list of instrument symbols and data columns to query. This is similar to a typical SQL SELECT query, where multiple symbols and columns can be passed using a comma separator.
Requesting Snapshots
Example snapshot request:
curl -X POST https://api.activetick.com/snapshot.json \
-i -d 'sessionid=MY_SESSIONID&symbols=EUR/USD_CFI,AAPL_S-U,IBM_S-U&columns=pc,l,b,a,bsz,asz,vol,ltm'
const $ = require("jquery");
// Define session ID, symbols and columns
const sessionId = "MY_SESSIONID";
const symbols = "EUR/USD_CFI,AAPL_S-U,IBM_S-U";
const columns = "pc,l,b,a,bsz,asz,v,ltm";
// Define snapshot API endpoint URL
const url = "https://api.activetick.com/snapshot.json";
// Make a GET request to snapshot API endpoint
$.ajax({
type: "GET",
url: url,
data: {
sessionid: sessionId,
symbols: symbols,
columns: columns,
},
success: function (response) {
console.log(response);
// Iterate through response rows
response.rows.forEach(function (row) {
console.log("Symbol: " + row.symbol);
console.log(" Status: " + row.status);
// Iterate through data in each row
row.data.forEach(function (data) {
if(data.c === 'pc')
console.log("\tPrevious Close: " + data.v);
else if(data.c === 'l')
console.log("\tLast Trade Price: " + data.v);
else if(data.c === 'b')
console.log("\tBid Price: " + data.v);
else if(data.c === 'a')
console.log("\tAsk Price: " + data.v);
else if(data.c === 'bsz')
console.log("\tBid Size: " + data.v);
else if(data.c === 'asz')
console.log("\tAsk Size: " + data.v);
else if(data.c === 'v')
console.log("\tVolume: " + data.v);
else if(data.c === 'ltm')
console.log("\tLast Trade Time: " + data.v);
});
});
},
error: function (error) {
console.log(error);
},
});
import requests
# Define session ID, symbols and columns
session_id = "MY_SESSIONID"
symbols = "EUR/USD_CFI,AAPL_S-U,IBM_S-U"
columns = "pc,l,b,a,bsz,asz,v,ltm"
# Define snapshot API endpoint URL
url = "https://api.activetick.com/snapshot.json"
# Make a GET request to snapshot API endpoint
response = requests.get(url, params={'sessionid': session_id, 'symbols': symbols, 'columns': columns})
# Check if request was successful
if response.status_code == 200:
# Parse response json
data = response.json()
# Iterate through response rows
for row in data['rows']:
print(f"Symbol: {row['symbol']}")
print(f" Status: {row['status']}")
# Iterate through data in each row
for item in row['data']:
if item['c'] == "pc":
print(f"\tPrevious Close: {item['v']}")
elif item['c'] == "l":
print(f"\tLast Trade Price: {item['v']}")
elif item['c'] == "b":
print(f"\tBid Price: {item['v']}")
elif item['c'] == "a":
print(f"\tAsk Price: {item['v']}")
elif item['c'] == "bsz":
print(f"\tBid Size: {item['v']}")
elif item['c'] == "asz":
print(f"\tAsk Size: {item['v']}")
elif item['c'] == "v":
print(f"\tVolume: {item['v']}")
elif item['c'] == "ltm":
print(f"\tLast Trade Time: {item['v']}")
else:
print(f"Request failed with status code: {response.status_code}")
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Net.Http;
class Program
{
static void Main(string[] args)
{
// Define session ID, symbols and columns
string sessionId = "MY_SESSION";
string symbols = "EUR/USD_CFI,AAPL_S-U,IBM_S-U";
string columns = "pc,l,b,a,bsz,asz,v,ltm";
// Define snapshot API endpoint URL
string url = "https://api.activetick.com/snapshot.json";
// Make a GET request to snapshot API endpoint
HttpClient client = new HttpClient();
var queryString = "sessionid=" + sessionId + "&symbols=" + symbols + "&columns=" + columns;
var response = client.GetAsync(url + "?" + queryString).Result;
if (response.IsSuccessStatusCode)
{
var json = response.Content.ReadAsStringAsync().Result;
JObject o = JObject.Parse(json);
// Iterate through response rows
foreach (var row in o["rows"])
{
Console.WriteLine("Symbol: " + row["symbol"]);
Console.WriteLine(" Status: " + row["status"]);
// Iterate through data in each row
foreach (var data in row["data"])
{
string columnName = (string)data["c"];
if (columnName == "pc")
Console.WriteLine("\tPrevious Close: " + data["v"]);
else if (columnName == "l")
Console.WriteLine("\tLast Trade Price: " + data["v"]);
else if (columnName == "b")
Console.WriteLine("\tBid Price: " + data["v"]);
else if (columnName == "a")
Console.WriteLine("\tAsk Price: " + data["v"]);
else if (columnName == "bsz")
Console.WriteLine("\tBid Size: " + data["v"]);
else if (columnName == "asz")
Console.WriteLine("\tAsk Size: " + data["v"]);
else if (columnName == "vol")
Console.WriteLine("\tVolume: " + data["v"]);
else if (columnName == "ltm")
Console.WriteLine("\tLast Trade Time: " + data["v"]);
}
}
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
}
}
}
Example snapshot response:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 199
Content-Length: 1051
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"EUR/USD_CFI","status":"ok",
"data":[
{"c":"pc","s":"ok","v":"1.08953"},
{"c":"l","s":"ok","v":"1.08681"},
{"c":"b","s":"ok","v":"1.08674"},
{"c":"a","s":"ok","v":"1.08687"},
{"c":"bsz","s":"ok","v":"0"},
{"c":"asz","s":"ok","v":"0"},
{"c":"ltm","s":"ok","v":"2023-01-27T21:44:56.960000000"}
]
},
{"symbol":"AAPL_S U","status":"ok",
"data":[
{"c":"pc","s":"ok","v":"143.96"},
{"c":"l","s":"ok","v":"145.93"},
{"c":"b","s":"ok","v":"145.96"},
{"c":"a","s":"ok","v":"145.98"},
{"c":"bsz","s":"ok","v":"5"},
{"c":"asz","s":"ok","v":"1"},
{"c":"ltm","s":"ok","v":"2023-01-27T21:44:56.737464530"}
]
},
{"symbol":"IBM_S U","status":"ok",
"data":[
{"c":"pc","s":"ok","v":"134.45"},
{"c":"l","s":"ok","v":"134.39"},
{"c":"b","s":"ok","v":"134.35"},
{"c":"a","s":"ok","v":"134.50"},
{"c":"bsz","s":"ok","v":"1"},
{"c":"asz","s":"ok","v":"10"},
{"c":"ltm","s":"ok","v":"2023-01-27T21:42:47.949069568"}
]
}
]
}
Symbol: EUR/USD_CFI
Status: ok
Previous Close: 1.08953
Last Trade Price: 1.08685
Bid Price: 1.08664
Ask Price: 1.08705
Bid Size: 0
Ask Size: 0
Volume: 0
Last Trade Time: 2023-01-27T21:59:59.057000000
Symbol: AAPL_S U
Status: ok
Previous Close: 143.96
Last Trade Price: 145.93
Bid Price: 145.85
Ask Price: 145.90
Bid Size: 13
Ask Size: 4
Volume: 70560507
Last Trade Time: 2023-01-27T23:28:05.743251151
Symbol: IBM_S U
Status: ok
Previous Close: 134.45
Last Trade Price: 134.39
Bid Price: 134.40
Ask Price: 134.50
Bid Size: 7
Ask Size: 1
Volume: 8142373
Last Trade Time: 2023-01-27T23:25:05.287452672
Symbol: EUR/USD_CFI
Status: ok
Previous Close: 1.08953
Last Trade Price: 1.08685
Bid Price: 1.08664
Ask Price: 1.08705
Bid Size: 0
Ask Size: 0
Volume: 0
Last Trade Time: 2023-01-27T21:59:59.057000000
Symbol: AAPL_S U
Status: ok
Previous Close: 143.96
Last Trade Price: 145.93
Bid Price: 145.85
Ask Price: 145.89
Bid Size: 13
Ask Size: 1
Volume: 70562197
Last Trade Time: 2023-01-27T23:33:26.099760059
Symbol: IBM_S U
Status: ok
Previous Close: 134.45
Last Trade Price: 134.39
Bid Price: 134.40
Ask Price: 134.50
Bid Size: 7
Ask Size: 1
Volume: 8142373
Last Trade Time: 2023-01-27T23:30:00.004172032
Symbol: EUR/USD_CFI
Status: ok
Previous Close: 1.08953
Last Trade Price: 1.08685
Bid Price: 1.08664
Ask Price: 1.08705
Bid Size: 0
Ask Size: 0
Last Trade Time: 1/27/2023 9:59:59 PM
Symbol: AAPL_S U
Status: ok
Previous Close: 143.96
Last Trade Price: 145.93
Bid Price: 145.85
Ask Price: 145.89
Bid Size: 3
Ask Size: 2
Last Trade Time: 1/27/2023 11:58:24 PM
Symbol: IBM_S U
Status: ok
Previous Close: 134.45
Last Trade Price: 134.39
Bid Price: 134.41
Ask Price: 134.50
Bid Size: 1
Ask Size: 2
Last Trade Time: 1/27/2023 11:51:05 PM
Snapshot Request
The Snapshot Request is a type of request in the API that allows users to request a snapshot of data for a specific set of instrument symbols and data columns. The request is made by sending a GET or POST request to the endpoint https://api.activetick.com/snapshot.json
and including the required parameters in the query string. These parameters include a valid sessionid, which is obtained through a prior authorization request, a list of symbols, and a list of data columns.
The Snapshot Response is a collection of data for each requested instrument symbol. The response includes information about the response itself, as well as an array of rows, with one row for each requested symbol. The rows contain information about the symbol, such as the symbol itself, and the data for each requested column. In some cases, a row may not contain data because the symbol may be invalid, the user may not have access to the specific exchange, or the maximum amount of rows allowed in the response has been exceeded. In such cases, the response will include information about why data for the symbol is not available.
Each row in the response will contain a list of values for each requested column. The values are contained in an array with information about the data column id, the data column status, and the data value itself.
Snapshot Request Endpoint
https://api.activetick.com/snapshot.json?sessionid=<sessionid>&symbols=<symbol1,symbol2>2&columns=<column1,column2>
Snapshot Request Parameters
Parameter | Required | Description |
---|---|---|
sessionid | yes | Valid sessionid returned from prior authorization. |
symbols | yes | List of instrument symbols separated by commas. |
columns | yes | List of data columns separated by commas. |
Snapshot Response
Name | Description |
---|---|
type | Indicates the type of response, in this case "snapshot" |
status | Indicates if the request was completed successfully. Possible values are "ok" and "fail" |
rows | An array of snapshot row items, each containing information for a specific requested instrument symbol |
Snapshot Row Item
Name | Description |
---|---|
symbol | Instrument symbol. |
status | Row status code indicating if symbol information was successfully returned. |
data | Array of snapshot data items for each requested column. |
Snapshot Data Item
Name | Description |
---|---|
c | Data column id. |
s | Data column status. Possible values are "ok" and "fail". |
v | Data value. |
Row Status Code
Row Status Code | Description |
---|---|
ok | The row contains valid returned information. |
fail | The row is invalid due to lack of proper exchange permissions for requested instrument symbol. Review your exchange subscriptions by logging into your account at activetick.com. |
max_limit_reached | Maximum limit of rows per request has been reached. Adjust how many symbols you request to the limits of your account. |
Intraday Pricing Data
Intraday pricing example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AAPL_S U","status":"ok",
"data":[
{"c":"l","s":"ok","v":"168.835"}
]
},
{"symbol":"IBM_S U","status":"ok",
"data":[
{"c":"l","s":"ok","v":"131.31"}
]
}
]
}
Another example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AAPL_S U","status":"ok",
"data":[
{"c":"b","s":"ok","v":"169.06"},
{"c":"a","s":"ok","v":"169.07"},
{"c":"bex","s":"ok","v":"88"},
{"c":"aex","s":"ok","v":"86"},
{"c":"bsz","s":"ok","v":"5"},
{"c":"asz","s":"ok","v":"5"}
]
}
]
}
Intraday pricing data contains real-time and calculated values received from exchange feeds throughout trading session.
Data Column Id | Description |
---|---|
s | Feed Source Code |
pc | Previous Close |
op | Open Price |
cl | Close Price |
l | Last Trade Price |
b | Bid Price |
a | Ask Price |
hi | High Price |
lo | Low Price |
dhi | Daily High Price (including Ext-hours session) |
dlo | Daily Low Price (including Ext-hours session) |
yhi | 52-Week High Price |
ylo | 52-Week Low Price |
pop | Pre-market Open Price |
el | Extended-hours Last Price |
ecl | Extended-hours Close Price |
bex | Bid Exchange |
aex | Ask Exchange |
lex | Last Trade Exchange |
lco | Last Trade Conditions |
qco | Quote Condition |
sbtm | Session Begin Time |
setm | Session End Time |
ltm | Last Trade Time |
qtm | Quote Time |
hitm | High Time |
lotm | Low Time |
dhitm | Daily High Time |
dlotm | Daily Low Time |
yhitm | 52-Week High Time |
ylotm | 52-Week Low Time |
lsz | Last Trade Size |
bsz | Bid Size |
asz | Ask Size |
v | Volume |
pv | Pre-market Volume |
ev | Extened-hours Volume |
tc | Trade Count |
ptc | Pre-market Trade Count |
etc | Extended-hours Trade Count |
tsum | Transactions Sum |
vwap | VWAP |
Calculated Data
Calculated data example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AA_S U","status":"ok",
"data":[
{"c":"av5","s":"ok","v":"2678463"},
{"c":"ap5","s":"ok","v":"33.11"}
]
},
{"symbol":"AXP_S U","status":"ok",
"data":[
{"c":"av5","s":"ok","v":"3153841"},
{"c":"ap5","s":"ok","v":"79.57"}
]
},
{"symbol":"BA_S U","status":"ok",
"data":[
{"c":"av5","s":"ok","v":"2085303"},
{"c":"ap5","s":"ok","v":"188.74"}
]
},
{"symbol":"CAT_S U","status":"ok",
"data":[
{"c":"av5","s":"ok","v":"3998172"},
{"c":"ap5","s":"ok","v":"104.84"}
]
},
{"symbol":"C_S U","status":"ok",
"data":[
{"c":"av5","s":"ok","v":"17418656"},
{"c":"ap5","s":"ok","v":"62.37"}
]
}
]
}
The calculated data fields include statistical information and other calculations based on the pricing and volume data, which are updated at regular intervals. These calculated data columns provide additional insights and can be used to help identify trends and patterns in the underlying data.
Data Column Id | Description |
---|---|
av5 | 5-Day Average Volume |
av10 | 10-Day Average Volume |
av20 | 20-Day Average Volume |
av50 | 50-Day Average Volume |
av100 | 100-Day Average Volume |
av200 | 200-Day Average Volume |
ap5 | 5-Day Average Price |
ap10 | 10-Day Average Price |
ap20 | 20-Day Average Price |
ap50 | 50-Day Average Price |
ap100 | 100-Day Average Price |
ap200 | 200-Day Average Price |
Option Greeks Data
Option greeks example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AAPL_220819C3000C_O U","status":"ok",
"data":[
{"c":"opoi","s":"ok","v":"30"},
{"c":"opnpv","s":"ok","v":"139.1984"},
{"c":"opdelta","s":"ok","v":"0.996796"},
{"c":"opgamma","s":"ok","v":"0.000076"},
{"c":"oprho","s":"ok","v":"0.005752"},
{"c":"opvega","s":"ok","v":"0.002893"},
{"c":"optheta","s":"ok","v":"-0.153177"},
{"c":"opiv","s":"ok","v":"4.673723"}
]
},
{"symbol":"AAPL_220819C3500C_O U","status":"ok",
"data":[
{"c":"opoi","s":"ok","v":"20"},
{"c":"opnpv","s":"ok","v":"134.2703"},
{"c":"opdelta","s":"ok","v":"0.995285"},
{"c":"opgamma","s":"ok","v":"0.000113"},
{"c":"oprho","s":"ok","v":"0.007149"},
{"c":"opvega","s":"ok","v":"0.003145"},
{"c":"optheta","s":"ok","v":"-0.224681"},
{"c":"opiv","s":"ok","v":"4.478560"}
]
},
{"symbol":"AAPL_220819C3000C_O U","status":"ok",
"data":[
{"c":"opoi","s":"ok","v":"30"},
{"c":"opnpv","s":"ok","v":"139.1984"},
{"c":"opdelta","s":"ok","v":"0.996796"},
{"c":"opgamma","s":"ok","v":"0.000076"},
{"c":"oprho","s":"ok","v":"0.005752"},
{"c":"opvega","s":"ok","v":"0.002893"},
{"c":"optheta","s":"ok","v":"-0.153177"},
{"c":"opiv","s":"ok","v":"4.673723"}
]
},
{"symbol":"AAPL_220819P4000C_O U","status":"ok",
"data":[
{"c":"opoi","s":"ok","v":"1"},
{"c":"opnpv","s":"ok","v":"0.0045"},
{"c":"opdelta","s":"ok","v":"-0.000216"},
{"c":"opgamma","s":"ok","v":"0.000011"},
{"c":"oprho","s":"ok","v":"-0.000009"},
{"c":"opvega","s":"ok","v":"0.000194"},
{"c":"optheta","s":"ok","v":"-0.004521"},
{"c":"opiv","s":"ok","v":"2.791198"}
]
}
]
}
Option Greeks data is available for equity options, and includes all Greeks and IV values for option contracts. This dataset is updated periodically throughout the trading session. Greeks, also known as risk measures, are used to measure the sensitivity of an option's price to changes in underlying asset price, volatility, and time to expiration.
It's important to note that because of the nature of how American option Greeks are derived, not all contracts have Greek values.
The following table shows the Data Column Ids and the corresponding Description of the Option Greeks data that is returned by the API:
Data Column Id | Description |
---|---|
opoi | Option Open Interest |
opnpv | Option Theoretical Calculated Price |
opdelta | Option Greek Delta |
opgamma | Option Greek Gamma |
oprho | Option Greek Rho |
opvega | Option Greek Vega |
optheta | Option Greek Theta |
opiv | Option Implied Volatility |
Company Dividends Data
Company dividends example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AA_S U","status":"ok",
"data":[
{"c":"divamt","s":"ok","v":"0.100"},
{"c":"divexdt","s":"ok","v":"2022-08-08T00:00:00.000000000"}
]
},
{"symbol":"AXP_S U","status":"ok",
"data":[
{"c":"divamt","s":"ok","v":"0.520"},
{"c":"divexdt","s":"ok","v":"2022-04-07T00:00:00.000000000"}
]
},
{"symbol":"BA_S U","status":"ok",
"data":[
{"c":"divamt","s":"ok","v":"2.0550"},
{"c":"divexdt","s":"ok","v":"2020-02-13T00:00:00.000000000"}
]
},
{"symbol":"CAT_S U","status":"ok",
"data":[
{"c":"divamt","s":"ok","v":"1.200"},
{"c":"divexdt","s":"ok","v":"2022-07-19T00:00:00.000000000"}
]
},
{"symbol":"C_S U","status":"ok",
"data":[
{"c":"divamt","s":"ok","v":"0.510"},
{"c":"divexdt","s":"ok","v":"2022-07-31T00:00:00.000000000"}
]
}
]
}
Company dividends data includes information on dividends declared by a particular company, such as the amount of the dividend, the type of dividend (monthly, quarterly, or annual), and important dates related to the dividend. This information is updated on the date the dividend is declared. The following table provides a list of all available data columns:
Data Column | Description |
---|---|
divtype | The type of dividend, which can be monthly, quarterly, or annual. |
divamt | The amount of the dividend. |
divdecldt | The date on which the dividend was declared. |
divexdt | The ex-dividend date, which is the date on which the stock starts trading without the dividend. |
divrecdt | The record date, which is the date on which the stockholder must be registered in the company's books to receive the dividend. |
divpaydt | The payable date, which is the date on which the dividend is paid to stockholders. |
Company Information Data
Company information data example:
{
"type":"snapshot",
"status":"ok",
"rows":[
{"symbol":"AAPL_S U","status":"ok",
"data":[
{"c":"sd","s":"ok","v":"Apple Inc."}
]
}
]
}
Company information is updated periodically and includes various details about the company such as a short and long description, SIC and SIK codes, and primary stock exchange. The following table provides a list of data columns and their respective descriptions:
Data Column Id | Description |
---|---|
sd | Short Description |
ld | Long Description |
sic | Stock SIC Code |
sik | Stock SIK Code |
pex | Stock Primary Exchange |
Historical Data
MarketFeed processes exchange feeds in real-time and stores the data in its historical databases. The historical data provided by MarketFeed's API includes:
OHLCV Charting Data: This dataset contains the open, high, low, close, and volume data, which is typically used by charting software. The data is organized by bar intervals (e.g. 1-minute, 5-minute, daily, etc.) and can be queried by specifying the instrument symbol, time range, and bar interval.
Tick Data: This dataset contains original pricing information for every event sent by exchanges, including timestamps and trade conditions. This data is typically used for back-testing trading strategies, and can be queried by specifying the instrument symbol, time range, and other query parameters.
Dividend Data: This dataset contains historical dividend data for a company, with new dividends added to the history at the time of announcement. Dividend data can be queried by specifying the instrument symbol and time range.
Overall, the primary way to query historical data using the API is by providing an instrument symbol, a historical time range, and additional query parameters. These parameters can include bar intervals, trade conditions, and other relevant information to narrow down the results to the specific data needed.
Chart Bar Data
Historical charting data is made up of bars with open/high/low/close prices, along with volume information. Each bar represents pricing movements during a certain timeframe, and volume accumulation for that period. For timeframes, the API supports intraday minutely bars ranging between 1-60 minutes, as well as daily and weekly bars. In addition to standard timeframes, the API also supports custom tick bars, which are created using tick data where each bar is made up from a number of ticks.
With exception of tick bars, all historical bar data is adjusted for splits and dividends. This means that the prices in the historical charting data have been modified to reflect the impact of any stock splits or dividends that have occurred.
There are certain limits for beginning and ending requesting time ranges. If the timespan exceeds limits, a 400 error is returned and request needs to be adjusted to comply with limits.
Request Limits
Bar type | Limit |
---|---|
Tick | Limit 1 hour |
Intraday | Limit 30 days |
Daily | Limit 5 years |
Weekly | Limit 5 years |
By default, the API does not return empty bars if trading hasn’t happened within bar’s timeframe. However, if empty bars are needed for things such as technical analysis calculations, an optional parameter can be passed to include empty bars in response. In such case, empty bars will include last bar’s pricing information without any volume.
Requesting Chart Bar Data
Example bar history request:
curl -X POST https://api.activetick.com/bars.json \
-H "Accept-Encoding: gzip, deflate" \
-i -d 'sessionid=MY_SESSIONID&symbol=IBM_S-U&bartype=intraday&minute=30&begintime=2022-01-10T00:00:00&endtime=2022-01-13T00:00:00&sessiontype=regular&include_empty_bars=false'
$.ajax({
type: 'POST',
url: 'https://api.activetick.com/bars.json',
data: {
sessionid: 'MY_SESSIONID',
symbol: 'IBM_S-U',
bartype: 'intraday',
minute: '30',
begintime: '2022-01-10T00:00:00',
endtime: '2022-01-13T00:00:00',
sessiontype: 'regular',
include_empty_bars: false
},
success: function(data) {
console.log('Bar data:');
data.bars.forEach(function(bar) {
console.log('Time: ' + bar.tm + ', Open: ' + bar.o + ', High: ' + bar.h + ', Low: ' + bar.l + ', Close: ' + bar.c + ', Volume: ' + bar.v + ', Trades: ' + bar.t);
});
}
});
import requests
url = "https://api.activetick.com/bars.json"
data = {
"sessionid": "MY_SESSIONID",
"symbol": "IBM_S-U",
"bartype": "intraday",
"minute": 30,
"begintime": "2022-01-10T00:00:00",
"endtime": "2022-01-13T00:00:00",
"sessiontype": "regular",
"include_empty_bars": False
}
headers = {
"Accept-Encoding": "gzip, deflate"
}
response = requests.post(url, data=data, headers=headers)
print("Status code: ", response.status_code, " Available Requests Left: ", response.headers["X-Available-Requests-Left"])
bars_data = response.json()
for bar in bars_data["bars"]:
print("Time: ", bar["tm"], "Open: ", bar["o"], "High: ", bar["h"], "Low: ", bar["l"], "Close: ", bar["c"], "Volume: ", bar["v"], "Ticks: ", bar["t"])
using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;
namespace BarsData
{
class Program
{
static void Main(string[] args)
{
using (var client = new HttpClient())
{
// Set base address
client.BaseAddress = new Uri("https://api.activetick.com/");
// Create the POST request
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("bars.json", UriKind.Relative),
Content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("sessionid", "MY_SESSIONID"),
new KeyValuePair<string, string>("symbol", "IBM_S-U"),
new KeyValuePair<string, string>("bartype", "intraday"),
new KeyValuePair<string, string>("minute", "30"),
new KeyValuePair<string, string>("begintime", "2022-01-10T00:00:00"),
new KeyValuePair<string, string>("endtime", "2022-01-13T00:00:00"),
new KeyValuePair<string, string>("sessiontype", "regular"),
new KeyValuePair<string, string>("include_empty_bars", "false")
})
};
// Send the POST request and get the response
var response = client.SendAsync(request).Result;
if (response.IsSuccessStatusCode)
{
// Read the response content
var content = response.Content.ReadAsStringAsync().Result;
// Deserialize the JSON data
var data = JsonConvert.DeserializeObject<BarsData>(content);
// Print the bars data with descriptions
Console.WriteLine("Type: " + data.Type);
Console.WriteLine("Status: " + data.Status);
Console.WriteLine("Symbol: " + data.Symbol);
Console.WriteLine("Bars: ");
foreach (var bar in data.Bars)
{
Console.WriteLine("Time: " + bar.Tm + ", Open: " + bar.O + ", High: " + bar.H + ", Low: " + bar.L + ", Close: " + bar.C + ", Volume: " + bar.V + ", Ticks: " + bar.T);
}
}
else
{
// Print the error message
Console.WriteLine("Request failed: " + response.StatusCode);
}
}
}
}
class BarsData
{
public string Type { get; set; }
public string Status { get; set; }
public string Symbol { get; set; }
public Bar[] Bars { get; set; }
}
class Bar
{
public string Tm { get; set; }
public string O { get; set; }
public string H { get; set; }
public string L { get; set; }
public string C { get; set; }
public string T { get; set; }
public string V { get; set; }
}
}
Example bar history response:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 199
Content-Length: 4640
{
"type":"bars",
"status":"ok",
"symbol":"IBM_S U",
"bars":[
{"tm":"2022-01-10T14:30:00","o":"134.47","h":"136.20","l":"133.77","c":"133.77","v":"718000","t":"2559"},
{"tm":"2022-01-10T15:00:00","o":"133.86","h":"134.28","l":"133.4501","c":"133.91","v":"492752","t":"2191"},
{"tm":"2022-01-10T15:30:00","o":"133.905","h":"134.22","l":"133.38","c":"134.18","v":"343356","t":"1496"},
{"tm":"2022-01-10T16:00:00","o":"134.19","h":"134.785","l":"133.92","c":"134.575","v":"288426","t":"1302"},
{"tm":"2022-01-10T16:30:00","o":"134.56","h":"135.11","l":"133.98","c":"135.03","v":"280954","t":"1256"},
{"tm":"2022-01-10T17:00:00","o":"135.02","h":"135.6699","l":"134.955","c":"135.595","v":"215186","t":"868"},
{"tm":"2022-01-10T17:30:00","o":"135.60","h":"135.75","l":"135.37","c":"135.445","v":"198750","t":"895"},
{"tm":"2022-01-10T18:00:00","o":"135.46","h":"135.71","l":"135.3601","c":"135.609","v":"174398","t":"823"},
{"tm":"2022-01-10T18:30:00","o":"135.61","h":"135.80","l":"135.46","c":"135.74","v":"249342","t":"1258"},
{"tm":"2022-01-10T19:00:00","o":"135.74","h":"136.20","l":"135.69","c":"135.691","v":"260897","t":"1282"},
{"tm":"2022-01-10T19:30:00","o":"135.702","h":"135.76","l":"135.15","c":"135.435","v":"238330","t":"1105"},
{"tm":"2022-01-10T20:00:00","o":"135.45","h":"135.48","l":"134.92","c":"135.01","v":"241435","t":"1208"},
{"tm":"2022-01-10T20:30:00","o":"135.03","h":"135.25","l":"134.80","c":"135.00","v":"760449","t":"4131"},
{"tm":"2022-01-10T21:00:00","o":"135.03","h":"135.03","l":"135.03","c":"135.03","v":"750364","t":"1"},
{"tm":"2022-01-11T14:30:00","o":"130.52","h":"131.19","l":"127.97","c":"129.55","v":"2869371","t":"11591"},
{"tm":"2022-01-11T15:00:00","o":"129.5399","h":"129.90","l":"129.04","c":"129.50","v":"961428","t":"4113"},
{"tm":"2022-01-11T15:30:00","o":"129.52","h":"130.32","l":"129.26","c":"130.11","v":"923254","t":"3412"},
{"tm":"2022-01-11T16:00:00","o":"130.09","h":"130.74","l":"130.03","c":"130.61","v":"499019","t":"2363"},
{"tm":"2022-01-11T16:30:00","o":"130.63","h":"131.19","l":"130.16","c":"130.3301","v":"481564","t":"2107"},
{"tm":"2022-01-11T17:00:00","o":"130.355","h":"131.44","l":"130.28","c":"131.07","v":"369014","t":"1601"},
{"tm":"2022-01-11T17:30:00","o":"131.10","h":"131.77","l":"131.07","c":"131.67","v":"322900","t":"1294"},
{"tm":"2022-01-11T18:00:00","o":"131.64","h":"131.65","l":"131.07","c":"131.4982","v":"314244","t":"1418"},
{"tm":"2022-01-11T18:30:00","o":"131.51","h":"131.62","l":"131.1701","c":"131.489","v":"625869","t":"1189"},
{"tm":"2022-01-11T19:00:00","o":"131.49","h":"131.88","l":"131.21","c":"131.83","v":"282075","t":"1297"},
{"tm":"2022-01-11T19:30:00","o":"131.84","h":"132.42","l":"131.76","c":"132.245","v":"434411","t":"1962"},
{"tm":"2022-01-11T20:00:00","o":"132.245","h":"133.07","l":"132.1752","c":"132.595","v":"751269","t":"3249"},
{"tm":"2022-01-11T20:30:00","o":"132.61","h":"133.25","l":"132.6012","c":"132.83","v":"1180543","t":"5754"},
{"tm":"2022-01-11T21:00:00","o":"132.87","h":"132.87","l":"132.87","c":"132.87","v":"734796","t":"1"},
{"tm":"2022-01-12T14:30:00","o":"133.25","h":"134.47","l":"132.18","c":"132.20","v":"726627","t":"3093"},
{"tm":"2022-01-12T15:00:00","o":"132.22","h":"132.29","l":"131.69","c":"131.88","v":"423198","t":"1810"},
{"tm":"2022-01-12T15:30:00","o":"131.88","h":"132.17","l":"131.37","c":"132.02","v":"436983","t":"2001"},
{"tm":"2022-01-12T16:00:00","o":"132.03","h":"132.1999","l":"131.48","c":"132.07","v":"328335","t":"1615"},
{"tm":"2022-01-12T16:30:00","o":"132.06","h":"132.73","l":"132.06","c":"132.63","v":"315952","t":"1449"},
{"tm":"2022-01-12T17:00:00","o":"132.61","h":"133.07","l":"132.51","c":"132.84","v":"239201","t":"1046"},
{"tm":"2022-01-12T17:30:00","o":"132.83","h":"133.27","l":"132.62","c":"133.155","v":"195979","t":"920"},
{"tm":"2022-01-12T18:00:00","o":"133.155","h":"133.42","l":"133.005","c":"133.35","v":"226431","t":"880"},
{"tm":"2022-01-12T18:30:00","o":"133.36","h":"133.505","l":"132.89","c":"133.085","v":"233383","t":"974"},
{"tm":"2022-01-12T19:00:00","o":"133.07","h":"133.24","l":"132.975","c":"133.1642","v":"320687","t":"1331"},
{"tm":"2022-01-12T19:30:00","o":"133.18","h":"133.21","l":"132.806","c":"132.81","v":"282325","t":"1199"},
{"tm":"2022-01-12T20:00:00","o":"132.82","h":"133.345","l":"132.77","c":"133.28","v":"274603","t":"1206"},
{"tm":"2022-01-12T20:30:00","o":"133.28","h":"133.72","l":"133.21","c":"133.61","v":"492124","t":"2570"},
{"tm":"2022-01-12T21:00:00","o":"133.59","h":"133.59","l":"133.59","c":"133.59","v":"452182","t":"1"}
]
}
Bar data:
Time: 2022-01-10T14:30:00, Open: 134.47, High: 136.20, Low: 133.77, Close: 133.77, Volume: 718000, Trades: 2559
Time: 2022-01-10T15:00:00, Open: 133.86, High: 134.28, Low: 133.4501, Close: 133.91, Volume: 492752, Trades: 2191
Time: 2022-01-10T15:30:00, Open: 133.905, High: 134.22, Low: 133.38, Close: 134.18, Volume: 343356, Trades: 1496
Time: 2022-01-10T16:00:00, Open: 134.19, High: 134.785, Low: 133.92, Close: 134.575, Volume: 288426, Trades: 1302
Time: 2022-01-10T16:30:00, Open: 134.56, High: 135.11, Low: 133.98, Close: 135.03, Volume: 280954, Trades: 1256
Time: 2022-01-10T17:00:00, Open: 135.02, High: 135.6699, Low: 134.955, Close: 135.595, Volume: 215186, Trades: 868
Time: 2022-01-10T17:30:00, Open: 135.60, High: 135.75, Low: 135.37, Close: 135.445, Volume: 198750, Trades: 895
Time: 2022-01-10T18:00:00, Open: 135.46, High: 135.71, Low: 135.3601, Close: 135.609, Volume: 174398, Trades: 823
Time: 2022-01-10T18:30:00, Open: 135.61, High: 135.80, Low: 135.46, Close: 135.74, Volume: 249342, Trades: 1258
Time: 2022-01-10T19:00:00, Open: 135.74, High: 136.20, Low: 135.69, Close: 135.691, Volume: 260897, Trades: 1282
Time: 2022-01-10T19:30:00, Open: 135.702, High: 135.76, Low: 135.15, Close: 135.435, Volume: 238330, Trades: 1105
Time: 2022-01-10T20:00:00, Open: 135.45, High: 135.48, Low: 134.92, Close: 135.01, Volume: 241435, Trades: 1208
Time: 2022-01-10T20:30:00, Open: 135.03, High: 135.25, Low: 134.80, Close: 135.00, Volume: 760449, Trades: 4131
Time: 2022-01-10T21:00:00, Open: 135.03, High: 135.03, Low: 135.03, Close: 135.03, Volume: 750364, Trades: 1
Time: 2022-01-11T14:30:00, Open: 130.52, High: 131.19, Low: 127.97, Close: 129.55, Volume: 2869371, Trades: 11591
Time: 2022-01-11T15:00:00, Open: 129.5399, High: 129.90, Low: 129.04, Close: 129.50, Volume: 961428, Trades: 4113
Time: 2022-01-11T15:30:00, Open: 129.52, High: 130.32, Low: 129.26, Close: 130.11, Volume: 923254, Trades: 3412
Time: 2022-01-11T16:00:00, Open: 130.09, High: 130.74, Low: 130.03, Close: 130.61, Volume: 499019, Trades: 2363
Time: 2022-01-11T16:30:00, Open: 130.63, High: 131.19, Low: 130.16, Close: 130.3301, Volume: 481564, Trades: 2107
Time: 2022-01-11T17:00:00, Open: 130.355, High: 131.44, Low: 130.28, Close: 131.07, Volume: 369014, Trades: 1601
Time: 2022-01-11T17:30:00, Open: 131.10, High: 131.77, Low: 131.07, Close: 131.67, Volume: 322900, Trades: 1294
Time: 2022-01-11T18:00:00, Open: 131.64, High: 131.65, Low: 131.07, Close: 131.4982, Volume: 314244, Trades: 1418
Time: 2022-01-11T18:30:00, Open: 131.51, High: 131.62, Low: 131.1701, Close: 131.489, Volume: 625869, Trades: 1189
Time: 2022-01-11T19:00:00, Open: 131.49, High: 131.88, Low: 131.21, Close: 131.83, Volume: 282075, Trades: 1297
Time: 2022-01-11T19:30:00, Open: 131.84, High: 132.42, Low: 131.76, Close: 132.245, Volume: 434411, Trades: 1962
Time: 2022-01-11T20:00:00, Open: 132.245, High: 133.07, Low: 132.1752, Close: 132.595, Volume: 751269, Trades: 3249
Time: 2022-01-11T20:30:00, Open: 132.61, High: 133.25, Low: 132.6012, Close: 132.83, Volume: 1180543, Trades: 5754
Time: 2022-01-11T21:00:00, Open: 132.87, High: 132.87, Low: 132.87, Close: 132.87, Volume: 734796, Trades: 1
Time: 2022-01-12T14:30:00, Open: 133.25, High: 134.47, Low: 132.18, Close: 132.20, Volume: 726627, Trades: 3093
Time: 2022-01-12T15:00:00, Open: 132.22, High: 132.29, Low: 131.69, Close: 131.88, Volume: 423198, Trades: 1810
Time: 2022-01-12T15:30:00, Open: 131.88, High: 132.17, Low: 131.37, Close: 132.02, Volume: 436983, Trades: 2001
Time: 2022-01-12T16:00:00, Open: 132.03, High: 132.1999, Low: 131.48, Close: 132.07, Volume: 328335, Trades: 1615
Time: 2022-01-12T16:30:00, Open: 132.06, High: 132.73, Low: 132.06, Close: 132.63, Volume: 315952, Trades: 1449
Time: 2022-01-12T17:00:00, Open: 132.61, High: 133.07, Low: 132.51, Close: 132.84, Volume: 239201, Trades: 1046
Time: 2022-01-12T17:30:00, Open: 132.83, High: 133.27, Low: 132.62, Close: 133.155, Volume: 195979, Trades: 920
Time: 2022-01-12T18:00:00, Open: 133.155, High: 133.42, Low: 133.005, Close: 133.35, Volume: 226431, Trades: 880
Time: 2022-01-12T18:30:00, Open: 133.36, High: 133.505, Low: 132.89, Close: 133.085, Volume: 233383, Trades: 974
Time: 2022-01-12T19:00:00, Open: 133.07, High: 133.24, Low: 132.975, Close: 133.1642, Volume: 320687, Trades: 1331
Time: 2022-01-12T19:30:00, Open: 133.18, High: 133.21, Low: 132.806, Close: 132.81, Volume: 282325, Trades: 1199
Time: 2022-01-12T20:00:00, Open: 132.82, High: 133.345, Low: 132.77, Close: 133.28, Volume: 274603, Trades: 1206
Time: 2022-01-12T20:30:00, Open: 133.28, High: 133.72, Low: 133.21, Close: 133.61, Volume: 492124, Trades: 2570
Time: 2022-01-12T21:00:00, Open: 133.59, High: 133.59, Low: 133.59, Close: 133.59, Volume: 452182, Trades: 1
Status code: 200 Available Requests Left: 199
Time: 2022-01-10T14:30:00 Open: 134.47 High: 136.20 Low: 133.77 Close: 133.77 Volume: 718000 Ticks: 2559
Time: 2022-01-10T15:00:00 Open: 133.86 High: 134.28 Low: 133.4501 Close: 133.91 Volume: 492752 Ticks: 2191
Time: 2022-01-10T15:30:00 Open: 133.905 High: 134.22 Low: 133.38 Close: 134.18 Volume: 343356 Ticks: 1496
Time: 2022-01-10T16:00:00 Open: 134.19 High: 134.785 Low: 133.92 Close: 134.575 Volume: 288426 Ticks: 1302
Time: 2022-01-10T16:30:00 Open: 134.56 High: 135.11 Low: 133.98 Close: 135.03 Volume: 280954 Ticks: 1256
Time: 2022-01-10T17:00:00 Open: 135.02 High: 135.6699 Low: 134.955 Close: 135.595 Volume: 215186 Ticks: 868
Time: 2022-01-10T17:30:00 Open: 135.60 High: 135.75 Low: 135.37 Close: 135.445 Volume: 198750 Ticks: 895
Time: 2022-01-10T18:00:00 Open: 135.46 High: 135.71 Low: 135.3601 Close: 135.609 Volume: 174398 Ticks: 823
Time: 2022-01-10T18:30:00 Open: 135.61 High: 135.80 Low: 135.46 Close: 135.74 Volume: 249342 Ticks: 1258
Time: 2022-01-10T19:00:00 Open: 135.74 High: 136.20 Low: 135.69 Close: 135.691 Volume: 260897 Ticks: 1282
Time: 2022-01-10T19:30:00 Open: 135.702 High: 135.76 Low: 135.15 Close: 135.435 Volume: 238330 Ticks: 1105
Time: 2022-01-10T20:00:00 Open: 135.45 High: 135.48 Low: 134.92 Close: 135.01 Volume: 241435 Ticks: 1208
Time: 2022-01-10T20:30:00 Open: 135.03 High: 135.25 Low: 134.80 Close: 135.00 Volume: 760449 Ticks: 4131
Time: 2022-01-10T21:00:00 Open: 135.03 High: 135.03 Low: 135.03 Close: 135.03 Volume: 750364 Ticks: 1
Time: 2022-01-11T14:30:00 Open: 130.52 High: 131.19 Low: 127.97 Close: 129.55 Volume: 2869371 Ticks: 11591
Time: 2022-01-11T15:00:00 Open: 129.5399 High: 129.90 Low: 129.04 Close: 129.50 Volume: 961428 Ticks: 4113
Time: 2022-01-11T15:30:00 Open: 129.52 High: 130.32 Low: 129.26 Close: 130.11 Volume: 923254 Ticks: 3412
Time: 2022-01-11T16:00:00 Open: 130.09 High: 130.74 Low: 130.03 Close: 130.61 Volume: 499019 Ticks: 2363
Time: 2022-01-11T16:30:00 Open: 130.63 High: 131.19 Low: 130.16 Close: 130.3301 Volume: 481564 Ticks: 2107
Time: 2022-01-11T17:00:00 Open: 130.355 High: 131.44 Low: 130.28 Close: 131.07 Volume: 369014 Ticks: 1601
Time: 2022-01-11T17:30:00 Open: 131.10 High: 131.77 Low: 131.07 Close: 131.67 Volume: 322900 Ticks: 1294
Time: 2022-01-11T18:00:00 Open: 131.64 High: 131.65 Low: 131.07 Close: 131.4982 Volume: 314244 Ticks: 1418
Time: 2022-01-11T18:30:00 Open: 131.51 High: 131.62 Low: 131.1701 Close: 131.489 Volume: 625869 Ticks: 1189
Time: 2022-01-11T19:00:00 Open: 131.49 High: 131.88 Low: 131.21 Close: 131.83 Volume: 282075 Ticks: 1297
Time: 2022-01-11T19:30:00 Open: 131.84 High: 132.42 Low: 131.76 Close: 132.245 Volume: 434411 Ticks: 1962
Time: 2022-01-11T20:00:00 Open: 132.245 High: 133.07 Low: 132.1752 Close: 132.595 Volume: 751269 Ticks: 3249
Time: 2022-01-11T20:30:00 Open: 132.61 High: 133.25 Low: 132.6012 Close: 132.83 Volume: 1180543 Ticks: 5754
Time: 2022-01-11T21:00:00 Open: 132.87 High: 132.87 Low: 132.87 Close: 132.87 Volume: 734796 Ticks: 1
Time: 2022-01-12T14:30:00 Open: 133.25 High: 134.47 Low: 132.18 Close: 132.20 Volume: 726627 Ticks: 3093
Time: 2022-01-12T15:00:00 Open: 132.22 High: 132.29 Low: 131.69 Close: 131.88 Volume: 423198 Ticks: 1810
Time: 2022-01-12T15:30:00 Open: 131.88 High: 132.17 Low: 131.37 Close: 132.02 Volume: 436983 Ticks: 2001
Time: 2022-01-12T16:00:00 Open: 132.03 High: 132.1999 Low: 131.48 Close: 132.07 Volume: 328335 Ticks: 1615
Time: 2022-01-12T16:30:00 Open: 132.06 High: 132.73 Low: 132.06 Close: 132.63 Volume: 315952 Ticks: 1449
Time: 2022-01-12T17:00:00 Open: 132.61 High: 133.07 Low: 132.51 Close: 132.84 Volume: 239201 Ticks: 1046
Time: 2022-01-12T17:30:00 Open: 132.83 High: 133.27 Low: 132.62 Close: 133.155 Volume: 195979 Ticks: 920
Time: 2022-01-12T18:00:00 Open: 133.155 High: 133.42 Low: 133.005 Close: 133.35 Volume: 226431 Ticks: 880
Time: 2022-01-12T18:30:00 Open: 133.36 High: 133.505 Low: 132.89 Close: 133.085 Volume: 233383 Ticks: 974
Time: 2022-01-12T19:00:00 Open: 133.07 High: 133.24 Low: 132.975 Close: 133.1642 Volume: 320687 Ticks: 1331
Time: 2022-01-12T19:30:00 Open: 133.18 High: 133.21 Low: 132.806 Close: 132.81 Volume: 282325 Ticks: 1199
Time: 2022-01-12T20:00:00 Open: 132.82 High: 133.345 Low: 132.77 Close: 133.28 Volume: 274603 Ticks: 1206
Time: 2022-01-12T20:30:00 Open: 133.28 High: 133.72 Low: 133.21 Close: 133.61 Volume: 492124 Ticks: 2570
Time: 2022-01-12T21:00:00 Open: 133.59 High: 133.59 Low: 133.59 Close: 133.59 Volume: 452182 Ticks: 1
Status code: 200 Available Requests Left: 199
Time: 2022-01-10T14:30:00 Open: 134.47 High: 136.20 Low: 133.77 Close: 133.77 Volume: 718000 Ticks: 2559
Time: 2022-01-10T15:00:00 Open: 133.86 High: 134.28 Low: 133.4501 Close: 133.91 Volume: 492752 Ticks: 2191
Time: 2022-01-10T15:30:00 Open: 133.905 High: 134.22 Low: 133.38 Close: 134.18 Volume: 343356 Ticks: 1496
Time: 2022-01-10T16:00:00 Open: 134.19 High: 134.785 Low: 133.92 Close: 134.575 Volume: 288426 Ticks: 1302
Time: 2022-01-10T16:30:00 Open: 134.56 High: 135.11 Low: 133.98 Close: 135.03 Volume: 280954 Ticks: 1256
Time: 2022-01-10T17:00:00 Open: 135.02 High: 135.6699 Low: 134.955 Close: 135.595 Volume: 215186 Ticks: 868
Time: 2022-01-10T17:30:00 Open: 135.60 High: 135.75 Low: 135.37 Close: 135.445 Volume: 198750 Ticks: 895
Time: 2022-01-10T18:00:00 Open: 135.46 High: 135.71 Low: 135.3601 Close: 135.609 Volume: 174398 Ticks: 823
Time: 2022-01-10T18:30:00 Open: 135.61 High: 135.80 Low: 135.46 Close: 135.74 Volume: 249342 Ticks: 1258
Time: 2022-01-10T19:00:00 Open: 135.74 High: 136.20 Low: 135.69 Close: 135.691 Volume: 260897 Ticks: 1282
Time: 2022-01-10T19:30:00 Open: 135.702 High: 135.76 Low: 135.15 Close: 135.435 Volume: 238330 Ticks: 1105
Time: 2022-01-10T20:00:00 Open: 135.45 High: 135.48 Low: 134.92 Close: 135.01 Volume: 241435 Ticks: 1208
Time: 2022-01-10T20:30:00 Open: 135.03 High: 135.25 Low: 134.80 Close: 135.00 Volume: 760449 Ticks: 4131
Time: 2022-01-10T21:00:00 Open: 135.03 High: 135.03 Low: 135.03 Close: 135.03 Volume: 750364 Ticks: 1
Time: 2022-01-11T14:30:00 Open: 130.52 High: 131.19 Low: 127.97 Close: 129.55 Volume: 2869371 Ticks: 11591
Time: 2022-01-11T15:00:00 Open: 129.5399 High: 129.90 Low: 129.04 Close: 129.50 Volume: 961428 Ticks: 4113
Time: 2022-01-11T15:30:00 Open: 129.52 High: 130.32 Low: 129.26 Close: 130.11 Volume: 923254 Ticks: 3412
Time: 2022-01-11T16:00:00 Open: 130.09 High: 130.74 Low: 130.03 Close: 130.61 Volume: 499019 Ticks: 2363
Time: 2022-01-11T16:30:00 Open: 130.63 High: 131.19 Low: 130.16 Close: 130.3301 Volume: 481564 Ticks: 2107
Time: 2022-01-11T17:00:00 Open: 130.355 High: 131.44 Low: 130.28 Close: 131.07 Volume: 369014 Ticks: 1601
Time: 2022-01-11T17:30:00 Open: 131.10 High: 131.77 Low: 131.07 Close: 131.67 Volume: 322900 Ticks: 1294
Time: 2022-01-11T18:00:00 Open: 131.64 High: 131.65 Low: 131.07 Close: 131.4982 Volume: 314244 Ticks: 1418
Time: 2022-01-11T18:30:00 Open: 131.51 High: 131.62 Low: 131.1701 Close: 131.489 Volume: 625869 Ticks: 1189
Time: 2022-01-11T19:00:00 Open: 131.49 High: 131.88 Low: 131.21 Close: 131.83 Volume: 282075 Ticks: 1297
Time: 2022-01-11T19:30:00 Open: 131.84 High: 132.42 Low: 131.76 Close: 132.245 Volume: 434411 Ticks: 1962
Time: 2022-01-11T20:00:00 Open: 132.245 High: 133.07 Low: 132.1752 Close: 132.595 Volume: 751269 Ticks: 3249
Time: 2022-01-11T20:30:00 Open: 132.61 High: 133.25 Low: 132.6012 Close: 132.83 Volume: 1180543 Ticks: 5754
Time: 2022-01-11T21:00:00 Open: 132.87 High: 132.87 Low: 132.87 Close: 132.87 Volume: 734796 Ticks: 1
Time: 2022-01-12T14:30:00 Open: 133.25 High: 134.47 Low: 132.18 Close: 132.20 Volume: 726627 Ticks: 3093
Time: 2022-01-12T15:00:00 Open: 132.22 High: 132.29 Low: 131.69 Close: 131.88 Volume: 423198 Ticks: 1810
Time: 2022-01-12T15:30:00 Open: 131.88 High: 132.17 Low: 131.37 Close: 132.02 Volume: 436983 Ticks: 2001
Time: 2022-01-12T16:00:00 Open: 132.03 High: 132.1999 Low: 131.48 Close: 132.07 Volume: 328335 Ticks: 1615
Time: 2022-01-12T16:30:00 Open: 132.06 High: 132.73 Low: 132.06 Close: 132.63 Volume: 315952 Ticks: 1449
Time: 2022-01-12T17:00:00 Open: 132.61 High: 133.07 Low: 132.51 Close: 132.84 Volume: 239201 Ticks: 1046
Time: 2022-01-12T17:30:00 Open: 132.83 High: 133.27 Low: 132.62 Close: 133.155 Volume: 195979 Ticks: 920
:Time: 2022-01-12T18:00:00 Open: 133.155 High: 133.42 Low: 133.005 Close: 133.35 Volume: 226431 Ticks: 880
Time: 2022-01-12T18:30:00 Open: 133.36 High: 133.505 Low: 132.89 Close: 133.085 Volume: 233383 Ticks: 974
Time: 2022-01-12T19:00:00 Open: 133.07 High: 133.24 Low: 132.975 Close: 133.1642 Volume: 320687 Ticks: 1331
Time: 2022-01-12T19:30:00 Open: 133.18 High: 133.21 Low: 132.806 Close: 132.81 Volume: 282325 Ticks: 1199
Time: 2022-01-12T20:00:00 Open: 132.82 High: 133.345 Low: 132.77 Close: 133.28 Volume: 274603 Ticks: 1206
Time: 2022-01-12T20:30:00 Open: 133.28 High: 133.72 Low: 133.21 Close: 133.61 Volume: 492124 Ticks: 2570
Time: 2022-01-12T21:00:00 Open: 133.59 High: 133.59 Low: 133.59 Close: 133.59 Volume: 452182 Ticks: 1
The Bar Data Request is a RESTful API endpoint that allows clients to request historical bar data for a specific instrument symbol. The endpoint is accessed by sending a GET or POST request to the URL https://api.activetick.com/bars.json
, along with several required parameters and optional parameters.
The Bar Data Request Parameters section defines the available parameters for the API request and what each of them represents. The Bar Types section defines the different types of bars that can be requested, and the Bar Session Types section defines the different trading sessions that data can be requested for.
The Bar data response is the response returned by the API after a successful request. The response contains a JSON object that includes response metadata (type, status, and symbol) and an array of pricing information for each bar in the form of bar items. The Bar Item section defines the different pieces of information included in each bar item, such as timestamp, prices, volume, and tick count.
Bar Data Request Endpoint
https://api.activetick.com/bars.json?sessionid=<sessionid>&symbol=<symbol>&bartype=<bartype>&minute=<minute>&begintime=<begintime>&endtime=<endtime>&sessiontype=<sessiontype>&include_empty_bars=<include_empty_bars>
Bar Data Request Parameters
Parameter | Required | Description |
---|---|---|
sessionid | Yes | A valid sessionid value returned from prior authorization. This is necessary for authentication and identification of the user making the request. |
symbol | Yes | The instrument symbol, such as the stock ticker, for which historical data is being requested. |
bartype | Yes | The type of bars to be returned, such as tick, intraday, daily, or weekly. |
minute | No | The intraday minute compression is only required for intraday bars. This parameter determines the duration of each bar, with options ranging from 1-60 minutes. |
ticks | No | The ticks parameter is only required when tick bartype is selected. The ticks parameter determines how many ticks to include in each generated bar. Valid range is 1-1000 ticks. |
begintime | Yes | The start time for the historical data being requested. This parameter should be in the format of "YYYY-MM-DDTHH:MM:SS" and specify the date and time in UTC. |
endtime | Yes | The end time for the historical data being requested. This parameter should be in the format of "YYYY-MM-DDTHH:MM:SS" and specify the date and time in UTC. |
sessiontype | No | An optional parameter that specifies the type of session for which data is being requested. The default value is "both" if this parameter is not set. This can be set to "regular" or "extended" to specify the trading session. |
include_empty_bars | No | An optional boolean parameter to include empty bars in response even if trades didn't happen for those bars. The default is false if this parameter is not set. This is useful for technical analysis calculations. |
Bar Types
Bar Type | Description |
---|---|
tick | Tick bars based on number of ticks rather than time span. Each bar represents the pricing movement and volume accumulation for a number of ticks. |
intraday | Intraday bars with a minute timeframe. Each bar represents the pricing movements and volume accumulation for the specified number of minutes passed in the request. |
daily | Daily bars with a timeframe of one day. Each bar represents the pricing movements and volume accumulation for a single day. |
weekly | Weekly bars with a timeframe of one week. Each bar represents the pricing movements and volume accumulation for an entire week. |
Bar Session Types
Session Type | Description |
---|---|
regular | Returns data for regular trading sessions only. This typically includes trading hours for the primary exchange for the symbol. |
extended | Returns data for extended hours trading sessions only. This typically includes pre-market and post-market trading sessions for the primary exchange for the symbol. |
both | Returns data for both regular and extended hours trading sessions. This includes trading hours for the primary exchange for the symbol, as well as any pre-market and post-market sessions that are available. |
Bar Data Response
Bar data response contains response metadata and an array of pricing information for each bar. The following table lists everything included in the response, including the bar's timestamp, opening price, high price, low price, closing price, volume, and tick count.
Name | Description |
---|---|
type | "bars" |
status | Indicates if the request completed successfully. Possible values are "ok" and "fail". |
symbol | Original request symbol. |
bars | Array of bar items with pricing information, including the timestamp (tm), opening price (o), high price (h), low price (l), closing price (c), volume (v), and tick count (t). |
Bar Item
Name | Description |
---|---|
tm | Bar time in the format of YYYY-MM-DDTHH:MM:SS |
o | Open price for the bar |
h | High price for the bar |
l | Low price for the bar |
c | Close price for the bar |
v | Volume of trades during the bar |
t | Number of trades during the bar |
Time Series Data
Historical time series data is made up of all original market events received from exchange data feeds, including information on all trade transactions and full bid/ask quote pricing. This type of data is primarily used for market analysis, back-testing trading strategies, market research and other applications.
When dealing with instruments that trade on multiple exchanges, such as US stocks, the API provides time series data for individual exchanges as well as fully consolidated datasets. The data stored in our time series databases is kept with original pricing information, and is not adjusted for splits or dividends.
When requesting time series data, there are limits on the number of rows that can be requested in a single request. Each request must include a maximum number of expected rows, and cannot exceed 50,000. Additionally, the time range for the request cannot exceed more than 24 hours.
All time series tick data records contain nanosecond timestamps for precise timing of the market events
It's important to take into consideration the size of the datasets when querying data for active symbols, as some actively traded instruments could contain several million rows of data each trading session.
Requesting Time Series Data
Example time series request:
curl -X POST https://api.activetick.com/ticks.json \
-H "Accept-Encoding: gzip" \
--compressed -i -d 'MY_SESSIONID&symbol=AAPL_S U&ticktype=both&maxrecords=20&begintime=2022-01-21T10:00:00&endtime=2022-01-21T12:00:00'
$.ajax({
type: "POST",
url: "https://api.activetick.com/ticks.json",
data: {
sessionid: "MY_SESSION",,
symbol: "AAPL_S U",
ticktype: "both",
maxrecords: 20,
begintime: "2022-01-21T10:00:00",
endtime: "2022-01-21T12:00:00"
},
headers: {
"Accept-Encoding": "gzip"
},
success: function(response) {
console.log("Type: ", response.type);
console.log("Status: ", response.status);
console.log("Symbol: ", response.symbol);
var ticks = response.ticks;
for (var i = 0; i < ticks.length; i++) {
var tick = ticks[i];
if (tick.t === "q") {
console.log(`Quote Tick: [Index: ${tick.i}] [Time: ${tick.tm}] [Bid price: ${tick.b}] [Ask price: ${tick.a}] [Bid exchange: ${tick.bx}] [Ask exchange: ${tick.ax}] [Bid size: ${tick.bz}] [Ask size: ${tick.az}] [Quote condition: ${tick.c}]`);
} else if (tick.t === "t") {
console.log(`Trade Tick: [Index: ${tick.i}] [Time: ${tick.tm}] [Last traded price: ${tick.l}] [Last traded exchange: ${tick.x}] [Last traded size: ${tick.z}] [Trade flags: ${tick.f}] [Trade conditions: ${tick.c}]`);
}
}
},
error: function(error) {
console.error("Error in fetching data: ", error);
}
});
import requests
url = "https://api.activetick.com/ticks.json"
headers = {
"Accept-Encoding": "gzip"
}
data = {
"sessionid": "MY_SESSIONID",
"symbol": "AAPL_S U",
"ticktype": "both",
"maxrecords": 20,
"begintime": "2022-01-21T10:00:00",
"endtime": "2022-01-21T12:00:00"
}
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200:
response_json = response.json()
print(f"Type: {response_json['type']}")
print(f"Status: {response_json['status']}")
print(f"Symbol: {response_json['symbol']}")
for tick in response_json['ticks']:
if tick['t'] == 'q':
print(f"Quote Tick: [Index: {tick['i']}] [Time: {tick['tm']}] [Bid price: {tick['b']}] [Ask price: {tick['a']}] [Bid exchange: {tick['bx']}] [Ask exchange: {tick['ax']}] [Bid size: {tick['bz']}] [Ask size: {tick['az']}] [Quote condition: {tick['c']}]")
elif tick['t'] == 't':
print(f"Trade Tick: [Index: {tick['i']}] [Time: {tick['tm']}] [Last traded price: {tick['l']}] [Last traded exchange: {tick['x']}] [Last traded size: {tick['z']}] [Trade flags: {tick['f']}] [Trade conditions: {tick['c']}]")
else:
print(f"Error in fetching data: {response.text}")
using System;
using System.Net.Http;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.IO;
using System.IO.Compression;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
using (var client = new HttpClient())
{
// Set base address
client.BaseAddress = new Uri("https://api.activetick.com/");
//set acceptable encoding to gzip
client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip");
// Create the POST request
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("ticks.json", UriKind.Relative),
Content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("sessionid", "MY_SESSIONID"),
new KeyValuePair<string, string>("symbol", "AAPL_S U"),
new KeyValuePair<string, string>("ticktype", "both"),
new KeyValuePair<string, string>("maxrecords", "20"),
new KeyValuePair<string, string>("begintime", "2022-01-21T10:00:00"),
new KeyValuePair<string, string>("endtime", "2022-01-21T12:00:00"),
})
};
// Send the POST request and get the response
var response = client.SendAsync(request).Result;
using (var stream = response.Content.ReadAsStreamAsync().Result)
{
using (var decompressedStream = new GZipStream(stream, CompressionMode.Decompress))
{
using (var streamReader = new StreamReader(decompressedStream))
{
var responseData = streamReader.ReadToEnd();
dynamic result = JsonConvert.DeserializeObject(responseData);
Console.WriteLine("Type: " + result.type);
Console.WriteLine("Status: " + result.status);
Console.WriteLine("Symbol: " + result.symbol);
foreach (var tick in result.ticks)
{
if (tick.t == "q")
{
Console.WriteLine("Quote Tick: [Index: " + tick.i + "] [Time: " + tick.tm + "] [Bid price: " + tick.b + "] [Ask price: " + tick.a + "] [Bid exchange: " + tick.bx + "] [Ask exchange: " + tick.ax + "] [Bid size: " + tick.bz + "] [Ask size: " + tick.az + "] [Quote condition: " + tick.c + "]");
}
else if (tick.t == "t")
{
Console.WriteLine("Trade Tick: [Index: " + tick.i + "] [Time: " + tick.tm + "] [Last traded price: " + tick.l + "] [Last traded exchange: " + tick.x + "] [Last traded size: " + tick.z + "] [Trade flags: " + tick.f + "] [Trade conditions: " + tick.c[0] + "," + tick.c[1] + "," + tick.c[2] + "," + tick.c[3] + "]");
}
}
}
}
}
}
}
}
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Encoding: gzip
X-Available-Requests-Left: 199
Content-Length: 948
{
"type":"ticks",
"status":"ok",
"symbol":"AAPL_S U",
"ticks":[
{"t":"q","i":"2835","tm":"2022-01-21T10:00:01.265742794","b":"163.82","a":"163.93","bx":"P","ax":"Q","bz":"2","az":"1","c":"0"},
{"t":"t","i":"6626","tm":"2022-01-21T10:00:02.986469412","l":"163.90","x":"P","z":"1","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6627","tm":"2022-01-21T10:00:03.998868509","l":"163.90","x":"Q","z":"20","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6628","tm":"2022-01-21T10:00:03.998873260","l":"163.90","x":"Q","z":"7","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6629","tm":"2022-01-21T10:00:03.999450924","l":"163.90","x":"P","z":"29","f":"194","c":["37","12","0","0"]},
{"t":"q","i":"2836","tm":"2022-01-21T10:00:05.082729164","b":"163.82","a":"163.94","bx":"P","ax":"P","bz":"2","az":"1","c":"0"},
{"t":"t","i":"6630","tm":"2022-01-21T10:00:05.082732879","l":"163.93","x":"Q","z":"30","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6631","tm":"2022-01-21T10:00:07.042183294","l":"163.90","x":"P","z":"21","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6632","tm":"2022-01-21T10:00:07.042183412","l":"163.89","x":"P","z":"1","f":"194","c":["37","12","0","0"]},
{"t":"q","i":"2837","tm":"2022-01-21T10:00:11.993624918","b":"163.82","a":"163.93","bx":"P","ax":"P","bz":"2","az":"1","c":"0"},
{"t":"t","i":"6633","tm":"2022-01-21T10:00:12.314534157","l":"163.89","x":"P","z":"9","f":"194","c":["37","12","0","0"]},
{"t":"t","i":"6634","tm":"2022-01-21T10:00:12.314593373","l":"163.89","x":"P","z":"125","f":"194","c":["0","12","14","0"]},
{"t":"t","i":"6635","tm":"2022-01-21T10:00:13.337067632","l":"163.90","x":"Q","z":"73","f":"194","c":["37","12","14","0"]},
{"t":"t","i":"6636","tm":"2022-01-21T10:00:13.337070429","l":"163.87","x":"Q","z":"27","f":"194","c":["37","12","14","0"]},
{"t":"q","i":"2838","tm":"2022-01-21T10:00:13.337792402","b":"163.81","a":"163.93","bx":"P","ax":"P","bz":"4","az":"1","c":"0"},
{"t":"t","i":"6637","tm":"2022-01-21T10:00:13.337794549","l":"163.88","x":"P","z":"5","f":"194","c":["37","12","14","0"]},
{"t":"t","i":"6638","tm":"2022-01-21T10:00:13.337794691","l":"163.87","x":"P","z":"10","f":"194","c":["37","12","14","0"]},
{"t":"t","i":"6639","tm":"2022-01-21T10:00:13.337794904","l":"163.86","x":"P","z":"3","f":"194","c":["37","12","14","0"]},
{"t":"t","i":"6640","tm":"2022-01-21T10:00:13.337795046","l":"163.86","x":"P","z":"1","f":"194","c":["37","12","14","0"]},
{"t":"t","i":"6641","tm":"2022-01-21T10:00:13.337802821","l":"163.85","x":"P","z":"10","f":"194","c":["37","12","14","0"]}
]
}
Type: ticks
Status: ok
Symbol: AAPL_S U
Quote Tick: [Index: 2835] [Time: 2022-01-21T10:00:01.265742794] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: Q] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6626] [Time: 2022-01-21T10:00:02.986469412] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6627] [Time: 2022-01-21T10:00:03.998868509] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 20] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6628] [Time: 2022-01-21T10:00:03.998873260] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 7] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6629] [Time: 2022-01-21T10:00:03.999450924] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 29] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Quote Tick: [Index: 2836] [Time: 2022-01-21T10:00:05.082729164] [Bid price: 163.82] [Ask price: 163.94] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6630] [Time: 2022-01-21T10:00:05.082732879] [Last traded price: 163.93] [Last traded exchange: Q] [Last traded size: 30] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6631] [Time: 2022-01-21T10:00:07.042183294] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 21] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6632] [Time: 2022-01-21T10:00:07.042183412] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Quote Tick: [Index: 2837] [Time: 2022-01-21T10:00:11.993624918] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6633] [Time: 2022-01-21T10:00:12.314534157] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 9] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6634] [Time: 2022-01-21T10:00:12.314593373] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 125] [Trade flags: 194] [Trade conditions: 0,12,14,0]
Trade Tick: [Index: 6635] [Time: 2022-01-21T10:00:13.337067632] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 73] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6636] [Time: 2022-01-21T10:00:13.337070429] [Last traded price: 163.87] [Last traded exchange: Q] [Last traded size: 27] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Quote Tick: [Index: 2838] [Time: 2022-01-21T10:00:13.337792402] [Bid price: 163.81] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 4] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6637] [Time: 2022-01-21T10:00:13.337794549] [Last traded price: 163.88] [Last traded exchange: P] [Last traded size: 5] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6638] [Time: 2022-01-21T10:00:13.337794691] [Last traded price: 163.87] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6639] [Time: 2022-01-21T10:00:13.337794904] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 3] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6640] [Time: 2022-01-21T10:00:13.337795046] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6641] [Time: 2022-01-21T10:00:13.337802821] [Last traded price: 163.85] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Type: ticks
Status: ok
Symbol: AAPL_S U
Quote Tick: [Index: 2835] [Time: 2022-01-21T10:00:01.265742794] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: Q] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6626] [Time: 2022-01-21T10:00:02.986469412] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6627] [Time: 2022-01-21T10:00:03.998868509] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 20] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6628] [Time: 2022-01-21T10:00:03.998873260] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 7] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6629] [Time: 2022-01-21T10:00:03.999450924] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 29] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Quote Tick: [Index: 2836] [Time: 2022-01-21T10:00:05.082729164] [Bid price: 163.82] [Ask price: 163.94] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6630] [Time: 2022-01-21T10:00:05.082732879] [Last traded price: 163.93] [Last traded exchange: Q] [Last traded size: 30] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6631] [Time: 2022-01-21T10:00:07.042183294] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 21] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6632] [Time: 2022-01-21T10:00:07.042183412] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Quote Tick: [Index: 2837] [Time: 2022-01-21T10:00:11.993624918] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6633] [Time: 2022-01-21T10:00:12.314534157] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 9] [Trade flags: 194] [Trade conditions: ['37', '12', '0', '0']]
Trade Tick: [Index: 6634] [Time: 2022-01-21T10:00:12.314593373] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 125] [Trade flags: 194] [Trade conditions: ['0', '12', '14', '0']]
Trade Tick: [Index: 6635] [Time: 2022-01-21T10:00:13.337067632] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 73] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Trade Tick: [Index: 6636] [Time: 2022-01-21T10:00:13.337070429] [Last traded price: 163.87] [Last traded exchange: Q] [Last traded size: 27] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Quote Tick: [Index: 2838] [Time: 2022-01-21T10:00:13.337792402] [Bid price: 163.81] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 4] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6637] [Time: 2022-01-21T10:00:13.337794549] [Last traded price: 163.88] [Last traded exchange: P] [Last traded size: 5] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Trade Tick: [Index: 6638] [Time: 2022-01-21T10:00:13.337794691] [Last traded price: 163.87] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Trade Tick: [Index: 6639] [Time: 2022-01-21T10:00:13.337794904] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 3] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Trade Tick: [Index: 6640] [Time: 2022-01-21T10:00:13.337795046] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Trade Tick: [Index: 6641] [Time: 2022-01-21T10:00:13.337802821] [Last traded price: 163.85] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: ['37', '12', '14', '0']]
Type: ticks
Status: ok
Symbol: AAPL_S U
Quote Tick: [Index: 2835] [Time: 1/21/2022 10:00:01 AM] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: Q] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6626] [Time: 1/21/2022 10:00:02 AM] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6627] [Time: 1/21/2022 10:00:03 AM] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 20] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6628] [Time: 1/21/2022 10:00:03 AM] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 7] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6629] [Time: 1/21/2022 10:00:03 AM] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 29] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Quote Tick: [Index: 2836] [Time: 1/21/2022 10:00:05 AM] [Bid price: 163.82] [Ask price: 163.94] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6630] [Time: 1/21/2022 10:00:05 AM] [Last traded price: 163.93] [Last traded exchange: Q] [Last traded size: 30] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6631] [Time: 1/21/2022 10:00:07 AM] [Last traded price: 163.90] [Last traded exchange: P] [Last traded size: 21] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6632] [Time: 1/21/2022 10:00:07 AM] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Quote Tick: [Index: 2837] [Time: 1/21/2022 10:00:11 AM] [Bid price: 163.82] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 2] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6633] [Time: 1/21/2022 10:00:12 AM] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 9] [Trade flags: 194] [Trade conditions: 37,12,0,0]
Trade Tick: [Index: 6634] [Time: 1/21/2022 10:00:12 AM] [Last traded price: 163.89] [Last traded exchange: P] [Last traded size: 125] [Trade flags: 194] [Trade conditions: 0,12,14,0]
Trade Tick: [Index: 6635] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.90] [Last traded exchange: Q] [Last traded size: 73] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6636] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.87] [Last traded exchange: Q] [Last traded size: 27] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Quote Tick: [Index: 2838] [Time: 1/21/2022 10:00:13 AM] [Bid price: 163.81] [Ask price: 163.93] [Bid exchange: P] [Ask exchange: P] [Bid size: 4] [Ask size: 1] [Quote condition: 0]
Trade Tick: [Index: 6637] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.88] [Last traded exchange: P] [Last traded size: 5] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6638] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.87] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6639] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 3] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6640] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.86] [Last traded exchange: P] [Last traded size: 1] [Trade flags: 194] [Trade conditions: 37,12,14,0]
Trade Tick: [Index: 6641] [Time: 1/21/2022 10:00:13 AM] [Last traded price: 163.85] [Last traded exchange: P] [Last traded size: 10] [Trade flags: 194] [Trade conditions: 37,12,14,0]
The Time Series Data Request is a RESTful API endpoint that allows clients to request historical time series data for a specific instrument symbol. The endpoint is accessed by sending a GET or POST request to the URL https://api.activetick.com/ticks.json, along with several required parameters and optional parameters.
The Time Series Data Request Parameters section defines the available parameters for the API request and what each of them represents. The Tick Types section defines the different types of tick records that can be requested.
The Tick data response is the response returned by the API after a successful request. The response contains a JSON object that includes response metadata (type, status, and symbol) and an array of tick records.
The tick array can contain various types of tick records, each distinguished by a unique code which must be parsed first. The rest of the record should then be parsed according to its type.
Time Series Request Endpoint
https://api.activetick.com/ticks.json?sessionid=<sessionid>&symbol=<symbol>&ticktype=<ticktype>&maxrecords=<maxrecords>&begintime=<begintime>&endtime=<endtime>
Time Series Request Parameters
Parameter | Required | Description |
---|---|---|
sessionid | Yes | A valid sessionid value returned from prior authorization. |
symbol | Yes | The symbol of the instrument for which the tick data is requested. |
ticktype | Yes | The type of tick data to be returned, such as trades, quotes, etc. |
maxrecords | Yes | The maximum number of records to return within the specified time range. The limit is 50,000. |
begintime | Yes | The start time for the requested time range, formatted in YYYY-MM-DDThh:mm:ss. |
endtime | Yes | The end time for the requested time range, formatted in YYYY-MM-DDThh:mm:ss. |
Tick Types
Tick Type | Description |
---|---|
trades | Only return trade records. Trade records contain information on all trade transactions. |
extended_trades | Return trade records, along with quote information at the time of the trade transaction. |
quotes | Only return quote records. Quote records contain full bid/ask pricing information. |
both | Return both trade and quote records. This option includes both trade transaction information and bid/ask pricing information. |
Time Series Response
Time series response contains detailed information about the request made, as well as an array of pricing information matching the requested parameters. The response will include information such as the type of data returned, the status of the request, and the original instrument symbol. Additionally, based on the requested tickType, the array may contain different types of items in its response.
The following table lists all the items included in the response:
Name | Description |
---|---|
type | "ticks" |
status | Indicates if the request was completed successfully. Possible values are "ok" and "fail". |
symbol | Original instrument symbol. |
ticks | Array of data ticks consisting of time series data. Each tick item includes information specific to a single trade or quote event, depending on the requested tickType. |
Times Series Records
Quote Tick Record
Example of a single quote tick record:
{
"t":"q",
"i":"2836",
"tm":"2022-01-21T10:00:05.082729164",
"b":"163.82",
"a":"163.94",
"bx":"P",
"ax":"P",
"bz":"2",
"az":"1",
"c":"0"
}
The quote tick record contains bid/ask information for a specific instrument. The information is typically updated whenever new orders are added, updated, or removed on either side of the order book, or after a trade is made and the order is no longer advertised. The tick record includes details such as the bid and ask prices, the exchange on which the bid and ask orders were placed, the size of the bid and ask orders, and any conditions that may be associated with the quote. The following table lists all of the items included in the quote tick record:
Name | Description |
---|---|
t | Type of tick record, set to "q" for quote. |
i | Index of tick record for current day. |
tm | Tick record time, in the format of YYYY-MM-DDThh:mm:ss |
b | Bid price. |
a | Ask price. |
bx | Exchange that the bid price is coming from. |
ax | Exchange that the ask price is coming from. |
bz | Bid size. |
az | Ask size. |
c | Quote condition, such as "regular" or "closed" |
Quote Conditions
Exchange-specific conditions are included in quotes. The following table lists the US-based equity quote conditions and their corresponding values:
Quote Condition | Value |
---|---|
RegularQuote | 0 |
RegularTwoSidedOpenQuote | 1 |
RegularOneSidedOpenQuote | 2 |
SlowAskQuote | 3 |
SlowBidQuote | 4 |
SlowBidAskQuote | 5 |
SlowDueLRPBidQuote | 6 |
SlowDueLRPAskQuote | 7 |
SlowDueNYSELRPQuote | 8 |
SlowDueSetSlowListBidAskQuote | 9 |
ManualAskAutomaticBidQuote | 10 |
ManualBidAutomaticAskQuote | 11 |
ManualBidAndAskQuote | 12 |
OpeningQuote | 13 |
ClosingQuote | 14 |
ClosedQuote | 15 |
ResumeQuote | 16 |
FastTradingQuote | 17 |
TradingRangeIndicationQuote | 18 |
MarketMakerQuotesClosedQuote | 19 |
NonFirmQuote | 20 |
NewsDisseminationQuote | 21 |
OrderInfluxQuote | 22 |
OrderImbalanceQuote | 23 |
DueToRelatedSecurityNewsDisseminationQuote | 24 |
DueToRelatedSecurityNewsPendingQuote | 25 |
AdditionalInformationQuote | 26 |
NewsPendingQuote | 27 |
AdditionalInformationDueToRelatedSecurityQuote | 28 |
DueToRelatedSecurityQuote | 29 |
InViewOfCommonQuote | 30 |
EquipmentChangeoverQuote | 31 |
NoOpenNoResumeQuote | 32 |
SubPennyTradingQuote | 33 |
AutomatedBidNoOfferNoBid | 34 |
LuldPriceBand | 35 |
MarketWideCircuitBreakerLevel1 | 36 |
MarketWideCircuitBreakerLevel2 | 37 |
MarketWideCircuitBreakerLevel3 | 38 |
RepublishedLuldPriceBand | 39 |
IntradayAuction | 40 |
Trade Tick Record
Example of a single trade tick record:
{
"t":"t",
"i":"6636",
"tm":"2022-01-21T10:00:13.337070429",
"l":"163.87",
"x":"Q",
"z":"27",
"f":"194",
"c":["37","12","14","0"]
}
Trade item contains information about a sale transaction. Trades typically get sent by exchanges whenever a match is made between a buyer and seller at specified price and quantity.
Name | Description |
---|---|
t | Type of tick record, set to "t" for trade. |
i | Index of tick record for current day. |
tm | Tick record time. |
l | Last traded price. |
x | Last traded exchange. |
z | Last traded size. |
f | Trade flags. This is an integer value with ORed trade flags. |
c | Array of 4 trade conditions. |
Trade Flags
Trade flags are special indicators that are added by MarketFeed to indicate the presence of certain trade attributes. These flags can be used to denote specific characteristics of a trade event, such as whether the trade price is the highest or lowest of the day, or whether the trade occurred during regular or extended market hours.
Multiple trade flags can exist for a single trade event. For example, a trade's price may be the highest price of the day, and it may also be the opening price at the same time. To accommodate this, MarketFeed combines all possible trade flags into a single integer using bitwise OR. This allows for multiple flags to be set for a single trade event.
To check for the existence of a specific flag, a simple bitwise AND check for the trade flag bit can be made. The following table lists all the trade flags, their values and descriptions:
Trade Flag | Value | Description |
---|---|---|
RegularMarketLastPrice | 0x1 | Indicates that the last trade price is valid and occurred during regular trading hours. |
RegularMarketVolume | 0x2 | Indicates that the last trade size is valid and occurred during regular trading hours. |
HighPrice | 0x4 | Indicates that the last trade price is the highest price of the day, and occurred during regular trading hours. |
LowPrice | 0x8 | Indicates that the last trade price is the lowest price of the day, and occurred during regular trading hours. |
DayHighPrice | 0x10 | Indicates that the last trade price is the highest price of the day, and occurred during both regular and extended trading hours. |
DayLowPrice | 0x20 | Indicates that the last trade price is the lowest price of the day, and occurred during both regular and extended trading hours. |
ExtendedMarketLastPrice | 0x40 | Indicates that the last trade price is valid and occurred during extended trading hours. |
PreMarketVolume | 0x80 | Indicates that the last trade size is valid and occurred during pre-market extended trading hours. |
AfterMarketVolume | 0x100 | Indicates that the last trade size is valid and occurred during after-market extended trading hours. |
ClosePrice | 0x200 | Indicates that the last trade price is the closing price for the current trading session. |
OpenPrice | 0x400 | Indicates that the last trade price is the opening price for the current trading session. |
Trade Conditions
Trade conditions are exchange-specific values that provide additional information about a trade event. These conditions can include information such as whether the trade was executed during regular or extended trading hours, if it was a block trade, or if it was a trade that occurred at the opening or closing of the market. A single trade event can contain up to 4 different trade conditions, depending on the exchange. These conditions can be used to provide a more detailed understanding of the trade, and can be useful in analyzing market activity.
Trade Condition | Value |
---|---|
RegularTrade | 0 |
AcquisitionTrade | 1 |
AveragePriceTrade | 2 |
AutomaticExecutionTrade | 3 |
BunchedTrade | 4 |
BunchSoldTrade | 5 |
CAPElectionTrade | 6 |
CashTrade | 7 |
ClosingTrade | 8 |
CrossTrade | 9 |
DerivativelyPricedTrade | 10 |
DistributionTrade | 11 |
FormTTrade | 12 |
FormTOutOfSequenceTrade | 13 |
InterMarketSweepTrade | 14 |
MarketCenterOfficialCloseTrade | 15 |
MarketCenterOfficialOpenTrade | 16 |
MarketCenterOpeningTrade | 17 |
MarketCenterReOpenningTrade | 18 |
MarketCenterClosingTrade | 19 |
NextDayTrade | 20 |
PriceVariationTrade | 21 |
PriorReferencePriceTrade | 22 |
Rule155AmexTrade | 23 |
Rule127NyseTrade | 24 |
OpeningTrade | 25 |
OpenedTrade | 26 |
RegularStoppedStockTrade | 27 |
ReOpeningTrade | 28 |
SellerTrade | 29 |
SoldLastTrade | 30 |
SoldLastStoppedStockTrade | 31 |
SoldOutOfSequenceTrade | 32 |
SoldOutOfSequenceStoppedStockTrade | 33 |
SplitTrade | 34 |
ContingentTrade | 35 |
YellowFlagTrade | 36 |
OddLotTrade | 37 |
QualifiedContingentTrade | 38 |
CorrectedConsolidatedClosePrice | 39 |
Extended Trade Tick Record
Example of a single extended trade tick record:
{
"t":"t",
"i":"6636",
"tm":"2022-01-21T10:00:13.337070429",
"l":"163.87",
"x":"Q",
"z":"27",
"f":"194",
"c":["37","12","14","0"],
"b":"163.82",
"a":"163.94",
"bx":"P",
"ax":"P",
"bz":"2",
"az":"1",
"c":"0"
}
Extended trade record contains information about a sale transaction, along with last quote information.
Name | Description |
---|---|
t | Type of tick record, set to "t" for trade. |
i | Index of tick record for current day. |
tm | Tick record time. |
l | Last traded price. |
x | Last traded exchange. |
z | Last traded size. |
f | Trade flags. This is an integer value with ORed trade flags. |
c | Array of 4 trade conditions. |
b | Bid price. |
a | Ask price. |
bx | Exchange that the bid price is coming from. |
ax | Exchange that the ask price is coming from. |
bz | Bid size. |
az | Ask size. |
c | Quote condition, such as "regular" or "closed" |
Dividend Data
Historical dividend data is a record of all dividends that have been paid out by a particular company over a specified period of time. This dataset can be used to track a company's dividend payout history, and can be useful for investment analysis and portfolio management. When accessing this data, it is possible to specify which specific pieces of information (such as ex-dividend date, dividend amount, or record date) should be included in the response by passing a list of relevant columns to the query.
Example dividend history request:
curl -i -X GET 'https://api.activetick.com/dividends.json?sessionid=MY_SESSIONID&symbol=AAPL_S-U&columns=divtype,divamt,divdecldt,divexdt,divrecdt'
var sessionid = "MY_SESSIONID";
var symbol = "AAPL_S-U";
var columns = "divtype,divamt,divdecldt,divexdt,divrecdt";
var url = "https://api.activetick.com/dividends.json?sessionid=" + sessionid + "&symbol=" + symbol + "&columns=" + columns;
$.ajax({
type: "GET",
url: url,
success: function(response) {
var rows = response.rows;
for (var i = 0; i < rows.length; i++) {
var data = rows[i].data;
var rowData = "";
for (var j = 0; j < data.length; j++) {
var column = data[j];
switch (column.c) {
case "divtype":
rowData += "Dividend type: " + column.v + ", ";
break;
case "divamt":
rowData += "Dividend amount: " + column.v + ", ";
break;
case "divdecldt":
rowData += "Date dividend declared: " + column.v + ", ";
break;
case "divexdt":
rowData += "Ex-dividend date: " + column.v + ", ";
break;
case "divrecdt":
rowData += "Record date: " + column.v + ", ";
break;
case "divpaydt":
rowData += "Dividend payment date: " + column.v;
break;
default:
rowData += "Unknown column: " + column.c;
break;
}
}
console.log(rowData);
}
}
});
import requests
session_id = "MY_SESSIONID"
symbol = "AAPL_S-U"
columns = "divtype,divamt,divdecldt,divexdt,divrecdt"
url = f"https://api.activetick.com/dividends.json?sessionid={session_id}&symbol={symbol}&columns={columns}"
response = requests.get(url).json()
rows = response["rows"]
for row in rows:
data = row["data"]
row_data = ""
for column in data:
if column["c"] == "divtype":
row_data += f"Dividend type: {column['v']}, "
elif column["c"] == "divamt":
row_data += f"Dividend amount: {column['v']}, "
elif column["c"] == "divdecldt":
row_data += f"Date dividend declared: {column['v']}, "
elif column["c"] == "divexdt":
row_data += f"Ex-dividend date: {column['v']}, "
elif column["c"] == "divrecdt":
row_data += f"Record date: {column['v']}, "
elif column["c"] == "divpaydt":
row_data += f"Dividend payment date: {column['v']}"
else:
row_data += f"Unknown column: {column['c']}"
print(row_data)
using System;
using System.Net;
using System.IO;
using Newtonsoft.Json;
namespace ActiveTickAPI
{
class Program
{
static void Main(string[] args)
{
string sessionID = "MY_SESSIONID";
string symbol = "AAPL_S-U";
string columns = "divtype,divamt,divdecldt,divexdt,divrecdt";
string url = "https://api.activetick.com/dividends.json?sessionid=" + sessionID + "&symbol=" + symbol + "&columns=" + columns;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string json;
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
json = reader.ReadToEnd();
}
var dividendData = JsonConvert.DeserializeObject<DividendData>(json);
foreach (var row in dividendData.rows)
{
string rowData = "";
foreach (var data in row.data)
{
switch (data.c)
{
case "divtype":
rowData += "Dividend type: " + data.v + ", ";
break;
case "divamt":
rowData += "Dividend amount: " + data.v + ", ";
break;
case "divdecldt":
rowData += "Date dividend declared: " + data.v + ", ";
break;
case "divexdt":
rowData += "Ex-dividend date: " + data.v + ", ";
break;
case "divrecdt":
rowData += "Record date: " + data.v + ", ";
break;
case "divpaydt":
rowData += "Dividend payment date: " + data.v;
break;
default:
rowData += "Unknown column: " + data.c;
break;
}
}
Console.WriteLine(rowData);
}
Console.ReadLine();
}
}
public class DividendData
{
public Row[] rows { get; set; }
}
public class Row
{
public Data[] data { get; set; }
}
public class Data
{
public string c { get; set; }
public string v { get; set; }
}
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 197
Content-Length: 23214
{
"type":"dividends",
"status":"ok",
"rows":[
{"data":[
{"c":"divtype","s":"ok","v":"1"},
{"c":"divamt","s":"ok","v":"0.220"},
{"c":"divdecldt","s":"ok","v":"2245-03-20T04:11:11.427362816"},
{"c":"divexdt","s":"ok","v":"2021-08-06T00:00:00.000000000"},
{"c":"divrecdt","s":"ok","v":"2021-08-09T00:00:00.000000000"}
]
},
{"data":[
{"c":"divtype","s":"ok","v":"1"},
{"c":"divamt","s":"ok","v":"0.630"},
{"c":"divdecldt","s":"ok","v":"2017-05-02T00:00:00.000000000"},
{"c":"divexdt","s":"ok","v":"2017-05-11T00:00:00.000000000"},
{"c":"divrecdt","s":"ok","v":"2017-05-15T00:00:00.000000000"}
]
},
{"data":[
{"c":"divtype","s":"ok","v":"1"},
{"c":"divamt","s":"ok","v":"0.630"},
{"c":"divdecldt","s":"ok","v":"2017-08-01T00:00:00.000000000"},
{"c":"divexdt","s":"ok","v":"2017-08-10T00:00:00.000000000"},
{"c":"divrecdt","s":"ok","v":"2017-08-14T00:00:00.000000000"}
]
},
{"data":[
{"c":"divtype","s":"ok","v":"1"},
{"c":"divamt","s":"ok","v":"0.630"},
{"c":"divdecldt","s":"ok","v":"2017-11-02T00:00:00.000000000"},
{"c":"divexdt","s":"ok","v":"2017-11-10T00:00:00.000000000"},
{"c":"divrecdt","s":"ok","v":"2017-11-13T00:00:00.000000000"}
]
},
{"data":[
{"c":"divtype","s":"ok","v":"1"},
{"c":"divamt","s":"ok","v":"0.630"},
{"c":"divdecldt","s":"ok","v":"2018-02-01T00:00:00.000000000"},
{"c":"divexdt","s":"ok","v":"2018-02-09T00:00:00.000000000"},
{"c":"divrecdt","s":"ok","v":"2018-02-12T00:00:00.000000000"}
]
},
..
..
]
}
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2245-03-20T04:11:11.427362816, Ex-dividend date: 2021-08-06T00:00:00.000000000, Record date: 2021-08-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-05-02T00:00:00.000000000, Ex-dividend date: 2017-05-11T00:00:00.000000000, Record date: 2017-05-15T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-08-01T00:00:00.000000000, Ex-dividend date: 2017-08-10T00:00:00.000000000, Record date: 2017-08-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-11-02T00:00:00.000000000, Ex-dividend date: 2017-11-10T00:00:00.000000000, Record date: 2017-11-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2018-02-01T00:00:00.000000000, Ex-dividend date: 2018-02-09T00:00:00.000000000, Record date: 2018-02-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-05-01T00:00:00.000000000, Ex-dividend date: 2018-05-11T00:00:00.000000000, Record date: 2018-05-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-07-31T00:00:00.000000000, Ex-dividend date: 2018-08-10T00:00:00.000000000, Record date: 2018-08-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-11-01T00:00:00.000000000, Ex-dividend date: 2018-11-08T00:00:00.000000000, Record date: 2018-11-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2019-01-29T00:00:00.000000000, Ex-dividend date: 2019-02-08T00:00:00.000000000, Record date: 2019-02-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-04-30T00:00:00.000000000, Ex-dividend date: 2019-05-10T00:00:00.000000000, Record date: 2019-05-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-07-30T00:00:00.000000000, Ex-dividend date: 2019-08-09T00:00:00.000000000, Record date: 2019-08-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-10-30T00:00:00.000000000, Ex-dividend date: 2019-11-07T00:00:00.000000000, Record date: 2019-11-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2020-01-28T00:00:00.000000000, Ex-dividend date: 2020-02-07T00:00:00.000000000, Record date: 2020-02-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-04-30T00:00:00.000000000, Ex-dividend date: 2020-05-08T00:00:00.000000000, Record date: 2020-05-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-07-30T00:00:00.000000000, Ex-dividend date: 2020-08-07T00:00:00.000000000, Record date: 2020-08-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2020-10-29T00:00:00.000000000, Ex-dividend date: 2020-11-06T00:00:00.000000000, Record date: 2020-11-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2021-01-27T00:00:00.000000000, Ex-dividend date: 2021-02-05T00:00:00.000000000, Record date: 2021-02-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-04-28T00:00:00.000000000, Ex-dividend date: 2021-05-07T00:00:00.000000000, Record date: 2021-05-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-10-28T00:00:00.000000000, Ex-dividend date: 2021-11-05T00:00:00.000000000, Record date: 2021-11-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2022-01-27T00:00:00.000000000, Ex-dividend date: 2022-02-04T00:00:00.000000000, Record date: 2022-02-07T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-04-28T00:00:00.000000000, Ex-dividend date: 2022-05-06T00:00:00.000000000, Record date: 2022-05-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-07-28T00:00:00.000000000, Ex-dividend date: 2022-08-07T00:00:00.000000000, Record date: 2022-08-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-10-27T00:00:00.000000000, Ex-dividend date: 2022-11-06T00:00:00.000000000, Record date: 2022-11-07T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2245-03-20T04:11:11.427362816, Ex-dividend date: 2021-08-06T00:00:00.000000000, Record date: 2021-08-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-05-02T00:00:00.000000000, Ex-dividend date: 2017-05-11T00:00:00.000000000, Record date: 2017-05-15T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-08-01T00:00:00.000000000, Ex-dividend date: 2017-08-10T00:00:00.000000000, Record date: 2017-08-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-11-02T00:00:00.000000000, Ex-dividend date: 2017-11-10T00:00:00.000000000, Record date: 2017-11-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2018-02-01T00:00:00.000000000, Ex-dividend date: 2018-02-09T00:00:00.000000000, Record date: 2018-02-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-05-01T00:00:00.000000000, Ex-dividend date: 2018-05-11T00:00:00.000000000, Record date: 2018-05-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-07-31T00:00:00.000000000, Ex-dividend date: 2018-08-10T00:00:00.000000000, Record date: 2018-08-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-11-01T00:00:00.000000000, Ex-dividend date: 2018-11-08T00:00:00.000000000, Record date: 2018-11-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2019-01-29T00:00:00.000000000, Ex-dividend date: 2019-02-08T00:00:00.000000000, Record date: 2019-02-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-04-30T00:00:00.000000000, Ex-dividend date: 2019-05-10T00:00:00.000000000, Record date: 2019-05-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-07-30T00:00:00.000000000, Ex-dividend date: 2019-08-09T00:00:00.000000000, Record date: 2019-08-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-10-30T00:00:00.000000000, Ex-dividend date: 2019-11-07T00:00:00.000000000, Record date: 2019-11-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2020-01-28T00:00:00.000000000, Ex-dividend date: 2020-02-07T00:00:00.000000000, Record date: 2020-02-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-04-30T00:00:00.000000000, Ex-dividend date: 2020-05-08T00:00:00.000000000, Record date: 2020-05-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-07-30T00:00:00.000000000, Ex-dividend date: 2020-08-07T00:00:00.000000000, Record date: 2020-08-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2020-10-29T00:00:00.000000000, Ex-dividend date: 2020-11-06T00:00:00.000000000, Record date: 2020-11-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2021-01-27T00:00:00.000000000, Ex-dividend date: 2021-02-05T00:00:00.000000000, Record date: 2021-02-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-04-28T00:00:00.000000000, Ex-dividend date: 2021-05-07T00:00:00.000000000, Record date: 2021-05-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-10-28T00:00:00.000000000, Ex-dividend date: 2021-11-05T00:00:00.000000000, Record date: 2021-11-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2022-01-27T00:00:00.000000000, Ex-dividend date: 2022-02-04T00:00:00.000000000, Record date: 2022-02-07T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-04-28T00:00:00.000000000, Ex-dividend date: 2022-05-06T00:00:00.000000000, Record date: 2022-05-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-07-28T00:00:00.000000000, Ex-dividend date: 2022-08-07T00:00:00.000000000, Record date: 2022-08-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-10-27T00:00:00.000000000, Ex-dividend date: 2022-11-06T00:00:00.000000000, Record date: 2022-11-07T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2245-03-20T04:11:11.427362816, Ex-dividend date: 2021-08-06T00:00:00.000000000, Record date: 2021-08-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-05-02T00:00:00.000000000, Ex-dividend date: 2017-05-11T00:00:00.000000000, Record date: 2017-05-15T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-08-01T00:00:00.000000000, Ex-dividend date: 2017-08-10T00:00:00.000000000, Record date: 2017-08-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2017-11-02T00:00:00.000000000, Ex-dividend date: 2017-11-10T00:00:00.000000000, Record date: 2017-11-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.630, Date dividend declared: 2018-02-01T00:00:00.000000000, Ex-dividend date: 2018-02-09T00:00:00.000000000, Record date: 2018-02-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-05-01T00:00:00.000000000, Ex-dividend date: 2018-05-11T00:00:00.000000000, Record date: 2018-05-14T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-07-31T00:00:00.000000000, Ex-dividend date: 2018-08-10T00:00:00.000000000, Record date: 2018-08-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2018-11-01T00:00:00.000000000, Ex-dividend date: 2018-11-08T00:00:00.000000000, Record date: 2018-11-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.730, Date dividend declared: 2019-01-29T00:00:00.000000000, Ex-dividend date: 2019-02-08T00:00:00.000000000, Record date: 2019-02-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-04-30T00:00:00.000000000, Ex-dividend date: 2019-05-10T00:00:00.000000000, Record date: 2019-05-13T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-07-30T00:00:00.000000000, Ex-dividend date: 2019-08-09T00:00:00.000000000, Record date: 2019-08-12T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2019-10-30T00:00:00.000000000, Ex-dividend date: 2019-11-07T00:00:00.000000000, Record date: 2019-11-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.770, Date dividend declared: 2020-01-28T00:00:00.000000000, Ex-dividend date: 2020-02-07T00:00:00.000000000, Record date: 2020-02-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-04-30T00:00:00.000000000, Ex-dividend date: 2020-05-08T00:00:00.000000000, Record date: 2020-05-11T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.820, Date dividend declared: 2020-07-30T00:00:00.000000000, Ex-dividend date: 2020-08-07T00:00:00.000000000, Record date: 2020-08-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2020-10-29T00:00:00.000000000, Ex-dividend date: 2020-11-06T00:00:00.000000000, Record date: 2020-11-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.2050, Date dividend declared: 2021-01-27T00:00:00.000000000, Ex-dividend date: 2021-02-05T00:00:00.000000000, Record date: 2021-02-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-04-28T00:00:00.000000000, Ex-dividend date: 2021-05-07T00:00:00.000000000, Record date: 2021-05-10T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2021-10-28T00:00:00.000000000, Ex-dividend date: 2021-11-05T00:00:00.000000000, Record date: 2021-11-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.220, Date dividend declared: 2022-01-27T00:00:00.000000000, Ex-dividend date: 2022-02-04T00:00:00.000000000, Record date: 2022-02-07T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-04-28T00:00:00.000000000, Ex-dividend date: 2022-05-06T00:00:00.000000000, Record date: 2022-05-09T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-07-28T00:00:00.000000000, Ex-dividend date: 2022-08-07T00:00:00.000000000, Record date: 2022-08-08T00:00:00.000000000,
Dividend type: 1, Dividend amount: 0.230, Date dividend declared: 2022-10-27T00:00:00.000000000, Ex-dividend date: 2022-11-06T00:00:00.000000000, Record date: 2022-11-07T00:00:00.000000000,
Dividend Request Endpoint
https://api.activetick.com/dividends.json?sessionid=sessionid&symbol=<symbol>&columns=<column1,column2>
Request Parameters
The parameters listed below are required for querying historical dividend data.
Parameter | Required | Description |
---|---|---|
sessionid | yes | A valid sessionid value obtained from previous authorization |
symbol | yes | The symbol of the instrument for which dividend data is being requested |
columns | yes | A list of dividend columns to include in the data returned |
Dividend Columns
Data Column Id | Description |
---|---|
divtype | The type of dividend, which can be one of the following: monthly, quarterly, or annual |
divamt | The amount of the dividend payment |
divdecldt | The date on which the dividend was declared |
divexdt | The date on which the stock will go ex-dividend, meaning that any shares purchased on or after this date will not receive the dividend payment |
divrecdt | The date on which a shareholder must be on the company's record to be eligible for the dividend payment |
divpaydt | The date on which the dividend payment will be made to shareholders who are eligible for the payment. |
Dividend Data Response
The response from querying the historical dividend data API will include several pieces of information to provide context and indicate the status of the request. This information includes:
Name | Description |
---|---|
type | The type of data being returned, in this case "dividends" |
status | Indicates if the request completed successfully. The possible values for this field are "ok" and "fail". |
rows | An array of data rows for each requested instrument symbol. Each data row will contain an array of information for each requested dividend column. |
Within the rows array, each data element will have the following fields:
Name | Description |
---|---|
c | The data column id, corresponding to the column requested in the original API call. |
s | The status of the data column. The possible values for this field are "ok" and "fail". |
v | The actual data value for the column. |
Streaming Data
The MarketFeed API allows clients to stream real-time market data using standard HTTP protocol. To initiate a data stream, a client sends a subscription request, which is a standard HTTP GET or POST request, to a specified endpoint on the server. The request must include a list of instruments for which the client wants to receive market data. Once the server receives the request, it performs validation checks and, if the request is valid, begins streaming the requested market data to the client.
Since streaming data is an ongoing process, there are some specific requirements that must be met when using the MarketFeed API for streaming data. One of these requirements is the use of chunked transfer encoding, which is a mechanism for streaming data transfer that is available in HTTP version 1.1 and above. In chunked transfer encoding, the data stream is divided into non-overlapping chunks, and each chunk is preceded by its size in bytes. The transmission ends when a zero-length chunk is received. All HTTP streaming responses from the MarketFeed API include a header, Transfer-Encoding: chunked, to indicate that chunked transfer encoding is being used.
Another requirement for streaming data using the API is that all stream subscription requests must include a Connection: Keep-Alive header. This header indicates to the server that the connection should not be closed by the server right after the stream subscription response is sent to the client. If this header is missing, the server will close the stream connection immediately after responding to the request, even if the subscription request is valid.
Additionally, the MarketFeed API periodically sends a heartbeat message with the server's timestamp to validate the connection state. These heartbeat messages can be ignored by the receiver.
Subscribing to Streams
Example subscription request:
curl -i -X GET 'https://api.activetick.com/stream.json?sessionid=MY_SESSIONID&symbols=AAPL_S-U,EUR/USD_CFI,ES_230300_FCU' \
-H "Connection: Keep-Alive"
function splitJSONMessages(chunk) {
const messages = [];
let currentMessage = '';
let openBrackets = 0;
let remainingBytes = chunk.length;
for (let i = 0; i < chunk.length; i++) {
const char = chunk[i];
currentMessage += char;
if (char === '{') {
openBrackets += 1;
}
if (char === '}') {
openBrackets -= 1;
}
if (openBrackets === 0) {
messages.push(currentMessage.trim());
remainingBytes -= currentMessage.length;
currentMessage = '';
}
}
// Return all messages, and remaining bytes in chunk if anything was partial
return {
messages: messages,
remainingBytes: remainingBytes,
};
}
let remainingMessage = '';
fetch('https://api.activetick.com/stream.json?sessionid=MY_SESSIONID&symbols=EUR/JPY_CFI,SPY_S U')
.then(response => {
const reader = response.body.getReader();
function read() {
return reader.read().then(({ value, done }) => {
if (done) {
return;
}
// Process the chunk of data
const chunk = new TextDecoder("utf-8").decode(value);
// Merge any previous partial chunks with new data
const completeChunk = remainingMessage + chunk;
// Split complete chunk into json strings
const result = splitJSONMessages(completeChunk);
// For each message try to parse json object
result.messages.forEach(message => {
try {
if(message.length === 0)
return;
const json = JSON.parse(message);
switch (json.type) {
case 'q':
console.log(`Parsed Quote:`);
console.log(`\tSymbol: ${json.s}`);
console.log(`\tTime: ${json.tm}`);
if (json.so) console.log(`\tSource: ${json.so}`);
if (json.f) console.log(`\tFlags: ${json.f}`);
if (json.co) console.log(`\tQuote Condition: ${json.co}`);
if (json.b) console.log(`\tBid price: ${json.b}`);
if (json.bsz) console.log(`\tBid size: ${json.bsz}`);
if (json.bex) console.log(`\tBid exchange: ${json.bex}`);
if (json.a) console.log(`\tAsk price: ${json.a}`);
if (json.asz) console.log(`\tAsk size: ${json.asz}`);
if (json.aex) console.log(`\tAsk exchange: ${json.aex}`);
break;
case 't':
console.log(`Parsed Trade:`);
console.log(`\tSymbol: ${json.s}`);
console.log(`\tTime: ${json.tm}`);
if (json.so) console.log(`\tSource: ${json.so}`);
if (json.f) console.log(`\tFlags: ${json.f}`);
if (json.co) console.log(`\tConditions: ${json.co}`);
if (json.l) console.log(`\tLast Price: ${json.l}`);
if (json.sz) console.log(`\tLast Size: ${json.sz}`);
if (json.ex) console.log(`\tLast Exchange: ${json.ex}`);
}
} catch (e) {
console.error('Failed to parse JSON:', e);
}
});
// Save anything that's partial into remainingMessage for next read
remainingMessage = completeChunk.substr(completeChunk.length - result.remainingBytes);
return read();
});
}
return read();
});
import requests
import json
url = "https://api.activetick.com/stream.json"
data = {
"sessionid": "MY_SESSIONID",
"symbols": "AAPL_S-U,EUR/USD_CFI,ES_230300_FCU"
}
headers = {
"Connection": "Keep-Alive"
}
response = requests.post(url, data=data, headers=headers, stream=True)
print("Status code: ", response.status_code, " Available Requests Left: ", response.headers["X-Available-Requests-Left"])
for chunk in (response.raw.read_chunked()):
try:
parsed_json = json.loads(chunk)
print(parsed_json)
if parsed_json["type"] == "q":
print("Parsed Quote:")
print("\tSymbol:", parsed_json["s"])
print("\tTime:", parsed_json["tm"])
if "so" in parsed_json:
print("\tSource:", parsed_json["so"])
if "f" in parsed_json:
print("\tFlag:", parsed_json["f"])
if "co" in parsed_json:
print("\tCondition:", parsed_json["co"])
if "b" in parsed_json:
print("\tBid:", parsed_json["b"])
if "bsz" in parsed_json:
print("\tBid Size:", parsed_json["bsz"])
if "bex" in parsed_json:
print("\tBid Exchange:", parsed_json["bex"])
if "a" in parsed_json:
print("\tAsk:", parsed_json["a"])
if "asz" in parsed_json:
print("\tAsk Size:", parsed_json["asz"])
if "aex" in parsed_json:
print("\tAsk Exchange:", parsed_json["aex"])
elif parsed_json["type"] == "t":
print("Parsed Trade:")
print("\tSymbol:", parsed_json["s"])
print("\tTime:", parsed_json["tm"])
if "so" in parsed_json:
print("\tSource:", parsed_json["so"])
if "f" in parsed_json:
print("\tFlag:", parsed_json["f"])
if "co" in parsed_json:
print("\tCondition:", parsed_json["co"])
if "l" in parsed_json:
print("\tLast Price:", parsed_json["l"])
if "sz" in parsed_json:
print("\tLast Size:", parsed_json["sz"])
if "ex" in parsed_json:
print("\tLast Exchange:", parsed_json["ex"])
except Exception as e:
print("An error occurred while parsing the JSON string:", e, chunk)
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using System.Text;
namespace HttpChunkedReader
{
using System;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace ChunkedStreamReader
{
class Program
{
static void Main(string[] args)
{
MainAsync().GetAwaiter().GetResult();
}
static void PrintMessage(string message)
{
dynamic json = JObject.Parse(message);
if (json.type == "q")
{
Console.WriteLine("Message type: Quote");
Console.WriteLine("\tInstrument symbol: " + json.s);
Console.WriteLine("\tTime: " + json.tm);
if (json["so"] != null) Console.WriteLine("\tSource data feed: " + json.so);
if (json["f"] != null) Console.WriteLine("\tQuote flags: " + json.f);
if (json["co"] != null) Console.WriteLine("\tQuote condition: " + json.co);
if (json["b"] != null) Console.WriteLine("\tBid price: " + json.b);
if (json["bsz"] != null) Console.WriteLine("\tBid size: " + json.bsz);
if (json["bex"] != null) Console.WriteLine("\tBid exchange: " + json.bex);
if (json["a"] != null) Console.WriteLine("\tAsk price: " + json.a);
if (json["asz"] != null) Console.WriteLine("\tAsk size: " + json.asz);
if (json["aex"] != null) Console.WriteLine("\tAsk exchange: " + json.aex);
}
else if (json.type == "t")
{
Console.WriteLine("Message type: Trade");
Console.WriteLine("\tInstrument symbol: " + json.s);
Console.WriteLine("\tTime: " + json.tm);
if (json["so"] != null) Console.WriteLine("\tSource data feed: " + json.so);
if (json["f"] != null) Console.WriteLine("\tTrade flags: " + json.f);
if (json["co"] != null) Console.WriteLine("\tTrade conditions: " + string.Join(", ", json.co));
if (json["l"] != null) Console.WriteLine("\tLast price: " + json.l);
if (json["sz"] != null) Console.WriteLine("\tLast size: " + json.sz);
if (json["ex"] != null) Console.WriteLine("\tLast exchange: " + json.ex);
}
}
// This is the MainAsync method that starts the program.
static async Task MainAsync()
{
// Create an instance of HttpClient.
var client = new HttpClient();
// Streaming connections require header "Connection" "Keep-Alive".
client.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
var baseUrl = "https://api.activetick.com/stream.json";
var queryParams = new Dictionary<string, string>
{
{ "sessionid", "MY_SESSIONID" },
{ "symbols", "SPY_S U,AAPL_S U,EUR/USD_CFI,ES_230300_FCU" }
};
// Join the query parameters into a query string.
var queryString = string.Join("&", queryParams.Select(kvp => $"{kvp.Key}={kvp.Value}"));
var url = $"{baseUrl}?{queryString}";
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
var stream = await response.Content.ReadAsStreamAsync();
var buffer = new byte[4096];
var incompleteMessage = string.Empty;
// Read data from the stream continuously.
while (true)
{
var bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length);
// If the stream has no more data to read, break the loop.
if (bytesRead == 0)
break;
var chunk = Encoding.UTF8.GetString(buffer, 0, bytesRead);
// Split the chunk into complete JSON messages and any remaining bytes.
var result = SplitJSONMessages(incompleteMessage + chunk);
// Loop through each complete message and print it.
foreach (var message in result.Messages)
{
if (message.Length > 0)
PrintMessage(message);
}
// Store any remaining bytes for the next read.
incompleteMessage = result.RemainingBytes;
}
}
// SplitJSONMessages method takes in a chunk of string as input
// and returns a tuple of string array and string
static (string[] Messages, string RemainingBytes) SplitJSONMessages(string chunk)
{
var messages = new List<string>();
var currentMessage = string.Empty;
var openBrackets = 0;
// Loop through each character in the chunk
foreach (var c in chunk)
{
currentMessage += c;
if (c == '{')
openBrackets++;
else if (c == '}')
openBrackets--;
// If the open brackets counter reaches 0, it means a complete JSON object has been found
if (openBrackets == 0)
{
// Add the complete JSON object to the list of messages
messages.Add(currentMessage.Trim());
currentMessage = string.Empty;
}
}
// Return the list of messages as an array and the remaining bytes as a string
return (messages.ToArray(), currentMessage);
}
}
}
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
Connection: Keep-Alive
X-Available-Requests-Left: 125
Transfer-Encoding: chunked
{
"type":"stream",
"status":"ok",
"symbols":
[
{"AAPL_S U":"ok"},
{"EUR/USD_CFI":"ok"},
{"ES_230300_FCU":"ok"}
]
}
{
"type":"t",
"s":"ES_230300_FCU",
"tm":"1675221040628055503",
"so":"1",
"f":"3",
"co":["0","0","0","0"],
"l":"4078.75",
"sz":"1",
"ex":"C"
}
{
"type":"q",
"s":"ES_230300_FCU",
"tm":"1675221040628055503",
"so":"1",
"f":"0",
"co":"0",
"b":"4078.75",
"bsz":"1",
"bex":"C",
"a":"4078.75",
"asz":"1",
"aex":"C"
}
{
"type":"q",
"s":"ES_230300_FCU",
"tm":"1675221040628055503",
"asz":"62"
}
Parsed Quote:
Symbol: EUR/JPY_CFI
Time: 1675287423986000000
Source: 80
Flags: 0
Quote Condition: 0
Bid price: 141.74799
Bid size: 0
Bid exchange: F
Ask price: 141.77099
Ask size: 0
Ask exchange: F
Parsed Trade:
Symbol: SPY_S U
Time: 1675287424651903488
Source: 22
Flags: 322
Conditions: 0,0,12,37
Last Price: 411.455
Last Size: 1
Last Exchange: D
Parsed Trade:
Symbol: EUR/JPY_CFI
Time: 1675287425345000000
Source: 80
Flags: 3
Conditions: 0,0,0,0
Last Price: 141.76100
Last Size: 0
Last Exchange: F
Parsed Quote:
Symbol: EUR/JPY_CFI
Time: 1675287425345000000
Bid price: 141.74900
Ask price: 141.77300
Status code: 200 Available Requests Left: 97
{'type': 'stream', 'status': 'ok', 'symbols': [{'AAPL_S U': 'ok'}, {'EUR/USD_CFI': 'ok'}, {'ES_230300_FCU': 'ok'}]}
{'type': 't', 's': 'EUR/USD_CFI', 'tm': '1675223665731000000', 'so': '80', 'f': '3', 'co': ['0', '0', '0', '0'], 'l': '1.08622', 'sz': '0', 'ex': 'F'}
Parsed Trade:
Symbol: EUR/USD_CFI
Time: 1675223665731000000
Source: 80
Flag: 3
Condition: ['0', '0', '0', '0']
Last Price: 1.08622
Last Size: 0
Last Exchange: F
{'type': 'q', 's': 'EUR/USD_CFI', 'tm': '1675223665731000000', 'so': '80', 'f': '0', 'co': '0', 'b': '1.08616', 'bsz': '0', 'bex': 'F', 'a': '1.08629', 'asz': '0', 'aex': 'F'}
Parsed Quote:
Symbol: EUR/USD_CFI
Time: 1675223665731000000
Source: 80
Flag: 0
Condition: 0
Bid: 1.08616
Bid Size: 0
Bid Exchange: F
Ask: 1.08629
Ask Size: 0
Ask Exchange: F
{'type': 't', 's': 'EUR/USD_CFI', 'tm': '1675223665981000000', 'l': '1.08623'}
Parsed Trade:
Symbol: EUR/USD_CFI
Time: 1675223665981000000
Last Price: 1.08623
{'type': 'q', 's': 'EUR/USD_CFI', 'tm': '1675223665981000000', 'b': '1.08617', 'a': '1.08630'}
Message type: Trade
Instrument symbol: SPY_S U
Time: 1675293245861240064
Source data feed: 22
Trade flags: 322
Trade conditions: 0, 0, 12, 37
Last price: 412.305
Last size: 1
Last exchange: D
Message type: Trade
Instrument symbol: EUR/USD_CFI
Time: 1675293245975000000
Source data feed: 80
Trade flags: 3
Trade conditions: 0, 0, 0, 0
Last price: 1.10263
Last size: 0
Last exchange: F
Message type: Quote
Instrument symbol: EUR/USD_CFI
Time: 1675293245975000000
Source data feed: 80
Quote flags: 0
Quote condition: 0
Bid price: 1.10254
Bid size: 0
Bid exchange: F
Ask price: 1.10271
Ask size: 0
Ask exchange: F
In order to initiate a stream subscription with the MarketFeed API, a client sends a GET or POST request to the provided stream.json endpoint. Along with the request, the client must provide a list of instrument symbols for which they would like to receive market data, the type of stream requested, and any additional relevant parameters. Once the subscription request is validated by the server, it will begin streaming the requested market data events to the client.
When passing multiple symbols in the subscription request, they should be separated by a comma, for example symbols=ABC,EFG,XYZ.
Stream Request Endpoint
https://api.activetick.com/stream.json?sessionid=<sessionid>&symbols=<symbol1,symbol2>&type=<type>&source=<source>
Stream Request Parameters
The following table lists the parameters required to initiate a stream request.
Parameter | Required | Description |
---|---|---|
sessionid | yes | Valid sessionid value returned from prior authorization. |
symbols | yes | List of symbols separated by commas. |
type | no | Type of data stream to request. |
source | no | Book source data. Required parameter when requesting book data stream. |
When initiating a stream subscription, an optional type parameter can be included in the request to specify the type of data stream desired. If the type parameter is not included in the request, the server will default to the quotes_and_trades type stream to include full data stream.
Data Stream Types
Type | Description |
---|---|
quotes | BBO quotes-only stream. |
trades | Trades-only stream. |
quotes_and_trades | Full BBO quotes and trades stream. Default value if type is omitted. |
book | Market depth book stream. |
option_greeks | Calculated values for options such as implied volatility, Greeks and NPV. |
Book Stream Sources
Source | Description |
---|---|
totalview | Nasdaq TotalView |
openbook | NYSE Openbook |
otcmarkets | OTC Markets |
cme | CME Exchange |
nymex | NYMEX Exchange |
comex | COMEX Exchange |
cbot | CBOT Exchange |
Stream Response
Name | Description |
---|---|
type | "stream" |
status | Indicates if request completed successfully. See list below for possible statuses.. |
symbols | Array of symbols. The array includes subscription status for each symbol. |
data | Array of messages that will be dynamically received as market events happen. |
Stream Symbol Status
Symbol Status Code | Description |
---|---|
ok | Symbol was successfully subscribed. |
fail | Symbol was not subscribed because the symbol is invalid or lack of permission. |
max_limit_reached | Symbol was not subscribed because maximum limit of subscriptions has been reached. |
Quote Streams
Quote event example:
{
"type":"q",
"s":"AAPL_S U",
"tm":"1643211027608650318",
"so":"23",
"f":"104",
"co":"0",
"b":"161.83",
"bsz":"3",
"bex":"Q",
"a":"161.85",
"asz":"2",
"aex":"P"
}
Quotes contains bid/ask information and typically get updated whenever new orders are added, updated or removed on either side, or after a trade is made and order is no longer advertised.
Quote Message Event
Name | Description |
---|---|
type | "q" (quote) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
so | Source data feed. |
f | Quote flags. |
co | Quote condition. |
b | Bid price. |
bsz | Bid size. |
bex | Bid exchange. |
a | Ask price. |
asz | Ask size. |
aex | Ask exchange. |
Trade Streams
Trade event example:
{
"type":"t",
"s":"AAPL_S U",
"tm":"1665677086613934089",
"so":"23",
"f":"2",
"co":["0","0","0","37"],
"l":"141.215",
"sz":"25",
"ex":"D"
}
Trades contains information about a sale transaction. Trades typically get sent by exchanges whenever a match is made between a buyer and seller at specified price and quantity.
Trade Message Event
Name | Description |
---|---|
type | "t" (trade) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
so | Source data feed. |
f | Trade flags. |
co | Array of 4 trade conditions. |
l | Last price. |
sz | Last size. |
ex | Last exchange. |
Aggregate Book Streams
An aggregate book is a consolidated record of buy and sell orders in a financial market, grouped by price level. Each price level in the book reflects the total number of shares or contracts available at that price, aggregating all orders.
Book streams consist of market events managing the book's state, including add, update, and delete operations for each price level.
Book Add Item Event
Book add item event example:
{
"type":"aba",
"s":"CL_221100_FNU",
"tm":"1665588637520235049",
"x":"b",
"i":"7",
"f":"0",
"q":"10",
"o":"10",
"p":"87.32",
"a":"XNYM"
}
The 'Add item' event is triggered to insert new data into an aggregate book, either due to the placement of a new order at a different price level or modifications to current orders.
Book Add Item Event
Name | Description |
---|---|
type | "aba" (aggregate book add) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
x | Order book side. Possible values are: "a" for ask, "b" for bid sides. |
i | Index at which to add the order. |
f | Flags, reserved for future use. |
q | Quantity of shares/contracts. |
o | Number of orders. Used for aggregated books. |
p | Price level. |
a | Attribution source, can be a market maker, exchange, etc. |
Book Change Item Event
Book change event example:
{
"type":"abc",
"s":"CL_221100_FNU",
"tm":"1665588637520235049",
"x":"b",
"i":"7",
"f":"0",
"q":"10",
"o":"10",
"p":"87.32",
"a":"XNYM"
}
The 'Change Item' event is initiated when updates occur in an aggregate book, such as modifications to order size, price levels, or when orders are added or canceled at the same price level.
Book Change Item Message Event
Name | Description |
---|---|
type | "abc" (aggregate book change) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
x | Order book side. Possible values are: "a" for ask, "b" for bid sides. |
i | Index at which to update the order. |
f | Flags, reserved for future use. |
q | Quantity of shares/contracts. |
o | Number of orders. Used for aggregated books. |
p | Price level. |
a | Attribution source, can be a market maker, exchange, etc. |
Book Delete Item Event
Book delete event example:
{
"type":"abd",
"s":"CL_230100_FNU",
"tm":"1665588637646140029",
"x":"a",
"i":"9",
"f":"0"
}
The 'Delete Item' event is triggered when an existing order is removed from the book due to cancellation or execution, specifically when the last order at a particular price level is removed.
Book Delete Item Message Event
Name | Description |
---|---|
type | "abd" (aggregate book delete) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
x | Order book side. Possible values are: "a" for ask, "b" for bid sides. |
i | Index at which to delete the order. |
f | Flags, reserved for future use. |
Book Delete Range Event
Book delete range event example:
{
"type":"abdr",
"s":"CL_230100_FNU",
"tm":"1665588637646140029",
"x":"a",
"f":"0",
"if":"5",
"it":"8"
}
The 'Delete Range' event is triggered when a range of price levels, spanning from a specified starting price level to an ending price level, is removed from the book.
Book Delete Range Message Event
Name | Description |
---|---|
type | "abdr" (aggregate book delete range) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
x | Order book side. Possible values are: "a" for ask, "b" for bid sides. |
f | Flags, reserved for future use. |
if | Index from which to begin order deletion. |
it | Index to which end order deletion. |
Book Trade Event
Book trade event example:
{
"type":"abt",
"s":"CL_221100_FNU",
"tm":"1665588637678117147",
"f":"0",
"q":"3",
"o":"4",
"ax":"a",
"p":"87.39"
}
Aggregated book trade event is sent whenever a match takes place in the book and trade is executed. The message does not alter the state of the book, except to indicate that a match has occurred. The server sends subsequent messages such as order delete or order change to alter the book.
Book Trade Message Event
Name | Description |
---|---|
type | "abt" (aggregate book trade) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
ax | Order book aggressor side. Possible values are: "a" for ask, "b" for bid sides. |
f | Flags, reserved for future use. |
q | Quantity executed. |
o | Number of orders executed. |
p | Execution price. |
Book Reset Event
Book reset event example:
{
"type":"br",
"s":"CL_221100_FNU",
"tm":"1665598637678117147",
}
The server sends book reset event whenever the book needs to be cleared out. This message is typically sent after market close or before market opens.
Book Reset Message Event
Name | Description |
---|---|
type | "br" (book reset) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
Order Book Streams
An order book is a real-time, continuously updated list of buy and sell orders in a market, each listed with its specific details such as price, quantity and order ID. Unlike an aggregate book, an order book displays every individual order, not consolidating orders at the same price level.
Order book stream events are designed to update the book’s state, with additions of new orders, adjustments to existing ones, cancellations, and fills.
Book Add Order Event
Book add order event example:
{
"type":"oba",
"s":"AAPL_S U",
"tm":"1696420901372072120",
"x":"a",
"f":"0",
"q":"100",
"id":"196391177",
"p":"176.40",
"a":"NSDQ"
}
An Add Order event indicates that a new order has been accepted by the exchange and was added to the displayable book. The message includes a day-unique order id used by exchange to track the order.
Add Order Event
Name | Description |
---|---|
type | "oba" (order book add) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
x | Order book side. Possible values are: "a" for ask, "b" for bid sides. |
f | Flags, reserved for future use. |
q | Quantity of shares/contracts. |
id | Order ID, assigned by exchange and unique for each order. |
p | Order price. |
a | Attribution source, can be a market maker, exchange, etc. |
Book Fill Order Event
Book fill order event example:
{
"type":"obf",
"s":"AAPL_S U",
"tm":"1696420901512321564",
"f":"1",
"q":"100",
"id":"196392825",
"mid":"5652548",
"p":"0"
}
Order Fill event is sent whenever an order on the book is executed in whole or in part. It is possible to receive several order fills for the same order id number if that order is executed in several parts. The multiple order fills on the same order are cumulative.
When the number of display quantity for an order reaches zero, the order is dead and should be removed from the book.
It is possible to have an order fill with a different price than original order. In this case, the order price field will contain the price of the fill. These fills may be marked as non-printable. If the order fill is marked as non-printed, it means that the quantity will be included into a later bulk print (e.g., in the case of cross executions).
Fill Order Event
Name | Description |
---|---|
type | "obf" (order book fill) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
f | Flags, reserved for future use. |
q | Quantity of shares/contracts filled. |
id | Order ID, assigned by exchange and unique for each order. |
mid | Match ID, assigned by exchange, and can be referenced in Order Break event. |
p | Price at which the order is filled. If not set, the fill is at the same price as the original order. |
Fill Flags
Name | Value | Description |
---|---|---|
IsPrintable | 0x1 | Indicates that quantity is printable, and should be included in time&sales calculations. |
IsNonDisplayableOrder | 0x2 | Indicates that original order was a non-displayable order. |
OpeningCross | 0x4 | Indicates that the fill is an opening cross-trade event. |
ClosingCross | 0x8 | Indicates that the fill is a closing cross-trade event. |
HaltCross | 0x10 | Indicates that the fill is a halting cross-trade event. |
Book Cancel Order Event
Book cancel order event example:
{
"type":"obc",
"s":"AAPL_S U",
"tm":"1696420901377281798",
"f":"0",
"id":"196389645"
}
Cancel Order is sent whenever an order on the book is modified as a result of a partial cancellation.
Cancel Order Event
Name | Description |
---|---|
type | "obc" (order book cancel) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
f | Flags, reserved for future use. |
id | Order ID, assigned by exchange and unique for each order. |
Book Delete Order Event
Book delete order event example:
{
"type":"obd",
"s":"AAPL_S U",
"tm":"1696420901377281798",
"f":"0",
"id":"196389645"
}
Delete Order is sent whenever an order on the book is being cancelled. All remaining quantity is no longer accessible so the order must be removed from the book.
Delete Order Event
Name | Description |
---|---|
type | "obd" (order book delete) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
f | Flags, reserved for future use. |
id | Order ID, assigned by exchange and unique for each order. |
Book Replace Order Event
Book replace order event example:
{
"type":"obr",
"s":"AAPL_S U",
"tm":"1696420901512793085",
"f":"0",
"oid":"196393973",
"nid":"196394037",
"nq":"100",
"np":"176.36"
}
Order Replace is sent whenever an order on the book has been cancel-replaced. All remaining quantity from the original order are no longer accessible, and must be removed. The new order details are provided for the replacement, along with a new order id which will be used henceforth.
Replace Order Event
Name | Description |
---|---|
type | "obr" (order book replace) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
f | Flags, reserved for future use. |
oid | Original Order ID, assigned by exchange and unique for each order. |
nid | New Order ID. |
nq | New quantity. |
np | New price. |
Book Break Order Event
Book break order event example:
{
"type":"obb",
"s":"AAPL_S U",
"tm":"1696420901377281798",
"f":"0",
"mid":"196389645"
}
The Broken Trade event is sent whenever a fill on is broken. A fill may be broken if it is found to be “clearly erroneous”. A trade break is final, once a trade is broken, it cannot be reinstated.
Break Order Event
Name | Description |
---|---|
type | "obb" (order book break) |
s | Instrument symbol. |
tm | Time of event in UTC epoch nanoseconds. |
f | Flags, reserved for future use. |
mid | Match ID, assigned by exchange for each order fill. |
Option Greeks Streams
Option Greeks are updates that are periodically calculated by the server and sent to subscribed clients who have requested the "option_greeks" stream. The updates contain option theoretical net present value (NPV), implied volatility, and various Greeks like delta, gamma, theta, vega, and rho. These values are recalculated whenever there's a change in the underlying pricing or a change in the pricing of the option contract.
Option greeks event example:
{
"type":"og",
"s":"AAPL_230915C16000C_O U",
"npv":"14.4204",
"delta":"0.548258",
"gamma":"0.011089",
"rho":"0.351251",
"vega":"0.436656",
"iv":"0.323233"
}
Option greeks update is sent whenever a new calculation is made by the server based on underlying and option contract pricing changes.
Option Greeks Event
Name | Description |
---|---|
type | "og" (option greeks) |
s | Option contract symbol. |
npv | Net Present Value (NPV). |
delta | Delta greek value. |
gamma | Gamma greek value. |
rho | Rho greek value. |
vega | Vega greek value. |
iv | Implied Volatility value. |
Heartbeats
Heartbeat event example:
{
"type": "hb",
"time": "1643211357"
}
Heartbeats are sent periodically by the server to ensure validity of established connection.
Heartbeat Message Event
Name | Description |
---|---|
type | "hb" |
time | Time in UTC epoch seconds. |
Chains
About Chains
Instrument chains are a way to retrieve a list of financial instruments that are linked to a specific key, such as a stock symbol. The data returned from the instrument chain request is similar to a snapshot request, and includes rows of instruments linked to the specified key, along with the requested data columns.
For example, when a user inputs a stock symbol as the key, the instrument chain will return a list of all option contracts that are linked to that stock. The resulting data includes information such as strike prices, expiration dates, and open interest. This information can be useful for options traders who need to access a comprehensive view of all the option contracts related to a specific underlying asset.
ActiveTick MarketFeed API supports various types of chains, including:
Chain Type | Description |
---|---|
Equity Options | A list of options contracts linked to an underlying equity security. |
Futures | A list of futures contracts linked to a specific underlying commodity or financial instrument. |
Future Options | A list of options contracts that are based on a futures contract. |
Future Option Spreads | A list of option spreads that are based on a futures contract. |
Future Mixed Spreads | A list of mixed spreads that are based on a futures contract. |
Future Spreads | A list of spreads that are based on a futures contract. |
Future Spread Legs | A list of legs that make up a spread based on a futures contract. |
Option chain request example:
curl -i -X POST https://api.activetick.com/chain.json \
-i -d 'sessionid=MY_SESSIONID&key=JNJ_S U&chaintype=equity_options&columns=pc,l,b,a,bsz,asz,vol,ltm&begin_maturity_time=2023-02-01T00:00:00&end_maturity_time=2023-02-10T00:00:00&ignore_empty=true'
// Define session ID, symbols, chain type and columns
const sessionId = "MY_SESSIONID";
const key = "JNJ_S U";
const chainType = "equity_options";
const columns = "pc,l,b,a,bsz,asz,v,ltm";
const beginMaturityTime = "2023-02-01T00:00:00";
const endMaturityTime = "2023-02-10T00:00:00";
const ignoreEmpty = "true";
// Define chain API endpoint URL
const url = "https://api.activetick.com/chain.json";
// Make a POST request to chain API endpoint
$.ajax({
type: "POST",
url: url,
data: {
sessionid: sessionId,
key: key,
chaintype: chainType,
columns: columns,
begin_maturity_time: beginMaturityTime,
end_maturity_time: endMaturityTime,
ignore_empty: ignoreEmpty
},
success: function (response) {
console.log(response);
// Iterate through response rows
response.rows.forEach(function (row) {
console.log("Symbol: " + row.s);
console.log(" Status: " + row.st);
// Iterate through data in each row
row.data.forEach(function (data) {
if (data.c === 'pc')
console.log("\tPrevious Close: " + data.v);
else if (data.c === 'l')
console.log("\tLast Trade Price: " + data.v);
else if (data.c === 'b')
console.log("\tBid Price: " + data.v);
else if (data.c === 'a')
console.log("\tAsk Price: " + data.v);
else if (data.c === 'bsz')
console.log("\tBid Size: " + data.v);
else if (data.c === 'asz')
console.log("\tAsk Size: " + data.v);
else if (data.c === 'v')
console.log("\tVolume: " + data.v);
else if (data.c === 'ltm')
console.log("\tLast Trade Time: " + data.v);
});
});
},
error: function (error) {
console.log(error);
},
});
import requests
# Define session ID, symbols and columns
session_id = "MY_SESSIONID"
key = "JNJ_S U"
chaintype = "equity_options"
columns = "pc,l,b,a,bsz,asz,vol,ltm"
begin_maturity_time = "2023-02-01T00:00:00"
end_maturity_time = "2023-02-10T00:00:00"
ignore_empty = "true"
# Define snapshot API endpoint URL
url = "https://api.activetick.com/chain.json"
payload = {
"sessionid": session_id,
"key": key,
"chaintype": chaintype,
"columns": columns,
"begin_maturity_time": begin_maturity_time,
"end_maturity_time": end_maturity_time,
"ignore_empty": ignore_empty
}
# Make a GET request to snapshot API endpoint
response = requests.post(url, data=payload)
# Check if request was successful
if response.status_code == 200:
# Parse response json
data = response.json()
# Iterate through response rows
rows = data.get("rows")
for row in rows:
symbol = row.get("s")
status = row.get("st")
print("Symbol:", symbol)
print("Status:", status)
data_list = row.get("data")
# Iterate through data in each row
for data_item in data_list:
col = data_item.get("c")
val = data_item.get("v")
if col == "pc":
print("\tPrevious Close:", val)
elif col == "l":
print("\tLast Trade Price:", val)
elif col == "b":
print("\tBid Price:", val)
elif col == "a":
print("\tAsk Price:", val)
elif col == "bsz":
print("\tBid Size:", val)
elif col == "asz":
print("\tAsk Size:", val)
elif col == "v":
print("\tVolume:", val)
elif col == "ltm":
print("\tLast Trade Time:", val)
else:
print("Request failed with status code:", response.status_code)
using System;
using System.Net;
using Newtonsoft.Json;
namespace ChainRequest
{
class Program
{
static void Main(string[] args)
{
// Define session ID
string sessionId = "MY_SESSIONID";
// Define request parameters
string key = "JNJ_S U";
string chainType = "equity_options";
string columns = "pc,l,b,a,bsz,asz,vol,ltm";
string beginMaturityTime = "2023-02-01T00:00:00";
string endMaturityTime = "2023-02-10T00:00:00";
string ignoreEmpty = "true";
// Define request URL
string requestUrl = $"https://api.activetick.com/chain.json?sessionid={sessionId}&key={key}&chaintype={chainType}&columns={columns}&begin_maturity_time={beginMaturityTime}&end_maturity_time={endMaturityTime}&ignore_empty={ignoreEmpty}";
// Send request to API and get response
using (WebClient client = new WebClient())
{
// Get response as string
string response = client.DownloadString(requestUrl);
// Parse response as JSON
dynamic data = JsonConvert.DeserializeObject(response);
// Access data in JSON
Console.WriteLine("Type: " + data.type);
Console.WriteLine("Status: " + data.status);
Console.WriteLine("Key: " + data.key);
foreach (var row in data.rows)
{
Console.WriteLine("\nSymbol: " + row.s);
Console.WriteLine("Status: " + row.st);
foreach (var item in row.data)
{
if (item.c == "pc")
Console.WriteLine("\tPrevious Close: " + item.v);
else if (item.c == "l")
Console.WriteLine("\tLast Trade Price: " + item.v);
else if (item.c == "b")
Console.WriteLine("\tBid Price: " + item.v);
else if (item.c == "a")
Console.WriteLine("\tAsk Price: " + item.v);
else if (item.c == "bsz")
Console.WriteLine("\tBid Size: " + item.v);
else if (item.c == "asz")
Console.WriteLine("\tAsk Size: " + item.v);
else if (item.c == "vol")
Console.WriteLine("\tVolume: " + item.v);
else if (item.c == "ltm")
Console.WriteLine("\tLast Trade Time: " + item.v);
}
}
}
Console.ReadLine();
}
}
}
Reponse example:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 196
Content-Length: 69203
{
"type":"chain",
"status":"ok",
"key":"JNJ_S U",
"rows":[
{"s":"JNJ_230203C10000C_O U","st":"ok","data":[
{"c":"pc","s":"ok","v":"0"},
{"c":"l","s":"ok","v":"0"},
{"c":"b","s":"ok","v":"64.50"},
{"c":"a","s":"ok","v":"65.40"},
{"c":"bsz","s":"ok","v":"37"},
{"c":"asz","s":"ok","v":"36"},
{"c":"ltm","s":"ok","v":"0000-00-00T00:00:00.000000000"}
]
},
{"s":"JNJ_230203C10500C_O U","st":"ok","data":[
{"c":"pc","s":"ok","v":"0"},
{"c":"l","s":"ok","v":"0"},
{"c":"b","s":"ok","v":"59.50"},
{"c":"a","s":"ok","v":"60.30"},
{"c":"bsz","s":"ok","v":"36"},
{"c":"asz","s":"ok","v":"39"},
{"c":"ltm","s":"ok","v":"0000-00-00T00:00:00.000000000"}
]
},
{"s":"JNJ_230203C11000C_O U","st":"ok","data":[
{"c":"pc","s":"ok","v":"58.75"},
{"c":"l","s":"ok","v":"58.75"},
{"c":"b","s":"ok","v":"54.50"},
{"c":"a","s":"ok","v":"55.30"},
{"c":"bsz","s":"ok","v":"37"},
{"c":"asz","s":"ok","v":"18"},
{"c":"ltm","s":"ok","v":"2023-01-27T19:56:00.848242944"}
]
},
{"s":"JNJ_230203C11500C_O U","st":"ok","data":[
{"c":"pc","s":"ok","v":"0"},
{"c":"l","s":"ok","v":"0"},
{"c":"b","s":"ok","v":"49.45"},
{"c":"a","s":"ok","v":"50.35"},
{"c":"bsz","s":"ok","v":"39"},
{"c":"asz","s":"ok","v":"37"},
{"c":"ltm","s":"ok","v":"0000-00-00T00:00:00.000000000"}
]
},
..
..
]
}
Symbol: JNJ_230203C10000C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 64.50
Ask Price: 65.40
Bid Size: 37
Ask Size: 36
Volume: 0
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C10500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 59.50
Ask Price: 60.30
Bid Size: 36
Ask Size: 39
Volume: 0
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C11000C_O U
Status: ok
Previous Close: 58.75
Last Trade Price: 58.75
Bid Price: 54.50
Ask Price: 55.30
Bid Size: 37
Ask Size: 18
Volume: 0
Last Trade Time: 2023-01-27T19:56:00.848242944
Symbol: JNJ_230203C11500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 49.45
Ask Price: 50.35
Bid Size: 39
Ask Size: 37
Volume: 0
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C10000C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 64.50
Ask Price: 65.40
Bid Size: 37
Ask Size: 36
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C10500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 59.50
Ask Price: 60.30
Bid Size: 36
Ask Size: 39
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C11000C_O U
Status: ok
Previous Close: 58.75
Last Trade Price: 58.75
Bid Price: 54.50
Ask Price: 55.30
Bid Size: 37
Ask Size: 18
Last Trade Time: 2023-01-27T19:56:00.848242944
Symbol: JNJ_230203C11500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 49.45
Ask Price: 50.35
Bid Size: 39
Ask Size: 37
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C10000C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 64.50
Ask Price: 65.40
Bid Size: 37
Ask Size: 36
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C10500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 59.50
Ask Price: 60.30
Bid Size: 36
Ask Size: 39
Last Trade Time: 0000-00-00T00:00:00.000000000
Symbol: JNJ_230203C11000C_O U
Status: ok
Previous Close: 58.75
Last Trade Price: 58.75
Bid Price: 54.50
Ask Price: 55.30
Bid Size: 37
Ask Size: 18
Last Trade Time: 2023-01-27T19:56:00.848242944
Symbol: JNJ_230203C11500C_O U
Status: ok
Previous Close: 0
Last Trade Price: 0
Bid Price: 49.45
Ask Price: 50.35
Bid Size: 39
Ask Size: 37
Last Trade Time: 0000-00-00T00:00:00.000000000
Chain Request Endpoint
https://api.activetick.com/chain.json?sessionid=<sessionid>&key=<key>&chaintype=<chaintype>&columns=<column1,column2>&begin_maturity_time=<begin_maturity_time>&end_maturity_time=<end_maturity_time>&ignore_empty=<ignore_empty>
Chain Request Parameters
The Chain Request Parameters are used to specify the details of a request to retrieve a list of instruments linked to a certain key. The parameters include:
Parameter | Required | Description |
---|---|---|
sessionid | yes | Valid sessionid value returned from prior authorization. |
key | yes | String key specific to chain type. For option chains, key is underlying symbol. |
chaintype | yes | Type of chain to return. |
columns | yes | List of data columns separated by commas. |
begin_maturity_time | yes | Begin time filter to include maturity dates for contracts. |
end_maturity_time | yes | End time filter to include maturity dates for contracts. |
ignore_empty | no | Ignore empty instruments without data. (true/false) |
begin_maturity_time
and end_maturity_time
parameters are formatted using standard YYYY-MM-DDThh:mm:ss format.
Chain Types and Keys
The different types of chain requests that can be made through the MarketFeed API have specific key formats that must be used in order to retrieve the desired data. These chain types and their corresponding key formats are listed in the table below:
Chain Type | Key Format | Example |
---|---|---|
equity_options | Standard Stock | "AAPL_S U" - Apple Inc Stock |
futures | A_FUT_BC | "ES_FUT_CU" - CME S&P500 eMini, "GC_FUT_XU" - COMEX Gold |
future_options | A_OOF_BC | "ES_OOF_CU" - CME S&P500 eMini |
future_spreads | A_OOF_BC | "ES_OOF_CU" - CME S&P500 eMini |
future_option_spreads | A_OOF_BC | "GC_OOF_XU" - COMEX Gold |
future_mixed_legs | A_MLEG_BC | "GC_MLEG_XU" - COMEX Gold |
In this table, "A" stands for the future group name, such as "ES"; "B" stands for the future exchange code; and "C" stands for the future country code. These key formats must be used in order to properly format the key parameter when making a chain request.
Data Columns: Intraday Pricing | Calculated Data | Option Greeks
Chain Response
The chain response is similar to the Snapshot response in the way that data is returned. The response includes the following fields:
Name | Description |
---|---|
type | "chain" |
status | Indicates if request completed successfully. Possible values are "ok" and "fail". |
key | Original request key. |
rows | Array of data rows for each instrument symbol. |
For each included instrument, the server responds with a row of data which includes information about the row, and the data itself. The following table describes the fields in the data row:
Name | Description |
---|---|
s | Instrument symbol. |
st | Row status code indicating if symbol information was successfully returned. Possible values are "ok" and "fail". |
data | Array of data values for each requested column. |
For each data value, the following table describes the fields in the data array:
Name | Description |
---|---|
c | Data column id. |
s | Data column status. Possible values are "ok" and "fail". |
v | Data value. |
Market Depth
About Market Depth
Market depth order books provide an electronic list of buy and sell orders for a financial instrument sorted by price level. This type of data provides a real-time view of the market's supply and demand. An order book displays the number of shares or contracts being bid and offered at each price point, or market depth. It also identifies the participants behind buy and sell orders.
MarketFeed offers a book snapshot feature that provides dynamically updated list of current orders using the book_snapshot
endpoint. This allows for easy access to real-time order book data, allowing traders and investors to make informed decisions based on the current market conditions.
Depending on the type of order book data feed, the dataset offered can be either aggregated or full order book. With an aggregated order book, all orders at the same price level are grouped together into a single line. This can be useful for quickly identifying the overall market sentiment at a specific price point. On the other hand, a full order book shows all orders individually within each price level. This type of data feed is useful for more advanced traders who want to see all orders in the market and make decisions accordingly.
Aggregate books use an index to track changes at specific price levels, whereas order books employ an orderId identifier for each entry for tracking and modification of individual orders. Snapshot book responses from the book_snapshot endpoint include a book_type identifier, specifying whether the snapshot is for an aggregate or order book.
Market book depth request example:
curl -i -X GET 'https://api.activetick.com/book_snapshot.json?sessionid=MY_SESSIONID&symbol=ES_230300_FCU&source=cme'
$.ajax({
type: "GET",
url: "https://api.activetick.com/book_snapshot.json",
data: {
sessionid: "MY_SESSIONID",
symbol: "ES_230300_FCU",
source: "cme"
},
success: function(data) {
var book = data.book;
for (var i = 0; i < book.length; i++) {
console.log("Side: " + book[i].x + " | Index: " + book[i].i + " | Flags: " + book[i].f + " | Attribution: " + book[i].a + " | Price: " + book[i].p + " | Quantity: " + book[i].q + " | Orders: " + book[i].o + " | Timestamp: " + book[i].tm);
}
}
});
import requests
url = "https://api.activetick.com/book_snapshot.json"
params = {
"sessionid": "MY_SESSIONID",
"symbol": "ES_230300_FCU",
"source": "cme"
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
book = data["book"]
for i in range(len(book)):
entry = book[i]
print(f"Side: {entry['x']} | Index: {entry['i']} | Flags: {entry['f']} | Attribution: {entry['a']} | Price: {entry['p']} | Quantity: {entry['q']} | Orders: {entry['o']} | Timestamp: {entry['tm']}")
else:
print(f"Request failed with status code {response.status_code}")
using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;
namespace BookSnapshotExample
{
class Program
{
static void Main(string[] args)
{
var url = "https://api.activetick.com/book_snapshot.json";
var client = new HttpClient();
var data = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("sessionid", "MY_SESSIONID"),
new KeyValuePair<string, string>("symbol", "ES_230300_FCU"),
new KeyValuePair<string, string>("source", "cme"),
});
var response = client.PostAsync(url, data).Result;
var content = response.Content.ReadAsStringAsync().Result;
var bookData = JsonConvert.DeserializeObject<BookData>(content);
foreach (var book in bookData.book)
{
Console.WriteLine("Side: " + book.x + " | Index: " + book.i + " | Flags: " + book.f + " | Attribution: " + book.a + " | Price: " + book.p + " | Quantity: " + book.q + " | Orders: " + book.o + " | Timestamp: " + book.tm);
}
Console.ReadLine();
}
}
class BookData
{
public Book[] book { get; set; }
}
class Book
{
public string x { get; set; }
public int i { get; set; }
public int f { get; set; }
public string a { get; set; }
public double p { get; set; }
public int q { get; set; }
public int o { get; set; }
public string tm { get; set; }
}
}
Response example:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 199
Content-Length: 2266
{
"type":"book_snapshot",
"status":"ok",
"symbol":"ES_230300_FCU",
"book":[
{"x":"b","i":"0","f":"0","a":"XCME","p":"4141.25","q":"24","o":"18","tm":"2023-02-02T01:45:21.874914519"},
{"x":"b","i":"1","f":"0","a":"XCME","p":"4141.00","q":"34","o":"21","tm":"2023-02-02T01:45:24.057874407"},
{"x":"b","i":"2","f":"0","a":"XCME","p":"4140.75","q":"42","o":"25","tm":"2023-02-02T01:45:17.142894949"},
{"x":"b","i":"3","f":"0","a":"XCME","p":"4140.50","q":"37","o":"23","tm":"2023-02-02T01:45:24.304621879"},
{"x":"b","i":"4","f":"0","a":"XCME","p":"4140.25","q":"42","o":"26","tm":"2023-02-02T01:45:16.052969791"},
{"x":"b","i":"5","f":"0","a":"XCME","p":"4140.00","q":"45","o":"26","tm":"2023-02-02T01:45:23.994018383"},
{"x":"b","i":"6","f":"0","a":"XCME","p":"4139.75","q":"41","o":"24","tm":"2023-02-02T01:45:16.178535797"},
{"x":"b","i":"7","f":"0","a":"XCME","p":"4139.50","q":"54","o":"28","tm":"2023-02-02T01:45:05.988063791"},
{"x":"b","i":"8","f":"0","a":"XCME","p":"4139.25","q":"43","o":"25","tm":"2023-02-02T01:45:16.999320993"},
{"x":"b","i":"9","f":"0","a":"XCME","p":"4139.00","q":"64","o":"26","tm":"2023-02-02T01:45:24.282089917"},
{"x":"a","i":"0","f":"0","a":"XCME","p":"4141.75","q":"24","o":"17","tm":"2023-02-02T01:45:24.282475555"},
{"x":"a","i":"1","f":"0","a":"XCME","p":"4142.00","q":"30","o":"16","tm":"2023-02-02T01:45:23.989095319"},
{"x":"a","i":"2","f":"0","a":"XCME","p":"4142.25","q":"40","o":"23","tm":"2023-02-02T01:45:21.874548729"},
{"x":"a","i":"3","f":"0","a":"XCME","p":"4142.50","q":"45","o":"26","tm":"2023-02-02T01:45:24.343821385"},
{"x":"a","i":"4","f":"0","a":"XCME","p":"4142.75","q":"45","o":"23","tm":"2023-02-02T01:45:17.122785059"},
{"x":"a","i":"5","f":"0","a":"XCME","p":"4143.00","q":"45","o":"24","tm":"2023-02-02T01:45:14.304474009"},
{"x":"a","i":"6","f":"0","a":"XCME","p":"4143.25","q":"66","o":"28","tm":"2023-02-02T01:45:24.055875767"},
{"x":"a","i":"7","f":"0","a":"XCME","p":"4143.50","q":"47","o":"24","tm":"2023-02-02T01:45:23.989876031"},
{"x":"a","i":"8","f":"0","a":"XCME","p":"4143.75","q":"52","o":"30","tm":"2023-02-02T01:45:13.707155425"},
{"x":"a","i":"9","f":"0","a":"XCME","p":"4144.00","q":"57","o":"37","tm":"2023-02-02T01:45:24.057464905"}
]
}
Side: b | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4141.50 | Quantity: 7 | Orders: 6 | Timestamp: 2023-02-02T01:51:29.020970333
Side: b | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4141.25 | Quantity: 42 | Orders: 24 | Timestamp: 2023-02-02T01:51:27.064616129
Side: b | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4141.00 | Quantity: 35 | Orders: 22 | Timestamp: 2023-02-02T01:51:15.437831955
Side: b | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4140.75 | Quantity: 43 | Orders: 24 | Timestamp: 2023-02-02T01:51:28.157888911
Side: b | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4140.50 | Quantity: 37 | Orders: 22 | Timestamp: 2023-02-02T01:51:29.012420939
Side: b | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4140.25 | Quantity: 42 | Orders: 26 | Timestamp: 2023-02-02T01:51:12.904874553
Side: b | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4140.00 | Quantity: 46 | Orders: 27 | Timestamp: 2023-02-02T01:51:21.642161359
Side: b | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4139.75 | Quantity: 46 | Orders: 27 | Timestamp: 2023-02-02T01:51:13.153872509
Side: b | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4139.50 | Quantity: 50 | Orders: 28 | Timestamp: 2023-02-02T01:50:44.661083207
Side: b | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4139.25 | Quantity: 40 | Orders: 24 | Timestamp: 2023-02-02T01:51:12.858617651
Side: a | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4141.75 | Quantity: 20 | Orders: 15 | Timestamp: 2023-02-02T01:51:29.020846871
Side: a | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4142.00 | Quantity: 36 | Orders: 24 | Timestamp: 2023-02-02T01:51:15.923227705
Side: a | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4142.25 | Quantity: 62 | Orders: 25 | Timestamp: 2023-02-02T01:51:12.845347455
Side: a | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4142.50 | Quantity: 46 | Orders: 27 | Timestamp: 2023-02-02T01:51:15.437616599
Side: a | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4142.75 | Quantity: 49 | Orders: 26 | Timestamp: 2023-02-02T01:51:15.257865493
Side: a | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4143.00 | Quantity: 48 | Orders: 25 | Timestamp: 2023-02-02T01:51:20.909557481
Side: a | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4143.25 | Quantity: 69 | Orders: 29 | Timestamp: 2023-02-02T01:51:15.257865493
Side: a | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4143.50 | Quantity: 49 | Orders: 27 | Timestamp: 2023-02-02T01:50:44.494568851
Side: a | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4143.75 | Quantity: 52 | Orders: 30 | Timestamp: 2023-02-02T01:51:12.846041043
Side: a | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4144.00 | Quantity: 65 | Orders: 36 | Timestamp: 2023-02-02T01:51:21.801529049
Side: b | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4141.50 | Quantity: 24 | Orders: 16 | Timestamp: 2023-02-02T01:53:32.830651617
Side: b | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4141.25 | Quantity: 40 | Orders: 21 | Timestamp: 2023-02-02T01:53:32.104033449
Side: b | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4141.00 | Quantity: 40 | Orders: 26 | Timestamp: 2023-02-02T01:53:32.097609119
Side: b | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4140.75 | Quantity: 40 | Orders: 21 | Timestamp: 2023-02-02T01:53:32.097301529
Side: b | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4140.50 | Quantity: 34 | Orders: 20 | Timestamp: 2023-02-02T01:53:32.344640123
Side: b | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4140.25 | Quantity: 41 | Orders: 25 | Timestamp: 2023-02-02T01:53:19.396872477
Side: b | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4140.00 | Quantity: 48 | Orders: 28 | Timestamp: 2023-02-02T01:53:32.593631151
Side: b | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4139.75 | Quantity: 42 | Orders: 26 | Timestamp: 2023-02-02T01:53:32.324304603
Side: b | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4139.50 | Quantity: 56 | Orders: 30 | Timestamp: 2023-02-02T01:53:32.100091469
Side: b | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4139.25 | Quantity: 42 | Orders: 24 | Timestamp: 2023-02-02T01:53:19.466958831
Side: a | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4141.75 | Quantity: 17 | Orders: 8 | Timestamp: 2023-02-02T01:53:32.795144711
Side: a | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4142.00 | Quantity: 23 | Orders: 18 | Timestamp: 2023-02-02T01:53:32.786458619
Side: a | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4142.25 | Quantity: 56 | Orders: 21 | Timestamp: 2023-02-02T01:53:26.822773013
Side: a | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4142.50 | Quantity: 49 | Orders: 29 | Timestamp: 2023-02-02T01:53:32.097367857
Side: a | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4142.75 | Quantity: 48 | Orders: 26 | Timestamp: 2023-02-02T01:53:32.097634935
Side: a | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4143.00 | Quantity: 46 | Orders: 25 | Timestamp: 2023-02-02T01:53:32.097293157
Side: a | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4143.25 | Quantity: 65 | Orders: 29 | Timestamp: 2023-02-02T01:53:32.097367857
Side: a | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4143.50 | Quantity: 50 | Orders: 28 | Timestamp: 2023-02-02T01:53:10.217245099
Side: a | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4143.75 | Quantity: 50 | Orders: 30 | Timestamp: 2023-02-02T01:53:19.364823713
Side: a | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4144.00 | Quantity: 64 | Orders: 35 | Timestamp: 2023-02-02T01:53:32.100913883
Side: b | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4143.75 | Quantity: 9 | Orders: 6 | Timestamp: 2023-02-02T01:57:12.278805575
Side: b | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4143.5 | Quantity: 34 | Orders: 24 | Timestamp: 2023-02-02T01:57:11.456701373
Side: b | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4143.25 | Quantity: 43 | Orders: 26 | Timestamp: 2023-02-02T01:57:11.001967271
Side: b | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4143 | Quantity: 46 | Orders: 28 | Timestamp: 2023-02-02T01:57:11.001786423
Side: b | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4142.75 | Quantity: 42 | Orders: 23 | Timestamp: 2023-02-02T01:57:12.461248573
Side: b | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4142.5 | Quantity: 48 | Orders: 27 | Timestamp: 2023-02-02T01:57:12.392067201
Side: b | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4142.25 | Quantity: 45 | Orders: 29 | Timestamp: 2023-02-02T01:57:11.456814439
Side: b | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4142 | Quantity: 50 | Orders: 27 | Timestamp: 2023-02-02T01:57:11.177295869
Side: b | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4141.75 | Quantity: 47 | Orders: 29 | Timestamp: 2023-02-02T01:57:11.001795371
Side: b | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4141.5 | Quantity: 46 | Orders: 30 | Timestamp: 2023-02-02T01:57:11.001801923
Side: a | Index: 0 | Flags: 0 | Attribution: XCME | Price: 4144 | Quantity: 41 | Orders: 27 | Timestamp: 2023-02-02T01:57:11.901369871
Side: a | Index: 1 | Flags: 0 | Attribution: XCME | Price: 4144.25 | Quantity: 48 | Orders: 22 | Timestamp: 2023-02-02T01:57:11.001785041
Side: a | Index: 2 | Flags: 0 | Attribution: XCME | Price: 4144.5 | Quantity: 45 | Orders: 23 | Timestamp: 2023-02-02T01:57:05.816396193
Side: a | Index: 3 | Flags: 0 | Attribution: XCME | Price: 4144.75 | Quantity: 44 | Orders: 24 | Timestamp: 2023-02-02T01:57:11.011585879
Side: a | Index: 4 | Flags: 0 | Attribution: XCME | Price: 4145 | Quantity: 55 | Orders: 34 | Timestamp: 2023-02-02T01:57:05.816397759
Side: a | Index: 5 | Flags: 0 | Attribution: XCME | Price: 4145.25 | Quantity: 45 | Orders: 25 | Timestamp: 2023-02-02T01:57:11.001791147
Side: a | Index: 6 | Flags: 0 | Attribution: XCME | Price: 4145.5 | Quantity: 61 | Orders: 30 | Timestamp: 2023-02-02T01:57:11.001829827
Side: a | Index: 7 | Flags: 0 | Attribution: XCME | Price: 4145.75 | Quantity: 60 | Orders: 27 | Timestamp: 2023-02-02T01:57:00.000401043
Side: a | Index: 8 | Flags: 0 | Attribution: XCME | Price: 4146 | Quantity: 59 | Orders: 33 | Timestamp: 2023-02-02T01:57:05.816996675
Side: a | Index: 9 | Flags: 0 | Attribution: XCME | Price: 4146.25 | Quantity: 61 | Orders: 31 | Timestamp: 2023-02-02T01:57:11.001800913
Market Depth Snapshot Request Endpoint
https://api.activetick.com/book_snapshot.json?sessionid=<sessionid>&symbol=<symbol>&source=<source>
Market Depth Snapshot Request Parameters
Parameter | Required | Description |
---|---|---|
sessionid | yes | Valid sessionid value returned from prior authorization. |
symbol | yes | Instrument symbol. |
source | yes | Book source data. |
Book Sources
A book source parameter is required in order to select data feed source since a single instrument can have multiple order books.
Source | Description |
---|---|
totalview | Nasdaq TotalView |
openbook | NYSE Openbook |
otcmarkets | OTC Markets |
cme | CME Exchange |
nymex | NYMEX Exchange |
comex | COMEX Exchange |
cbot | CBOT Exchange |
Market Depth Snapshot Response
Book snapshot response contains response metadata and an array of orders for each market side.
Name | Description |
---|---|
type | "book_snapshot" |
book_type | Indicates type of book. Possible values are "aggregated" and "order". |
status | Indicates if request completed successfully. Possible values are "ok" and "fail". |
symbol | Original request instrument symbol. |
book | Book array of order book items for each order inside the snapshot. |
Aggregated Book Item
{
"x": "b",
"i": "0",
"f": "0",
"a": "XCME",
"p": "3798.25",
"q": "29",
"o": "13",
"tm": "2022-10-05T20:33:48.658594123"
}
Each aggregated book item contains information about a price level at specific index..
Name | Description |
---|---|
x | Market side for the order. Possible values are "b" for bid, and "a" for ask sides. |
i | Index where the entry should be inserted. |
f | Flags. Exchange-specific flags. |
a | Attribution value. Value can be a market maker, exchange, ETN, etc. |
p | Price. |
q | Share/contract quantity. |
o | Number of orders at current price level for aggregate books. |
tm | Timestamp of last update. The value is formatted in YYYY-MM-DDTHH:MM:SS.nnnnnnnnnn format. |
Order Book Item
{
"x": "b",
"f": "0",
"a": "NSDQ",
"p": "118.25",
"q": "100",
"id": "41231235",
"tm": "2023-10-05T17:23:48.654594523"
}
Each order book item contains information about a single order.
Name | Description |
---|---|
x | Market side for the order. Possible values are "b" for bid, and "a" for ask sides. |
f | Flags. Exchange-specific flags. |
a | Attribution value. Value can be a market maker, exchange, ETN, etc. |
p | Price. |
q | Share/contract quantity. |
id | OrderId. Unique value assigned by an exchange to track a specific order. Value is guaranteed to be unique for current session. |
tm | Timestamp of last update. The value is formatted in YYYY-MM-DDTHH:MM:SS.nnnnnnnnnn format. |
Market Performers
About Market Performers
MarketFeed servers constantly monitor real-time data feeds from major exchanges to calculate and update lists of top performers in various categories. These calculations are based on various performance metrics such as stock price, volume, and volatility. The performers lists are updated throughout the trading session, providing a real-time view of the securities that are currently performing in the market.
The performers dataset is accessible using the performers
endpoint of the MarketFeed API. This endpoint allows clients to request a single list of securities for a given category type, exchange source, and a list of data columns. When specifying data columns to include in the response, clients can use the same data columns described in the Core Data Snapshots to select and return specific data. This allows clients to tailor the performers data to their specific needs and use cases.
Market performers request example:
curl -i -X GET https://api.activetick.com/performers.json?sessionid=MY_SESSIONID&type=volume&source=nyse&columns=l,b,a,v,ltm'
$.ajax({
type: "GET",
url: "https://api.activetick.com/performers.json",
data: {
sessionid: "MY_SESSIONID",
type: "volume",
source: "nyse",
columns: "l,b,a,v,ltm"
},
success: function(data) {
// Check if the status is "ok"
if (data.status === "ok") {
// Get the rows from the response
var rows = data.rows;
// Iterate through all rows
for (var i = 0; i < rows.length; i++) {
// Get the data of the current row
var rowData = rows[i].data;
// Store the values of each column in variables
var symbol = rows[i].s;
var last = "";
var bid = "";
var ask = "";
var volume = "";
var lastTime = "";
// Iterate through all columns of the current row
for (var j = 0; j < rowData.length; j++) {
switch (rowData[j].c) {
case "l": last = rowData[j].v; break;
case "b": bid = rowData[j].v; break;
case "a": ask = rowData[j].v; break;
case "v": volume = rowData[j].v; break;
case "ltm": lastTime = rowData[j].v; break;
}
}
// Print the details of the current row
console.log("Symbol: " + symbol + " | Last: " + last + " | Bid: " + bid + " | Ask: " + ask + " | Volume: " + volume + " | Last Time: " + lastTime);
}
} else {
console.error("Failed to fetch performers data");
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error("Failed to fetch performers data: " + errorThrown);
}
});
import requests
# API endpoint to make the GET request to
url = "https://api.activetick.com/performers.json"
# Query parameters to pass in the request
params = {
"sessionid": "MY_SESSIONID",
"type": "volume",
"source": "nyse",
"columns": "l,b,a,v,ltm"
}
# Make the GET request to the API
response = requests.get(url, params=params)
# Check if the request was successful
if response.status_code == 200:
# Extract the JSON data from the response
data = response.json()
# Check if the status in the response is 'ok'
if data['status'] == 'ok':
# Extract the rows from the response
rows = data['rows']
# Iterate through all the rows and print the details
for row in rows:
# Extract the details for the current row
symbol = row['s']
last_price = row['data'][0]['v']
bid_price = row['data'][1]['v']
ask_price = row['data'][2]['v']
volume = row['data'][3]['v']
last_trade_time = row['data'][4]['v']
# Print the details in a single line
print(f"Symbol: {symbol} | Last Price: {last_price} | Bid Price: {bid_price} | Ask Price: {ask_price} | Volume: {volume} | Last Trade Time: {last_trade_time}")
else:
print(f"Request failed with status code {response.status_code}")
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
// Use HttpClient to send a GET request to the API endpoint
HttpClient client = new HttpClient();
Task<string> response = client.GetStringAsync("https://api.activetick.com/performers.json?sessionid=MY_SESSIONID&type=volume&source=nyse&columns=l,b,a,v,ltm");
response.Wait();
// Deserialize the response JSON into a dynamic object
dynamic data = Newtonsoft.Json.JsonConvert.DeserializeObject(response.Result);
// Check if the API returned 'ok' for the status
if (data.status == "ok")
{
// Iterate through all rows of the response
foreach (var row in data.rows)
{
Console.WriteLine("Symbol: " + row.s + " | Status: " + row.st);
Console.WriteLine("Last: " + row.data[0].v + " | Bid: " + row.data[1].v + " | Ask: " + row.data[2].v + " | Volume: " + row.data[3].v + " | Last Timestamp: " + row.data[4].v);
Console.WriteLine("-------------------------------------");
}
}
else
{
Console.WriteLine("API returned an error: " + data.status);
}
}
}
}
Response example:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 199
Content-Length: 7502
{
"type":"performers",
"status":"ok",
"category_type":"volume",
"rows":[
{"s":"SNAP_S U","st":"ok","data":[
{"c":"l","s":"ok","v":"10.37"},
{"c":"b","s":"ok","v":"10.54"},
{"c":"a","s":"ok","v":"10.55"},
{"c":"v","s":"ok","v":"118582265"},
{"c":"ltm","s":"ok","v":"2023-02-02T00:59:59.680432128"}
]
},
{"s":"ABEV_S U","st":"ok","data":[
{"c":"l","s":"ok","v":"2.59"},
{"c":"b","s":"ok","v":"2.60"},
{"c":"a","s":"ok","v":"2.67"},
{"c":"v","s":"ok","v":"95169888"},
{"c":"ltm","s":"ok","v":"2023-02-02T00:59:17.168307968"}
]
},
{"s":"CVNA_S U","st":"ok","data":[
{"c":"l","s":"ok","v":"13.56"},
{"c":"b","s":"ok","v":"16.85"},
{"c":"a","s":"ok","v":"16.97"},
{"c":"v","s":"ok","v":"89344196"},
{"c":"ltm","s":"ok","v":"2023-02-02T00:59:59.883685120"}
]
},
{"s":"F_S U","st":"ok","data":[
{"c":"l","s":"ok","v":"13.79"},
{"c":"b","s":"ok","v":"13.92"},
{"c":"a","s":"ok","v":"13.99"},
{"c":"v","s":"ok","v":"70769495"},
{"c":"ltm","s":"ok","v":"2023-02-02T00:59:53.946333696"}
]
},
..
..
]
}
Symbol: SNAP_S U | Last: 10.37 | Bid: 10.54 | Ask: 10.55 | Volume: 118582265 | Last Time: 2023-02-02T00:59:59.680432128
Symbol: ABEV_S U | Last: 2.59 | Bid: 2.60 | Ask: 2.67 | Volume: 95169888 | Last Time: 2023-02-02T00:59:17.168307968
Symbol: CVNA_S U | Last: 13.56 | Bid: 16.85 | Ask: 16.97 | Volume: 89344196 | Last Time: 2023-02-02T00:59:59.883685120
Symbol: F_S U | Last: 13.79 | Bid: 13.92 | Ask: 13.99 | Volume: 70769495 | Last Time: 2023-02-02T00:59:53.946333696
Symbol: NIO_S U | Last: 12.10 | Bid: 12.22 | Ask: 12.25 | Volume: 66275887 | Last Time: 2023-02-02T00:59:57.106572288
Symbol: PLTR_S U | Last: 8.20 | Bid: 8.32 | Ask: 8.35 | Volume: 50218457 | Last Time: 2023-02-02T00:59:51.004558336
Symbol: CCL_S U | Last: 11.34 | Bid: 11.39 | Ask: 11.43 | Volume: 47343318 | Last Time: 2023-02-02T00:59:57.421929472
Symbol: BAC_S U | Last: 35.92 | Bid: 36.08 | Ask: 36.10 | Volume: 44451104 | Last Time: 2023-02-02T00:59:31.814250496
Symbol: T_S U | Last: 20.18 | Bid: 20.22 | Ask: 20.25 | Volume: 40196334 | Last Time: 2023-02-02T00:59:47.381609472
Symbol: APE_S U | Last: 2.56 | Bid: 2.61 | Ask: 2.63 | Volume: 38605535 | Last Time: 2023-02-02T00:59:56.040789504
Symbol: RIG_S U | Last: 7.14 | Bid: 7.17 | Ask: 7.19 | Volume: 38225275 | Last Time: 2023-02-02T00:59:21.138934272
Symbol: AMC_S U | Last: 5.71 | Bid: 5.75 | Ask: 5.77 | Volume: 37202169 | Last Time: 2023-02-02T00:59:58.995016704
Symbol: AI_S U | Last: 21.68 | Bid: 22.70 | Ask: 22.74 | Volume: 37149362 | Last Time: 2023-02-02T00:59:58.841176064
Symbol: ITUB_S U | Last: 4.91 | Bid: 4.72 | Ask: 5.35 | Volume: 35513533 | Last Time: 2023-02-02T00:56:02.358047488
Symbol: NU_S U | Last: 4.77 | Bid: 4.78 | Ask: 4.79 | Volume: 34971079 | Last Time: 2023-02-02T00:59:37.968365824
Symbol: SWN_S U | Last: 5.35 | Bid: 5.36 | Ask: 5.40 | Volume: 32178039 | Last Time: 2023-02-02T00:57:17.716867840
Symbol: SHOP_S U | Last: 50.26 | Bid: 51.45 | Ask: 51.75 | Volume: 26991291 | Last Time: 2023-02-02T00:59:55.136860160
Symbol: CS_S U | Last: 3.63 | Bid: 3.66 | Ask: 3.70 | Volume: 26315058 | Last Time: 2023-02-02T00:55:58.280201216
Symbol: PBR_S U | Last: 11.42 | Bid: 11.43 | Ask: 11.47 | Volume: 26304875 | Last Time: 2023-02-02T00:59:51.606611456
Symbol: GM_S U | Last: 39.30 | Bid: 39.35 | Ask: 39.38 | Volume: 25601549 | Last Time: 2023-02-02T00:59:21.034920960
Symbol: SNAP_S U | Last Price: 10.37 | Bid Price: 10.54 | Ask Price: 10.55 | Volume: 118582265 | Last Trade Time: 2023-02-02T00:59:59.680432128
Symbol: ABEV_S U | Last Price: 2.59 | Bid Price: 2.60 | Ask Price: 2.67 | Volume: 95169888 | Last Trade Time: 2023-02-02T00:59:17.168307968
Symbol: CVNA_S U | Last Price: 13.56 | Bid Price: 16.85 | Ask Price: 16.97 | Volume: 89344196 | Last Trade Time: 2023-02-02T00:59:59.883685120
Symbol: F_S U | Last Price: 13.79 | Bid Price: 13.92 | Ask Price: 13.99 | Volume: 70769495 | Last Trade Time: 2023-02-02T00:59:53.946333696
Symbol: NIO_S U | Last Price: 12.10 | Bid Price: 12.22 | Ask Price: 12.25 | Volume: 66275887 | Last Trade Time: 2023-02-02T00:59:57.106572288
Symbol: PLTR_S U | Last Price: 8.20 | Bid Price: 8.32 | Ask Price: 8.35 | Volume: 50218457 | Last Trade Time: 2023-02-02T00:59:51.004558336
Symbol: CCL_S U | Last Price: 11.34 | Bid Price: 11.39 | Ask Price: 11.43 | Volume: 47343318 | Last Trade Time: 2023-02-02T00:59:57.421929472
Symbol: BAC_S U | Last Price: 35.92 | Bid Price: 36.08 | Ask Price: 36.10 | Volume: 44451104 | Last Trade Time: 2023-02-02T00:59:31.814250496
Symbol: T_S U | Last Price: 20.18 | Bid Price: 20.22 | Ask Price: 20.25 | Volume: 40196334 | Last Trade Time: 2023-02-02T00:59:47.381609472
Symbol: APE_S U | Last Price: 2.56 | Bid Price: 2.61 | Ask Price: 2.63 | Volume: 38605535 | Last Trade Time: 2023-02-02T00:59:56.040789504
Symbol: RIG_S U | Last Price: 7.14 | Bid Price: 7.17 | Ask Price: 7.19 | Volume: 38225275 | Last Trade Time: 2023-02-02T00:59:21.138934272
Symbol: AMC_S U | Last Price: 5.71 | Bid Price: 5.75 | Ask Price: 5.77 | Volume: 37202169 | Last Trade Time: 2023-02-02T00:59:58.995016704
Symbol: AI_S U | Last Price: 21.68 | Bid Price: 22.70 | Ask Price: 22.74 | Volume: 37149362 | Last Trade Time: 2023-02-02T00:59:58.841176064
Symbol: ITUB_S U | Last Price: 4.91 | Bid Price: 4.72 | Ask Price: 5.35 | Volume: 35513533 | Last Trade Time: 2023-02-02T00:56:02.358047488
Symbol: NU_S U | Last Price: 4.77 | Bid Price: 4.78 | Ask Price: 4.79 | Volume: 34971079 | Last Trade Time: 2023-02-02T00:59:37.968365824
Symbol: SWN_S U | Last Price: 5.35 | Bid Price: 5.36 | Ask Price: 5.40 | Volume: 32178039 | Last Trade Time: 2023-02-02T00:57:17.716867840
Symbol: SHOP_S U | Last Price: 50.26 | Bid Price: 51.45 | Ask Price: 51.75 | Volume: 26991291 | Last Trade Time: 2023-02-02T00:59:55.136860160
Symbol: CS_S U | Last Price: 3.63 | Bid Price: 3.66 | Ask Price: 3.70 | Volume: 26315058 | Last Trade Time: 2023-02-02T00:55:58.280201216
Symbol: PBR_S U | Last Price: 11.42 | Bid Price: 11.43 | Ask Price: 11.47 | Volume: 26304875 | Last Trade Time: 2023-02-02T00:59:51.606611456
Symbol: GM_S U | Last Price: 39.30 | Bid Price: 39.35 | Ask Price: 39.38 | Volume: 25601549 | Last Trade Time: 2023-02-02T00:59:21.034920960
Symbol: SNAP_S U | Status: ok
Last: 10.37 | Bid: 10.54 | Ask: 10.55 | Volume: 118582265 | Last Timestamp: 2/2/2023 12:59:59 AM
-------------------------------------
Symbol: ABEV_S U | Status: ok
Last: 2.59 | Bid: 2.60 | Ask: 2.67 | Volume: 95169888 | Last Timestamp: 2/2/2023 12:59:17 AM
-------------------------------------
Symbol: CVNA_S U | Status: ok
Last: 13.56 | Bid: 16.85 | Ask: 16.97 | Volume: 89344196 | Last Timestamp: 2/2/2023 12:59:59 AM
-------------------------------------
Symbol: F_S U | Status: ok
Last: 13.79 | Bid: 13.92 | Ask: 13.99 | Volume: 70769495 | Last Timestamp: 2/2/2023 12:59:53 AM
-------------------------------------
Symbol: NIO_S U | Status: ok
Last: 12.10 | Bid: 12.22 | Ask: 12.25 | Volume: 66275887 | Last Timestamp: 2/2/2023 12:59:57 AM
-------------------------------------
Symbol: PLTR_S U | Status: ok
Last: 8.20 | Bid: 8.32 | Ask: 8.35 | Volume: 50218457 | Last Timestamp: 2/2/2023 12:59:51 AM
-------------------------------------
Symbol: CCL_S U | Status: ok
Last: 11.34 | Bid: 11.39 | Ask: 11.43 | Volume: 47343318 | Last Timestamp: 2/2/2023 12:59:57 AM
-------------------------------------
Symbol: BAC_S U | Status: ok
Last: 35.92 | Bid: 36.08 | Ask: 36.10 | Volume: 44451104 | Last Timestamp: 2/2/2023 12:59:31 AM
-------------------------------------
Symbol: T_S U | Status: ok
Last: 20.18 | Bid: 20.22 | Ask: 20.25 | Volume: 40196334 | Last Timestamp: 2/2/2023 12:59:47 AM
-------------------------------------
Market Performers Request Endpoint
https://api.activetick.com/performers.json?sessionid=MY_SESSIONID&type=TYPE&source=SOURCE&columns=COL1,COL2
Market Performers Request Parameters
Parameter | Required | Description |
---|---|---|
sessionid | yes | Valid sessionid value returned from prior authorization. |
type | yes | Category type for top performers. Can be one of the values from a table below. |
source | yes | Exchange source. |
column | yes | List of data columns separated by commas. Can be any column id from Core Data Snapshot. |
Market Performers Category Types
Market Performers Category Types table provides a list of different categories that can be used to retrieve top performing securities.
Type | Description |
---|---|
volume | Type provides the most active securities by trading volume. |
net_gainers | Type provides securities that have gained the most value. |
net_losers | Type provides securities that have lost the most value. |
percent_gainers | Type provides securities that have gained the most percentage-wise. |
percent_losers | Type provides securities that have lost the most percentage-wise. |
Market Performers Exchange Sources
Source | Description |
---|---|
nyse | NYSE-listed securities. |
nyse_other | Securities listed on other NYSE exchanges, including NYSE American, NYSE Arca, Bats. |
nasdaq | NASDAQ-listed securities. |
otc | OTC-listed securities. |
Market Performers Response
The Market Performers response provides information on the top-performing securities in a given category, such as volume, net gainers, net losers, percent gainers, and percent losers. The response is similar to a Snapshot response and includes the following information:
Name | Description |
---|---|
type | "performers" |
status | Indicates if the request was completed successfully. Possible values are "ok" and "fail". |
category_type | The original request type, such as "volume", "net_gainers", etc. |
rows | An array of data rows for each instrument symbol. |
For each included instrument, the server responds with a row of data that includes information about the row and the data itself. The data array inside the row contains information for each requested column.
Name | Description |
---|---|
s | Instrument symbol. |
st | Row status code indicating if symbol information was successfully returned. Possible values are "ok" and "fail". |
data | Array of data values for each requested column. |
The data array inside the row contains information for each requested column.
Name | Description |
---|---|
c | Data column id. |
s | Data column status. Possible values are "ok" and "fail". |
v | Data value. |
Market Scanner
About MarketScanner
ActiveTick's Market Scanner is a powerful tool that allows users to monitor the market in real-time and receive alerts when certain conditions are met. The scanner utilizes server-based technology to scan the entire universe of stocks and includes over 100 different types of scanners and filters that can be applied to narrow down the alerts that are generated.
The Market Scanner API allows users to access the full functionality of the server-based alerting engine. This includes the ability to subscribe to real-time streaming alerts and to query the servers for historical alerts that have been generated in the past.
To help users narrow down the selection of alerts, the scanner provides over 100 different filters that can be applied when requesting streaming or historical alerts from the servers. These filters include options for filtering by symbols, prices, volume, and many other criteria. This feature allows users to customize their alerts to suit their specific needs and requirements.
When an alert event is generated, it includes information such as the type of alert, the time of the event, the stock symbol, and any additional data specific to that alert. Real-time subscribers who have matching alert subscriptions will receive a notification with the newly generated alert information.
An alert event is generated by the Market Scanner when a predefined condition is met while monitoring the market. The alert event contains important information such as the type of alert, the time of the event, the number of occurrences for that day, the stock symbol, and any additional alert-specific data. Real-time subscribers that have matching alert subscriptions will receive a notification event with the newly generated alert information.
The Market Scanner offers a wide range of filters that can be applied to alert subscriptions or historical alert lookups to help narrow down the selection of generated alerts. The filters are designed to exclude alerts that do not match the specified criteria, and this can be done using generic filters that can be applied to any type of alert, or alert-specific filters that only work for specific alerts.
For example, a client can subscribe to two alerts, alert_high and alert_low, to receive notifications when stocks are making new daily highs and lows. These types of alerts typically generate a large number of notifications, particularly during the market open or close. To further narrow down the notifications, filter_last_price filters can be applied to exclude anything that trades outside a certain price range, such as between $5 and $50. Additionally, another filter such as filter_volume_current can be applied to further exclude stocks that have less than 5mil shares.
Alerts and Filters
MarketScanner request example:
curl -i -X POST https://api.activetick.com/alerts_history.json \
-d 'sessionid=MY_SESSIONID&
begintime=2022-12-05T00:00:00&
endtime=2022-12-06T00:00:00&
records=10&
alerts=[
{"alert":"alert_high","alert_filter":
{"filter":"filter_alert_days","value":"1"}
},
{"alert":"alert_low","alert_filter":
{"filter":"filter_alert_days","value":"1"}
}]&
filters=[
{"filter":filter_last_price","operator":"operator_greater_than","value":"5.00"}
]'
$.ajax({
type: "POST",
url: "https://api.activetick.com/alerts_history.json",
data: {
sessionid: "MY_SESSIONID",
begintime: "2022-12-05T00:00:00",
endtime: "2022-12-06T00:00:00",
records: 10,
alerts: JSON.stringify([
{alert: "alert_high", alert_filter: {filter: "filter_alert_days", value: "1"}},
{alert: "alert_low", alert_filter: {filter: "filter_alert_days", value: "1"}}
]),
filters: JSON.stringify([{filter: "filter_last_price", operator: "operator_greater_than", value: "5.00"}])
},
success: function(data) {
console.log(data);
// Print out alert data in one line per alert
data.alerts.forEach(function(alert) {
var alertData = "";
if (alert.data) {
alertData = JSON.stringify(alert.data);
}
console.log("alert: " + alert.alert + ", daily_count: " + alert.daily_count + ", symbol: " + alert.symbol + ", time: " + alert.tm + ", alert_data: " + alertData);
});
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Error: " + textStatus + " - " + errorThrown);
}
});
import requests
import json
url = "https://api.activetick.com/alerts_history.json"
data = {
"sessionid": "MY_SESSIONID",
"begintime": "2022-12-05T00:00:00",
"endtime": "2022-12-06T00:00:00",
"records": 10,
"alerts": json.dumps([
{"alert": "alert_high", "alert_filter": {"filter": "filter_alert_days", "value": "1"}},
{"alert": "alert_low", "alert_filter": {"filter": "filter_alert_days", "value": "1"}}
]),
"filters": json.dumps([{"filter": "filter_last_price", "operator": "operator_greater_than", "value": "5.00"}])
}
response = requests.post(url, data=data)
if response.status_code == 200:
response_json = response.json()
for alert in response_json["alerts"]:
alert_data = alert.get("data", {})
print(f"{alert['alert']} | {alert['daily_count']} | {alert['symbol']} | {alert['tm']} | {alert_data}")
else:
print("Error: " + response.status_code)
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
using (HttpClient client = new HttpClient())
{
string url = "https://api.activetick.com/alerts_history.json";
var data = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("sessionid", "MY_SESSIONID"),
new KeyValuePair<string, string>("begintime", "2022-12-05T00:00:00"),
new KeyValuePair<string, string>("endtime", "2022-12-06T00:00:00"),
new KeyValuePair<string, string>("records", "10"),
new KeyValuePair<string, string>("alerts", JsonSerializer.Serialize(new []
{
new
{
alert = "alert_high",
alert_filter = new { filter = "filter_alert_days", value = "1" }
},
new
{
alert = "alert_low",
alert_filter = new { filter = "filter_alert_days", value = "1" }
}
})),
new KeyValuePair<string, string>("filters", JsonSerializer.Serialize(new []
{
new { filter = "filter_last_price", @operator = "operator_greater_than", value = "5.00" }
}))
});
var response = await client.PostAsync(url, data);
if (response.IsSuccessStatusCode)
{
var responseString = await response.Content.ReadAsStringAsync();
using (JsonDocument document = JsonDocument.Parse(responseString))
{
var alerts = document.RootElement.GetProperty("alerts");
foreach (var alert in alerts.EnumerateArray())
{
var alertData = alert.GetProperty("data").ToString();
Console.WriteLine($"{alert.GetProperty("alert").GetString()} | {alert.GetProperty("daily_count").GetString()} | {alert.GetProperty("symbol").GetString()} | {alert.GetProperty("tm").GetString()} | {alertData}");
}
}
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
}
}
}
}
Response example:
HTTP/1.1 200 OK
Content-Type: application/json
X-Available-Requests-Left: 197
Content-Length: 1607
{
"type":"alerts_history",
"status":"ok",
"alerts":[
{"alert":"alert_low","daily_count":"3","symbol":"CZOO/WS_S U","tm":"2022-12-05T21:52:45","data":{"support_price":"0.0127","support_date":"2022-12-02"}},
{"alert":"alert_low","daily_count":"4","symbol":"DIVD_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"28.9649","support_date":"2022-11-29"}},
{"alert":"alert_low","daily_count":"2","symbol":"AAPB_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"19.2","support_date":"2022-12-02"}},
{"alert":"alert_low","daily_count":"2","symbol":"PSCD_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"82.3","support_date":"2022-11-30"}},
{"alert":"alert_high","daily_count":"2","symbol":"PSCF_S U","tm":"2022-12-05T21:15:00","data":{"resistance_price":"51.8678","resistance_date":"2022-12-02"}},
{"alert":"alert_low","daily_count":"4","symbol":"PSCH_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"135.85","support_date":"2022-11-30"}},
{"alert":"alert_high","daily_count":"1","symbol":"PSCI_S U","tm":"2022-12-05T21:15:00","data":{"resistance_price":"95.0888","resistance_date":"2022-12-02"}},
{"alert":"alert_low","daily_count":"1","symbol":"PSCM_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"66.14","support_date":"2022-11-29"}},
{"alert":"alert_low","daily_count":"3","symbol":"PSCT_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"123.345","support_date":"2022-11-30"}},
{"alert":"alert_low","daily_count":"3","symbol":"PSL_S U","tm":"2022-12-05T21:15:00","data":{"support_price":"86.03","support_date":"2022-11-30"}}
]
}
alert: alert_low, daily_count: 4, symbol: DIVD_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"28.9649","support_date":"2022-11-29"}
alert: alert_low, daily_count: 2, symbol: AAPB_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"19.2","support_date":"2022-12-02"}
alert: alert_low, daily_count: 2, symbol: PSCD_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"82.3","support_date":"2022-11-30"}
alert: alert_high, daily_count: 2, symbol: PSCF_S U, time: 2022-12-05T21:15:00, alert_data: {"resistance_price":"51.8678","resistance_date":"2022-12-02"}
alert: alert_low, daily_count: 4, symbol: PSCH_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"135.85","support_date":"2022-11-30"}
alert: alert_high, daily_count: 1, symbol: PSCI_S U, time: 2022-12-05T21:15:00, alert_data: {"resistance_price":"95.0888","resistance_date":"2022-12-02"}
alert: alert_low, daily_count: 1, symbol: PSCM_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"66.14","support_date":"2022-11-29"}
alert: alert_low, daily_count: 3, symbol: PSCT_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"123.345","support_date":"2022-11-30"}
alert: alert_low, daily_count: 3, symbol: PSL_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"86.03","support_date":"2022-11-30"}
alert: alert_low, daily_count: 5, symbol: WGMI_S U, time: 2022-12-05T21:15:00, alert_data: {"support_price":"5.45","support_date":"2022-11-30"}
alert_low | 4 | DIVD_S U | 2022-12-05T21:15:00 | {'support_price': '28.9649', 'support_date': '2022-11-29'}
alert_low | 2 | AAPB_S U | 2022-12-05T21:15:00 | {'support_price': '19.2', 'support_date': '2022-12-02'}
alert_low | 2 | PSCD_S U | 2022-12-05T21:15:00 | {'support_price': '82.3', 'support_date': '2022-11-30'}
alert_high | 2 | PSCF_S U | 2022-12-05T21:15:00 | {'resistance_price': '51.8678', 'resistance_date': '2022-12-02'}
alert_low | 4 | PSCH_S U | 2022-12-05T21:15:00 | {'support_price': '135.85', 'support_date': '2022-11-30'}
alert_high | 1 | PSCI_S U | 2022-12-05T21:15:00 | {'resistance_price': '95.0888', 'resistance_date': '2022-12-02'}
alert_low | 1 | PSCM_S U | 2022-12-05T21:15:00 | {'support_price': '66.14', 'support_date': '2022-11-29'}
alert_low | 3 | PSCT_S U | 2022-12-05T21:15:00 | {'support_price': '123.345', 'support_date': '2022-11-30'}
alert_low | 3 | PSL_S U | 2022-12-05T21:15:00 | {'support_price': '86.03', 'support_date': '2022-11-30'}
alert_low | 5 | WGMI_S U | 2022-12-05T21:15:00 | {'support_price': '5.45', 'support_date': '2022-11-30'}
alert_low | 4 | DIVD_S U | 2022-12-05T21:15:00 | {"support_price":"28.9649","support_date":"2022-11-29"}
alert_low | 2 | AAPB_S U | 2022-12-05T21:15:00 | {"support_price":"19.2","support_date":"2022-12-02"}
alert_low | 2 | PSCD_S U | 2022-12-05T21:15:00 | {"support_price":"82.3","support_date":"2022-11-30"}
alert_high | 2 | PSCF_S U | 2022-12-05T21:15:00 | {"resistance_price":"51.8678","resistance_date":"2022-12-02"}
alert_low | 4 | PSCH_S U | 2022-12-05T21:15:00 | {"support_price":"135.85","support_date":"2022-11-30"}
alert_high |