kalshi-typescript
Version:
OpenAPI client for kalshi-typescript
264 lines (170 loc) • 10.6 kB
Markdown
# HistoricalApi
All URIs are relative to *https://api.elections.kalshi.com/trade-api/v2*
|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**getFillsHistorical**](#getfillshistorical) | **GET** /historical/fills | Get Historical Fills|
|[**getHistoricalCutoff**](#gethistoricalcutoff) | **GET** /historical/cutoff | Get Historical Cutoff Timestamps|
|[**getHistoricalMarket**](#gethistoricalmarket) | **GET** /historical/markets/{ticker} | Get Historical Market|
|[**getHistoricalMarkets**](#gethistoricalmarkets) | **GET** /historical/markets | Get Historical Markets|
|[**getHistoricalOrders**](#gethistoricalorders) | **GET** /historical/orders | Get Historical Orders|
|[**getMarketCandlesticksHistorical**](#getmarketcandlestickshistorical) | **GET** /historical/markets/{ticker}/candlesticks | Get Historical Market Candlesticks|
|[**getTradesHistorical**](#gettradeshistorical) | **GET** /historical/trades | Get Historical Trades|
# **getFillsHistorical**
> GetFillsResponse getFillsHistorical()
Endpoint for getting all historical fills for the member. A fill is when a trade you have is matched.
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Filter by market ticker | (optional) defaults to undefined|
| **maxTs** | [**number**] | Filter items before this Unix timestamp | (optional) defaults to undefined|
| **limit** | [**number**] | Number of results per page. Defaults to 100. Maximum value is 200. | (optional) defaults to 100|
| **cursor** | [**string**] | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. | (optional) defaults to undefined|
### Return type
**GetFillsResponse**
### Authorization
[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Fills retrieved successfully | - |
|**400** | Bad request | - |
|**401** | Unauthorized | - |
|**404** | Resource not found | - |
|**500** | Internal server error | - |
# **getHistoricalCutoff**
> GetHistoricalCutoffResponse getHistoricalCutoff()
Returns the cutoff timestamps that define the boundary between **live** and **historical** data. ## Cutoff fields - `market_settled_ts` : Markets that **settled** before this timestamp, and their candlesticks, must be accessed via `GET /historical/markets` and `GET /historical/markets/{ticker}/candlesticks`. - `trades_created_ts` : Trades that were **filled** before this timestamp must be accessed via `GET /historical/fills`. - `orders_updated_ts` : Orders that were **canceled or fully executed** before this timestamp must be accessed via `GET /historical/orders`. Resting (active) orders are always available in `GET /portfolio/orders`.
### Parameters
This endpoint does not have any parameters.
### Return type
**GetHistoricalCutoffResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Historical cutoff timestamps retrieved successfully | - |
|**500** | Internal server error | - |
# **getHistoricalMarket**
> GetMarketResponse getHistoricalMarket()
Endpoint for getting data about a specific market by its ticker from the historical database.
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Market ticker | defaults to undefined|
### Return type
**GetMarketResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Historical market retrieved successfully | - |
|**404** | Resource not found | - |
|**500** | Internal server error | - |
# **getHistoricalMarkets**
> GetMarketsResponse getHistoricalMarkets()
Endpoint for getting markets that have been archived to the historical database. Filters are mutually exclusive.
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **limit** | [**number**] | Number of results per page. Defaults to 100. Maximum value is 1000. | (optional) defaults to 100|
| **cursor** | [**string**] | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. | (optional) defaults to undefined|
| **tickers** | [**string**] | Filter by specific market tickers. Comma-separated list of market tickers to retrieve. | (optional) defaults to undefined|
| **eventTicker** | [**string**] | Event ticker to filter by. Only a single event ticker is supported. | (optional) defaults to undefined|
| **mveFilter** | [**'exclude'**]**Array<'exclude'>** | Filter by multivariate events (combos). By default, MVE markets are included. | (optional) defaults to undefined|
### Return type
**GetMarketsResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Historical markets retrieved successfully | - |
|**400** | Bad request - invalid input | - |
|**500** | Internal server error | - |
# **getHistoricalOrders**
> GetOrdersResponse getHistoricalOrders()
Endpoint for getting orders that have been archived to the historical database.
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Filter by market ticker | (optional) defaults to undefined|
| **maxTs** | [**number**] | Filter items before this Unix timestamp | (optional) defaults to undefined|
| **limit** | [**number**] | Number of results per page. Defaults to 100. Maximum value is 200. | (optional) defaults to 100|
| **cursor** | [**string**] | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. | (optional) defaults to undefined|
### Return type
**GetOrdersResponse**
### Authorization
[kalshiAccessSignature](../README.md#kalshiAccessSignature), [kalshiAccessKey](../README.md#kalshiAccessKey), [kalshiAccessTimestamp](../README.md#kalshiAccessTimestamp)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Historical orders retrieved successfully | - |
|**400** | Bad request - invalid input | - |
|**401** | Unauthorized - authentication required | - |
|**500** | Internal server error | - |
# **getMarketCandlesticksHistorical**
> GetMarketCandlesticksHistoricalResponse getMarketCandlesticksHistorical()
Endpoint for fetching historical candlestick data for markets that have been archived from the live data set. Time period length of each candlestick in minutes. Valid values: 1 (1 minute), 60 (1 hour), 1440 (1 day).
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Market ticker - unique identifier for the specific market | defaults to undefined|
| **startTs** | [**number**] | Start timestamp (Unix timestamp). Candlesticks will include those ending on or after this time. | defaults to undefined|
| **endTs** | [**number**] | End timestamp (Unix timestamp). Candlesticks will include those ending on or before this time. | defaults to undefined|
| **periodInterval** | [**1 | 60 | 1440**]**Array<1 | 60 | 1440>** | Time period length of each candlestick in minutes. Valid values are 1 (1 minute), 60 (1 hour), or 1440 (1 day). | defaults to undefined|
### Return type
**GetMarketCandlesticksHistoricalResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Candlesticks retrieved successfully | - |
|**400** | Bad request | - |
|**404** | Not found | - |
|**500** | Internal server error | - |
# **getTradesHistorical**
> GetTradesResponse getTradesHistorical()
Endpoint for getting all historical trades for all markets. Trades that were filled before the historical cutoff are available via this endpoint. See [Historical Data](https://kalshi.com/docs/getting_started/historical_data) for details.
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **ticker** | [**string**] | Filter by market ticker | (optional) defaults to undefined|
| **minTs** | [**number**] | Filter items after this Unix timestamp | (optional) defaults to undefined|
| **maxTs** | [**number**] | Filter items before this Unix timestamp | (optional) defaults to undefined|
| **limit** | [**number**] | Number of results per page. Defaults to 100. Maximum value is 1000. | (optional) defaults to 100|
| **cursor** | [**string**] | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. | (optional) defaults to undefined|
### Return type
**GetTradesResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | Historical trades retrieved successfully | - |
|**400** | Bad request - invalid input | - |
|**404** | Resource not found | - |
|**500** | Internal server error | - |