kalshi-cpp 0.6.2
C++23 client for Kalshi's Predictions API
Loading...
Searching...
No Matches
kalshi Namespace Reference

Namespaces

namespace  ws
 

Classes

struct  AcceptBlockTradeProposalRequest
 
struct  AcceptQuoteRequest
 
struct  AccountApiUsageLevelVolumeGoal
 
struct  AccountApiUsageLevelVolumeProgress
 
struct  AmendOrderParams
 Query parameters for amend_order. More...
 
struct  AmendOrderRequest
 
struct  AmendOrderResponse
 
struct  AmendOrderV2Request
 
struct  AmendOrderV2Response
 
struct  ApiKey
 
struct  ApiUsageLevelGrant
 
struct  ApplySubaccountTransferRequest
 
struct  AssociatedEvent
 
struct  AuthHeaders
 Headers that authenticate one request. More...
 
struct  BatchCancelOrdersIndividualResponse
 
struct  BatchCancelOrdersRequest
 
struct  BatchCancelOrdersRequestOrder
 
struct  BatchCancelOrdersResponse
 
struct  BatchCancelOrdersV2Request
 
struct  BatchCancelOrdersV2RequestOrdersItem
 
struct  BatchCancelOrdersV2Response
 
struct  BatchCancelOrdersV2ResponseOrdersItem
 
struct  BatchCreateOrdersIndividualResponse
 
struct  BatchCreateOrdersRequest
 
struct  BatchCreateOrdersResponse
 
struct  BatchCreateOrdersV2Request
 
struct  BatchCreateOrdersV2Response
 
struct  BatchCreateOrdersV2ResponseOrdersItem
 
struct  BatchGetMarketCandlesticksParams
 Query parameters for batch_get_market_candlesticks. More...
 
struct  BatchGetMarketCandlesticksResponse
 
struct  BidAskDistribution
 
struct  BidAskDistributionHistorical
 
struct  BlockTradeProposal
 
struct  BucketLimit
 Token-bucket budget for one rate-limit bucket. More...
 
struct  CancelAllOrdersParams
 Query parameters for cancel_all_orders. More...
 
struct  CancelOrderParams
 Query parameters for cancel_order. More...
 
struct  CancelOrderV2Response
 
struct  ClientConfig
 
struct  CreateApiKeyRequest
 
struct  CreateApiKeyResponse
 
struct  CreateFCMSubtraderRequest
 
struct  CreateFCMSubtraderResponse
 
struct  CreateMarketInMultivariateEventCollectionRequest
 
struct  CreateMarketInMultivariateEventCollectionResponse
 
struct  CreateOrderGroupRequest
 
struct  CreateOrderGroupResponse
 
struct  CreateOrderRequest
 
struct  CreateOrderResponse
 
struct  CreateOrderV2Request
 
struct  CreateOrderV2Response
 
struct  CreateQuoteRequest
 
struct  CreateQuoteResponse
 
struct  CreateRFQRequest
 
struct  CreateRFQResponse
 
struct  CreateSubaccountRequest
 
struct  CreateSubaccountResponse
 
struct  DailySchedule
 
struct  DecreaseOrderParams
 Query parameters for decrease_order. More...
 
struct  DecreaseOrderV2Request
 
struct  DecreaseOrderV2Response
 
struct  DeleteFcmEventContractDailyCapParams
 Query parameters for delete_fcm_event_contract_daily_cap. More...
 
struct  DeleteOrderGroupParams
 Query parameters for delete_order_group. More...
 
struct  Deposit
 
struct  EndpointCostRule
 Token cost of requests matching method and path. More...
 
struct  EndpointTokenCost
 
struct  Error
 
struct  ErrorResponse
 
struct  EventData
 
struct  EventFeeChange
 
struct  EventLiveData
 
struct  EventPosition
 
struct  ExchangeIndexStatus
 
struct  ExchangeStatus
 
struct  FcmFill
 
struct  FCMSubtrader
 
struct  Fill
 
class  FixedPoint
 Lossless fixed-point decimal received from or sent to Kalshi. More...
 
struct  ForecastPercentilesPoint
 
struct  GenerateApiKeyRequest
 
struct  GenerateApiKeyResponse
 
struct  GetAccountApiLimitsResponse
 
struct  GetAccountApiUsageLevelVolumeProgressResponse
 
struct  GetAccountEndpointCostsResponse
 
struct  GetApiKeysParams
 Query parameters for get_api_keys. More...
 
struct  GetApiKeysResponse
 
struct  GetBalanceParams
 Query parameters for get_balance. More...
 
struct  GetBalanceResponse
 
struct  GetBlockTradeProposalsParams
 Query parameters for get_block_trade_proposals. More...
 
struct  GetBlockTradeProposalsResponse
 
struct  GetCommunicationsIDResponse
 
struct  GetDepositsParams
 Query parameters for get_deposits. More...
 
struct  GetDepositsResponse
 
struct  GetEventCandlesticksResponse
 
struct  GetEventFeeChangesParams
 Query parameters for get_event_fee_changes. More...
 
struct  GetEventFeeChangesResponse
 
struct  GetEventForecastPercentilesHistoryParams
 Query parameters for get_event_forecast_percentiles_history. More...
 
struct  GetEventForecastPercentilesHistoryResponse
 
struct  GetEventLiveDataParams
 Query parameters for get_event_live_data. More...
 
struct  GetEventLiveDataResponse
 
struct  GetEventMetadataResponse
 
struct  GetEventParams
 Query parameters for get_event. More...
 
struct  GetEventResponse
 
struct  GetEventsParams
 Query parameters for get_events. More...
 
struct  GetEventsResponse
 
struct  GetExchangeScheduleResponse
 
struct  GetFcmEventContractDailyCapParams
 Query parameters for get_fcm_event_contract_daily_cap. More...
 
struct  GetFCMEventContractDailyCapResponse
 
struct  GetFcmFillsParams
 Query parameters for get_fcm_fills. More...
 
struct  GetFcmFillsResponse
 
struct  GetFcmOrdersParams
 Query parameters for get_fcm_orders. More...
 
struct  GetFcmPositionsParams
 Query parameters for get_fcm_positions. More...
 
struct  GetFcmSubtraderBlockedCategoriesParams
 Query parameters for get_fcm_subtrader_blocked_categories. More...
 
struct  GetFCMSubtraderBlockedCategoriesResponse
 
struct  GetFillsHistoricalParams
 Query parameters for get_fills_historical. More...
 
struct  GetFillsParams
 Query parameters for get_fills. More...
 
struct  GetFillsResponse
 
struct  GetFiltersBySportsResponse
 
struct  GetGameStatsResponse
 
struct  GetHistoricalCutoffResponse
 
struct  GetHistoricalMarketsParams
 Query parameters for get_historical_markets. More...
 
struct  GetHistoricalOrdersParams
 Query parameters for get_historical_orders. More...
 
struct  GetHistoricalPositionsParams
 Query parameters for get_historical_positions. More...
 
struct  GetIncentiveProgramsParams
 Query parameters for get_incentive_programs. More...
 
struct  GetIncentiveProgramsResponse
 
struct  GetIntraExchangeInstanceTransferResponse
 
struct  GetIntraExchangeInstanceTransfersParams
 Query parameters for get_intra_exchange_instance_transfers. More...
 
struct  GetIntraExchangeInstanceTransfersResponse
 
struct  GetLiveDataByMilestoneParams
 Query parameters for get_live_data_by_milestone. More...
 
struct  GetLiveDataParams
 Query parameters for get_live_data. More...
 
struct  GetLiveDataResponse
 
struct  GetLiveDatasParams
 Query parameters for get_live_datas. More...
 
struct  GetLiveDatasResponse
 
struct  GetMarketCandlesticksByEventParams
 Query parameters for get_market_candlesticks_by_event. More...
 
struct  GetMarketCandlesticksHistoricalParams
 Query parameters for get_market_candlesticks_historical. More...
 
struct  GetMarketCandlesticksHistoricalResponse
 
struct  GetMarketCandlesticksParams
 Query parameters for get_market_candlesticks. More...
 
struct  GetMarketCandlesticksResponse
 
struct  GetMarketOrderbookParams
 Query parameters for get_market_orderbook. More...
 
struct  GetMarketOrderbookResponse
 
struct  GetMarketOrderbooksParams
 Query parameters for get_market_orderbooks. More...
 
struct  GetMarketOrderbooksResponse
 
struct  GetMarketResponse
 
struct  GetMarketsParams
 Query parameters for get_markets. More...
 
struct  GetMarketsResponse
 
struct  GetMilestoneResponse
 
struct  GetMilestonesParams
 Query parameters for get_milestones. More...
 
struct  GetMilestonesResponse
 
struct  GetMultivariateEventCollectionResponse
 
struct  GetMultivariateEventCollectionsParams
 Query parameters for get_multivariate_event_collections. More...
 
struct  GetMultivariateEventCollectionsResponse
 
struct  GetMultivariateEventsParams
 Query parameters for get_multivariate_events. More...
 
struct  GetMultivariateEventsResponse
 
struct  GetOrderGroupParams
 Query parameters for get_order_group. More...
 
struct  GetOrderGroupResponse
 
struct  GetOrderGroupsParams
 Query parameters for get_order_groups. More...
 
struct  GetOrderGroupsResponse
 
struct  GetOrderQueuePositionResponse
 
struct  GetOrderQueuePositionsParams
 Query parameters for get_order_queue_positions. More...
 
struct  GetOrderQueuePositionsResponse
 
struct  GetOrderResponse
 
struct  GetOrdersParams
 Query parameters for get_orders. More...
 
struct  GetOrdersResponse
 
struct  GetPortfolioRestingOrderTotalValueResponse
 
struct  GetPositionsParams
 Query parameters for get_positions. More...
 
struct  GetPositionsResponse
 
struct  GetQuoteResponse
 
struct  GetQuotesParams
 Query parameters for get_quotes. More...
 
struct  GetQuotesResponse
 
struct  GetRFQResponse
 
struct  GetRfqsParams
 Query parameters for get_rfqs. More...
 
struct  GetRFQsResponse
 
struct  GetSeriesFeeChangesParams
 Query parameters for get_series_fee_changes. More...
 
struct  GetSeriesFeeChangesResponse
 
struct  GetSeriesListParams
 Query parameters for get_series_list. More...
 
struct  GetSeriesListResponse
 
struct  GetSeriesParams
 Query parameters for get_series. More...
 
struct  GetSeriesResponse
 
struct  GetSettlementsParams
 Query parameters for get_settlements. More...
 
struct  GetSettlementsResponse
 
struct  GetStructuredTargetResponse
 
struct  GetStructuredTargetsParams
 Query parameters for get_structured_targets. More...
 
struct  GetStructuredTargetsResponse
 
struct  GetSubaccountBalancesResponse
 
struct  GetSubaccountNettingResponse
 
struct  GetSubaccountTransfersParams
 Query parameters for get_subaccount_transfers. More...
 
struct  GetSubaccountTransfersResponse
 
struct  GetTagsForSeriesCategoriesResponse
 
struct  GetTargetBalanceAllocationResponse
 
struct  GetTradesHistoricalParams
 Query parameters for get_trades_historical. More...
 
struct  GetTradesParams
 Query parameters for get_trades. More...
 
struct  GetTradesResponse
 
struct  GetUserDataTimestampResponse
 
struct  GetWeatherIndexCalibrationsResponse
 
struct  GetWeatherIndexParams
 Query parameters for get_weather_index. More...
 
struct  GetWeatherIndexResponse
 
struct  GetWithdrawalsParams
 Query parameters for get_withdrawals. More...
 
struct  GetWithdrawalsResponse
 
class  HttpClient
 libcurl transport. More...
 
struct  HttpResponse
 
class  HttpTransport
 Request boundary used by KalshiClient. More...
 
struct  IncentiveProgram
 
struct  IndexedBalance
 
struct  IntraExchangeInstanceTransfer
 
struct  IntraExchangeInstanceTransferRequest
 
struct  IntraExchangeInstanceTransferResponse
 
class  KalshiClient
 Client for the Kalshi Predictions REST API. More...
 
struct  ListFCMSubtradersResponse
 
struct  LiveData
 
struct  MaintenanceWindow
 
struct  Market
 
struct  MarketCandlestick
 
struct  MarketCandlestickHistorical
 
struct  MarketCandlesticksResponse
 
struct  MarketMetadata
 
struct  MarketOrderbookFp
 
struct  MarketPosition
 
struct  Milestone
 
struct  MultivariateEventCollection
 
struct  MveSelectedLeg
 
struct  Order
 
struct  OrderbookCountFp
 Orderbook with fixed-point contract counts (fp) in all dollar price levels. More...
 
struct  OrderGroup
 
struct  OrderQueuePosition
 
struct  PercentilePoint
 
struct  PlayByPlay
 Play-by-play data organized by period. More...
 
struct  PlayByPlayPeriodsItem
 
struct  PriceDistribution
 
struct  PriceDistributionHistorical
 
struct  PriceRange
 
struct  ProposeBlockTradeRequest
 
struct  ProposeBlockTradeResponse
 
struct  Quote
 
struct  RateLimitConfig
 Defaults match Kalshi's Basic tier. More...
 
class  RateLimitedTransport
 Transport decorator that paces requests to Kalshi's Read and Write budgets so they are not rejected with 429. More...
 
struct  RawJson
 A JSON value kept as text, for free-form fields such as product metadata. More...
 
struct  ResetOrderGroupParams
 Query parameters for reset_order_group. More...
 
class  RetryingTransport
 Transport decorator that retries transient failures with exponential backoff. More...
 
struct  RetryPolicy
 
struct  RFQ
 
struct  Schedule
 
struct  ScopeList
 
struct  Series
 
struct  SeriesFeeChange
 
struct  SetTargetBalanceAllocationRequest
 
struct  Settlement
 
struct  SettlementSource
 
class  Signer
 Signs Kalshi requests with an API key. More...
 
struct  SportFilterDetails
 
struct  StructuredTarget
 
struct  SubaccountBalance
 
struct  SubaccountNettingConfig
 
struct  SubaccountTransfer
 
struct  TargetBalanceAllocation
 
struct  TargetBalanceAllocationInput
 
struct  TickerPair
 
class  TokenBucket
 Token bucket that refills continuously, the model Kalshi's rate limits use. More...
 
struct  Trade
 
struct  TriggerOrderGroupParams
 Query parameters for trigger_order_group. More...
 
struct  UpdateFCMEventContractDailyCapRequest
 
struct  UpdateFCMSubtraderBlockedCategoriesRequest
 
struct  UpdateFCMSubtraderBlockedCategoriesResponse
 
struct  UpdateOrderGroupLimitParams
 Query parameters for update_order_group_limit. More...
 
struct  UpdateOrderGroupLimitRequest
 
struct  UpdateSubaccountNettingRequest
 
struct  WeatherIndexCalibration
 
struct  WeatherIndexCalibrationStation
 
struct  WeatherIndexPoint
 
struct  WeatherIndexStationReading
 
class  WebSocketClient
 Streams Kalshi's WebSocket channels. More...
 
struct  WeeklySchedule
 
struct  Withdrawal
 
struct  WsConfig
 
struct  WsError
 An error frame from the server, or a problem the client found itself. More...
 

Typedefs

template<typename T >
using Result = std::expected< T, Error >
 Result type for SDK operations.
 
using Timestamp = std::chrono::sys_time< std::chrono::milliseconds >
 
using ExchangeIndex = std::int64_t
 Identifier for an exchange shard.
 
using FixedPointCount = std::string
 Fixed-point contract count string (2 decimals, e.g., "10.00"; referred to as "fp" in field names).
 
using FixedPointDollars = std::string
 Fixed-point US dollar string.
 
using PriceLevelDollarsCountFp = std::array< std::string, 2 >
 Price level in dollars represented as [dollars_string, fp] where dollars_string is like "0.1500" and fp is a FixedPointCount string (fixed-point contract count).
 
using WsMessage = ws::Message
 Everything on_message delivers: channel data as ws::Update<T>, and subscription events.
 

Enumerations

enum class  Environment : std::uint8_t { Production , Demo }
 Kalshi deployment. More...
 
enum class  ErrorCode : std::uint8_t {
  NetworkError , AuthenticationError , InvalidRequest , NotFound ,
  RateLimited , ServerError , ParseError , SigningError ,
  InvalidKey , Unknown
}
 
enum class  HttpMethod : std::uint8_t { GET , POST , PUT , DEL }
 HTTP methods. More...
 
enum class  Action : std::uint8_t { Unknown , Buy , Sell }
 Deprecated. More...
 
enum class  ApiKeyScope : std::uint8_t {
  Unknown , Read , Write , ReadBlockTradeAccept ,
  ReadPortfolioBalance , WriteTrade , WriteTransfer , WriteFcmRisk ,
  WriteBlockTradeAccept
}
 Scope granted to an API key. More...
 
enum class  ApiKeyType : std::uint8_t { Unknown , Rsa , Ed25519 }
 Signature algorithm of an API key pair. More...
 
enum class  BookSide : std::uint8_t { Unknown , Bid , Ask }
 Side of the book for an order or trade. More...
 
enum class  DepositStatus : std::uint8_t {
  Unknown , Pending , Applied , Failed ,
  Returned
}
 Current status of the deposit. More...
 
enum class  DepositType : std::uint8_t {
  Unknown , Ach , Wire , Crypto ,
  Debit , Apm
}
 Payment method used for the deposit. More...
 
enum class  ExchangeInstance : std::uint8_t { Unknown , EventContract , Margined }
 The exchange instance type. More...
 
enum class  FeeType : std::uint8_t {
  Unknown , Quadratic , QuadraticWithMakerFees , QuadraticWithComboMakerFees ,
  Flat
}
 Fee type for a series or scheduled fee override. More...
 
enum class  GetEventsStatus : std::uint8_t {
  Unknown , Unopened , Open , Closed ,
  Settled
}
 Filter by event status. More...
 
enum class  GetHistoricalMarketsMveFilter : std::uint8_t { Unknown , Exclude }
 Filter by multivariate events (combos). More...
 
enum class  GetIncentiveProgramsStatus : std::uint8_t {
  Unknown , All , Active , Upcoming ,
  Closed , PaidOut
}
 Status filter. More...
 
enum class  GetIncentiveProgramsType : std::uint8_t {
  Unknown , All , Liquidity , Volume ,
  MarginMakerVolume , MarginTakerVolume
}
 Type filter. More...
 
enum class  GetMarketsMveFilter : std::uint8_t { Unknown , Only , Exclude }
 Filter by multivariate events (combos). More...
 
enum class  GetMarketsStatus : std::uint8_t {
  Unknown , Unopened , Open , Paused ,
  Closed , Settled
}
 Filter by market status. More...
 
enum class  GetMultivariateEventCollectionsStatus : std::uint8_t { Unknown , Unopened , Open , Closed }
 Only return collections of a certain status. More...
 
enum class  IncentiveProgramIncentiveType : std::uint8_t {
  Unknown , Liquidity , Volume , MarginMakerVolume ,
  MarginTakerVolume
}
 Type of incentive program. More...
 
enum class  IntraExchangeInstanceTransferStatus : std::uint8_t { Unknown , Pending , Complete }
 Transfer status. More...
 
enum class  MarketResult : std::uint8_t {
  Unknown , Yes , No , Scalar ,
  Unset
}
 
enum class  MarketStatus : std::uint8_t {
  Unknown , Initialized , Inactive , Active ,
  Closed , Determined , Disputed , Amended ,
  Finalized
}
 The current status of the market in its lifecycle. More...
 
enum class  MarketType : std::uint8_t { Unknown , Binary , Scalar }
 Identifies the type of market. More...
 
enum class  OrderStatus : std::uint8_t { Unknown , Resting , Canceled , Executed }
 The status of an order. More...
 
enum class  OrderType : std::uint8_t { Unknown , Limit , Market }
 
enum class  OutcomeSide : std::uint8_t { Unknown , Yes , No }
 Outcome side. More...
 
enum class  QuoteStatus : std::uint8_t {
  Unknown , Open , Accepted , Confirmed ,
  Executed , Cancelled
}
 Current status of the quote. More...
 
enum class  RFQStatus : std::uint8_t { Unknown , Open , Closed }
 Current status of the RFQ (open, closed) More...
 
enum class  RestingMarginReservation : std::uint8_t { Unknown , None , Max , Sum }
 Collateral an automatic rebalance leaves behind for resting orders. More...
 
enum class  SelfTradePreventionType : std::uint8_t { Unknown , TakerAtCross , Maker }
 The self-trade prevention type for orders. More...
 
enum class  SettlementMarketResult : std::uint8_t { Unknown , Yes , No , Scalar }
 The outcome of the market settlement. More...
 
enum class  SettlementStatus : std::uint8_t { Unknown , All , Unsettled , Settled }
 Settlement status of the markets to return. More...
 
enum class  Side : std::uint8_t { Unknown , Yes , No }
 Deprecated. More...
 
enum class  StrikeType : std::uint8_t {
  Unknown , Greater , GreaterOrEqual , Less ,
  LessOrEqual , Between , Functional , Custom ,
  Structured
}
 Strike type defines how the market strike is defined and evaluated. More...
 
enum class  TimeInForce : std::uint8_t { Unknown , FillOrKill , GoodTillCanceled , ImmediateOrCancel }
 Specifies how long the order remains active. More...
 
enum class  UserFilter : std::uint8_t { Unknown , Self }
 Omit or leave empty to return all results. More...
 
enum class  KeyType : std::uint8_t { Rsa , Ed25519 }
 Algorithm of the loaded API key. More...
 
enum class  WsState : std::uint8_t { Disconnected , Connecting , Connected , Reconnecting }
 

Functions

RateLimitConfig rate_limit_config (const GetAccountApiLimitsResponse &limits, const GetAccountEndpointCostsResponse &costs)
 Builds a RateLimitedTransport config from get_account_api_limits() and get_account_endpoint_costs().
 
constexpr std::string_view rest_base_url (Environment environment) noexcept
 REST base URL, including the /trade-api/v2 prefix that requests sign.
 
constexpr std::string_view websocket_url (Environment environment) noexcept
 WebSocket URL for streaming market and account data.
 
Result< std::int64_t > to_cents (std::string_view dollars)
 Converts a dollar string such as "0.5600" to whole cents.
 
Result< std::int64_t > to_contracts (std::string_view count)
 Converts a fixed-point count such as "10.00" to whole contracts.
 
Result< Timestamp > parse_timestamp (std::string_view text)
 Parses the RFC 3339 timestamps Kalshi returns, such as "2026-09-25T14:00:00.123Z" or "2026-09-25T10:00:00-04:00".
 
constexpr OutcomeSide outcome_side (Side side, Action action) noexcept
 The outcome a (side, action) pair is exposed to: buying yes or selling no is yes exposure.
 
constexpr BookSide book_side (Side side, Action action) noexcept
 The single-book side for a (side, action) pair: yes exposure bids.
 
constexpr std::string_view to_string (HttpMethod method) noexcept
 
constexpr std::string_view to_string (Action value) noexcept
 
constexpr std::string_view to_string (ApiKeyScope value) noexcept
 
constexpr std::string_view to_string (ApiKeyType value) noexcept
 
constexpr std::string_view to_string (BookSide value) noexcept
 
constexpr std::string_view to_string (DepositStatus value) noexcept
 
constexpr std::string_view to_string (DepositType value) noexcept
 
constexpr std::string_view to_string (ExchangeInstance value) noexcept
 
constexpr std::string_view to_string (FeeType value) noexcept
 
constexpr std::string_view to_string (GetEventsStatus value) noexcept
 
constexpr std::string_view to_string (GetHistoricalMarketsMveFilter value) noexcept
 
constexpr std::string_view to_string (GetIncentiveProgramsStatus value) noexcept
 
constexpr std::string_view to_string (GetIncentiveProgramsType value) noexcept
 
constexpr std::string_view to_string (GetMarketsMveFilter value) noexcept
 
constexpr std::string_view to_string (GetMarketsStatus value) noexcept
 
constexpr std::string_view to_string (GetMultivariateEventCollectionsStatus value) noexcept
 
constexpr std::string_view to_string (IncentiveProgramIncentiveType value) noexcept
 
constexpr std::string_view to_string (IntraExchangeInstanceTransferStatus value) noexcept
 
constexpr std::string_view to_string (MarketResult value) noexcept
 
constexpr std::string_view to_string (MarketStatus value) noexcept
 
constexpr std::string_view to_string (MarketType value) noexcept
 
constexpr std::string_view to_string (OrderStatus value) noexcept
 
constexpr std::string_view to_string (OrderType value) noexcept
 
constexpr std::string_view to_string (OutcomeSide value) noexcept
 
constexpr std::string_view to_string (QuoteStatus value) noexcept
 
constexpr std::string_view to_string (RFQStatus value) noexcept
 
constexpr std::string_view to_string (RestingMarginReservation value) noexcept
 
constexpr std::string_view to_string (SelfTradePreventionType value) noexcept
 
constexpr std::string_view to_string (SettlementMarketResult value) noexcept
 
constexpr std::string_view to_string (SettlementStatus value) noexcept
 
constexpr std::string_view to_string (Side value) noexcept
 
constexpr std::string_view to_string (StrikeType value) noexcept
 
constexpr std::string_view to_string (TimeInForce value) noexcept
 
constexpr std::string_view to_string (UserFilter value) noexcept
 
template<class Fetch , class Response , class Items >
Result< std::vector< typename Items::value_type > > collect_pages (Fetch &&fetch, Items Response::*items, std::size_t max_pages=std::numeric_limits< std::size_t >::max())
 Follows cursors through a list operation and collects every page's items.
 
bool should_retry (HttpMethod method, const HttpResponse &response, const RetryPolicy &policy) noexcept
 
bool should_retry (HttpMethod method, const Error &error, const RetryPolicy &policy) noexcept
 
std::chrono::milliseconds retry_delay (std::uint8_t attempt, const RetryPolicy &policy)
 Backoff before the attempt after attempt (1-based), with jitter applied.
 
constexpr std::string_view to_string (WsState state) noexcept
 

Typedef Documentation

◆ Result

template<typename T >
using kalshi::Result = typedef std::expected<T, Error>

Result type for SDK operations.

◆ Timestamp

using kalshi::Timestamp = typedef std::chrono::sys_time<std::chrono::milliseconds>

◆ ExchangeIndex

using kalshi::ExchangeIndex = typedef std::int64_t

Identifier for an exchange shard.

◆ FixedPointCount

using kalshi::FixedPointCount = typedef std::string

Fixed-point contract count string (2 decimals, e.g., "10.00"; referred to as "fp" in field names).

◆ FixedPointDollars

using kalshi::FixedPointDollars = typedef std::string

Fixed-point US dollar string.

◆ PriceLevelDollarsCountFp

using kalshi::PriceLevelDollarsCountFp = typedef std::array<std::string, 2>

Price level in dollars represented as [dollars_string, fp] where dollars_string is like "0.1500" and fp is a FixedPointCount string (fixed-point contract count).

◆ WsMessage

using kalshi::WsMessage = typedef ws::Message

Everything on_message delivers: channel data as ws::Update<T>, and subscription events.

docs/channels.md lists the types per channel.

Enumeration Type Documentation

◆ Environment

enum class kalshi::Environment : std::uint8_t
strong

Kalshi deployment.

Demo keys work only against demo hosts, and production keys only against production hosts.

Enumerator
Production 
Demo 

◆ ErrorCode

enum class kalshi::ErrorCode : std::uint8_t
strong
Enumerator
NetworkError 

The request did not complete (DNS, TLS, timeout, reset), or HTTP 408.

AuthenticationError 

HTTP 401 or 403.

InvalidRequest 

Rejected before sending, or another HTTP 4xx.

NotFound 

HTTP 404.

RateLimited 

HTTP 429, or a local rate limit that would wait too long.

ServerError 

HTTP 5xx.

ParseError 

The response was not the JSON the API documents.

SigningError 

The request could not be signed.

InvalidKey 

The private key could not be loaded.

Unknown 

◆ HttpMethod

enum class kalshi::HttpMethod : std::uint8_t
strong

HTTP methods.

DEL avoids the DELETE macro from <windows.h>; it is sent as DELETE.

Enumerator
GET 
POST 
PUT 
DEL 

◆ Action

enum class kalshi::Action : std::uint8_t
strong

Deprecated.

Enumerator
Unknown 

A value this SDK version does not know.

Buy 

buy

Sell 

sell

◆ ApiKeyScope

enum class kalshi::ApiKeyScope : std::uint8_t
strong

Scope granted to an API key.

Enumerator
Unknown 

A value this SDK version does not know.

Read 

read

Write 

write

ReadBlockTradeAccept 

read::block_trade_accept

ReadPortfolioBalance 

read::portfolio_balance

WriteTrade 

write::trade

WriteTransfer 

write::transfer

WriteFcmRisk 

write::fcm_risk

WriteBlockTradeAccept 

write::block_trade_accept

◆ ApiKeyType

enum class kalshi::ApiKeyType : std::uint8_t
strong

Signature algorithm of an API key pair.

Enumerator
Unknown 

A value this SDK version does not know.

Rsa 

rsa

Ed25519 

ed25519

◆ BookSide

enum class kalshi::BookSide : std::uint8_t
strong

Side of the book for an order or trade.

Enumerator
Unknown 

A value this SDK version does not know.

Bid 

bid

Ask 

ask

◆ DepositStatus

enum class kalshi::DepositStatus : std::uint8_t
strong

Current status of the deposit.

Enumerator
Unknown 

A value this SDK version does not know.

Pending 

pending

Applied 

applied

Failed 

failed

Returned 

returned

◆ DepositType

enum class kalshi::DepositType : std::uint8_t
strong

Payment method used for the deposit.

Enumerator
Unknown 

A value this SDK version does not know.

Ach 

ach

Wire 

wire

Crypto 

crypto

Debit 

debit

Apm 

apm

◆ ExchangeInstance

enum class kalshi::ExchangeInstance : std::uint8_t
strong

The exchange instance type.

Enumerator
Unknown 

A value this SDK version does not know.

EventContract 

event_contract

Margined 

margined

◆ FeeType

enum class kalshi::FeeType : std::uint8_t
strong

Fee type for a series or scheduled fee override.

Enumerator
Unknown 

A value this SDK version does not know.

Quadratic 

quadratic

QuadraticWithMakerFees 

quadratic_with_maker_fees

QuadraticWithComboMakerFees 

quadratic_with_combo_maker_fees

Flat 

flat

◆ GetEventsStatus

enum class kalshi::GetEventsStatus : std::uint8_t
strong

Filter by event status.

Enumerator
Unknown 

A value this SDK version does not know.

Unopened 

unopened

Open 

open

Closed 

closed

Settled 

settled

◆ GetHistoricalMarketsMveFilter

enum class kalshi::GetHistoricalMarketsMveFilter : std::uint8_t
strong

Filter by multivariate events (combos).

Enumerator
Unknown 

A value this SDK version does not know.

Exclude 

exclude

◆ GetIncentiveProgramsStatus

enum class kalshi::GetIncentiveProgramsStatus : std::uint8_t
strong

Status filter.

Enumerator
Unknown 

A value this SDK version does not know.

All 

all

Active 

active

Upcoming 

upcoming

Closed 

closed

PaidOut 

paid_out

◆ GetIncentiveProgramsType

enum class kalshi::GetIncentiveProgramsType : std::uint8_t
strong

Type filter.

Enumerator
Unknown 

A value this SDK version does not know.

All 

all

Liquidity 

liquidity

Volume 

volume

MarginMakerVolume 

margin_maker_volume

MarginTakerVolume 

margin_taker_volume

◆ GetMarketsMveFilter

enum class kalshi::GetMarketsMveFilter : std::uint8_t
strong

Filter by multivariate events (combos).

Enumerator
Unknown 

A value this SDK version does not know.

Only 

only

Exclude 

exclude

◆ GetMarketsStatus

enum class kalshi::GetMarketsStatus : std::uint8_t
strong

Filter by market status.

Enumerator
Unknown 

A value this SDK version does not know.

Unopened 

unopened

Open 

open

Paused 

paused

Closed 

closed

Settled 

settled

◆ GetMultivariateEventCollectionsStatus

enum class kalshi::GetMultivariateEventCollectionsStatus : std::uint8_t
strong

Only return collections of a certain status.

Enumerator
Unknown 

A value this SDK version does not know.

Unopened 

unopened

Open 

open

Closed 

closed

◆ IncentiveProgramIncentiveType

enum class kalshi::IncentiveProgramIncentiveType : std::uint8_t
strong

Type of incentive program.

Enumerator
Unknown 

A value this SDK version does not know.

Liquidity 

liquidity

Volume 

volume

MarginMakerVolume 

margin_maker_volume

MarginTakerVolume 

margin_taker_volume

◆ IntraExchangeInstanceTransferStatus

enum class kalshi::IntraExchangeInstanceTransferStatus : std::uint8_t
strong

Transfer status.

Enumerator
Unknown 

A value this SDK version does not know.

Pending 

pending

Complete 

complete

◆ MarketResult

enum class kalshi::MarketResult : std::uint8_t
strong
Enumerator
Unknown 

A value this SDK version does not know.

Yes 

yes

No 

no

Scalar 

scalar

Unset 

empty string

◆ MarketStatus

enum class kalshi::MarketStatus : std::uint8_t
strong

The current status of the market in its lifecycle.

Enumerator
Unknown 

A value this SDK version does not know.

Initialized 

initialized

Inactive 

inactive

Active 

active

Closed 

closed

Determined 

determined

Disputed 

disputed

Amended 

amended

Finalized 

finalized

◆ MarketType

enum class kalshi::MarketType : std::uint8_t
strong

Identifies the type of market.

Enumerator
Unknown 

A value this SDK version does not know.

Binary 

binary

Scalar 

scalar

◆ OrderStatus

enum class kalshi::OrderStatus : std::uint8_t
strong

The status of an order.

Enumerator
Unknown 

A value this SDK version does not know.

Resting 

resting

Canceled 

canceled

Executed 

executed

◆ OrderType

enum class kalshi::OrderType : std::uint8_t
strong
Enumerator
Unknown 

A value this SDK version does not know.

Limit 

limit

Market 

market

◆ OutcomeSide

enum class kalshi::OutcomeSide : std::uint8_t
strong

Outcome side.

Enumerator
Unknown 

A value this SDK version does not know.

Yes 

yes

No 

no

◆ QuoteStatus

enum class kalshi::QuoteStatus : std::uint8_t
strong

Current status of the quote.

Enumerator
Unknown 

A value this SDK version does not know.

Open 

open

Accepted 

accepted

Confirmed 

confirmed

Executed 

executed

Cancelled 

cancelled

◆ RFQStatus

enum class kalshi::RFQStatus : std::uint8_t
strong

Current status of the RFQ (open, closed)

Enumerator
Unknown 

A value this SDK version does not know.

Open 

open

Closed 

closed

◆ RestingMarginReservation

enum class kalshi::RestingMarginReservation : std::uint8_t
strong

Collateral an automatic rebalance leaves behind for resting orders.

Enumerator
Unknown 

A value this SDK version does not know.

None 

none

Max 

max

Sum 

sum

◆ SelfTradePreventionType

enum class kalshi::SelfTradePreventionType : std::uint8_t
strong

The self-trade prevention type for orders.

Enumerator
Unknown 

A value this SDK version does not know.

TakerAtCross 

taker_at_cross

Maker 

maker

◆ SettlementMarketResult

enum class kalshi::SettlementMarketResult : std::uint8_t
strong

The outcome of the market settlement.

Enumerator
Unknown 

A value this SDK version does not know.

Yes 

yes

No 

no

Scalar 

scalar

◆ SettlementStatus

enum class kalshi::SettlementStatus : std::uint8_t
strong

Settlement status of the markets to return.

Enumerator
Unknown 

A value this SDK version does not know.

All 

all

Unsettled 

unsettled

Settled 

settled

◆ Side

enum class kalshi::Side : std::uint8_t
strong

Deprecated.

Enumerator
Unknown 

A value this SDK version does not know.

Yes 

yes

No 

no

◆ StrikeType

enum class kalshi::StrikeType : std::uint8_t
strong

Strike type defines how the market strike is defined and evaluated.

Enumerator
Unknown 

A value this SDK version does not know.

Greater 

greater

GreaterOrEqual 

greater_or_equal

Less 

less

LessOrEqual 

less_or_equal

Between 

between

Functional 

functional

Custom 

custom

Structured 

structured

◆ TimeInForce

enum class kalshi::TimeInForce : std::uint8_t
strong

Specifies how long the order remains active.

Enumerator
Unknown 

A value this SDK version does not know.

FillOrKill 

fill_or_kill

GoodTillCanceled 

good_till_canceled

ImmediateOrCancel 

immediate_or_cancel

◆ UserFilter

enum class kalshi::UserFilter : std::uint8_t
strong

Omit or leave empty to return all results.

Enumerator
Unknown 

A value this SDK version does not know.

Self 

self

◆ KeyType

enum class kalshi::KeyType : std::uint8_t
strong

Algorithm of the loaded API key.

Enumerator
Rsa 

RSA-PSS with SHA-256 and a digest-length salt.

Ed25519 

Ed25519 (RFC 8032)

◆ WsState

enum class kalshi::WsState : std::uint8_t
strong
Enumerator
Disconnected 
Connecting 
Connected 
Reconnecting 

Function Documentation

◆ rate_limit_config()

RateLimitConfig kalshi::rate_limit_config ( const GetAccountApiLimitsResponse &  limits,
const GetAccountEndpointCostsResponse &  costs 
)

Builds a RateLimitedTransport config from get_account_api_limits() and get_account_endpoint_costs().

◆ rest_base_url()

constexpr std::string_view kalshi::rest_base_url ( Environment  environment)
constexprnoexcept

REST base URL, including the /trade-api/v2 prefix that requests sign.

◆ websocket_url()

constexpr std::string_view kalshi::websocket_url ( Environment  environment)
constexprnoexcept

WebSocket URL for streaming market and account data.

◆ to_cents()

Result< std::int64_t > kalshi::to_cents ( std::string_view  dollars)
inline

Converts a dollar string such as "0.5600" to whole cents.

Fails instead of rounding when the price has sub-cent digits, as some markets do.

◆ to_contracts()

Result< std::int64_t > kalshi::to_contracts ( std::string_view  count)
inline

Converts a fixed-point count such as "10.00" to whole contracts.

Fails for fractional counts.

◆ parse_timestamp()

Result< Timestamp > kalshi::parse_timestamp ( std::string_view  text)

Parses the RFC 3339 timestamps Kalshi returns, such as "2026-09-25T14:00:00.123Z" or "2026-09-25T10:00:00-04:00".

◆ outcome_side()

constexpr OutcomeSide kalshi::outcome_side ( Side  side,
Action  action 
)
constexprnoexcept

The outcome a (side, action) pair is exposed to: buying yes or selling no is yes exposure.

Unknown if either input is Unknown.

◆ book_side()

constexpr BookSide kalshi::book_side ( Side  side,
Action  action 
)
constexprnoexcept

The single-book side for a (side, action) pair: yes exposure bids.

Unknown if either input is Unknown.

◆ to_string() [1/35]

constexpr std::string_view kalshi::to_string ( HttpMethod  method)
constexprnoexcept

◆ to_string() [2/35]

constexpr std::string_view kalshi::to_string ( Action  value)
constexprnoexcept

◆ to_string() [3/35]

constexpr std::string_view kalshi::to_string ( ApiKeyScope  value)
constexprnoexcept

◆ to_string() [4/35]

constexpr std::string_view kalshi::to_string ( ApiKeyType  value)
constexprnoexcept

◆ to_string() [5/35]

constexpr std::string_view kalshi::to_string ( BookSide  value)
constexprnoexcept

◆ to_string() [6/35]

constexpr std::string_view kalshi::to_string ( DepositStatus  value)
constexprnoexcept

◆ to_string() [7/35]

constexpr std::string_view kalshi::to_string ( DepositType  value)
constexprnoexcept

◆ to_string() [8/35]

constexpr std::string_view kalshi::to_string ( ExchangeInstance  value)
constexprnoexcept

◆ to_string() [9/35]

constexpr std::string_view kalshi::to_string ( FeeType  value)
constexprnoexcept

◆ to_string() [10/35]

constexpr std::string_view kalshi::to_string ( GetEventsStatus  value)
constexprnoexcept

◆ to_string() [11/35]

constexpr std::string_view kalshi::to_string ( GetHistoricalMarketsMveFilter  value)
constexprnoexcept

◆ to_string() [12/35]

constexpr std::string_view kalshi::to_string ( GetIncentiveProgramsStatus  value)
constexprnoexcept

◆ to_string() [13/35]

constexpr std::string_view kalshi::to_string ( GetIncentiveProgramsType  value)
constexprnoexcept

◆ to_string() [14/35]

constexpr std::string_view kalshi::to_string ( GetMarketsMveFilter  value)
constexprnoexcept

◆ to_string() [15/35]

constexpr std::string_view kalshi::to_string ( GetMarketsStatus  value)
constexprnoexcept

◆ to_string() [16/35]

constexpr std::string_view kalshi::to_string ( GetMultivariateEventCollectionsStatus  value)
constexprnoexcept

◆ to_string() [17/35]

constexpr std::string_view kalshi::to_string ( IncentiveProgramIncentiveType  value)
constexprnoexcept

◆ to_string() [18/35]

constexpr std::string_view kalshi::to_string ( IntraExchangeInstanceTransferStatus  value)
constexprnoexcept

◆ to_string() [19/35]

constexpr std::string_view kalshi::to_string ( MarketResult  value)
constexprnoexcept

◆ to_string() [20/35]

constexpr std::string_view kalshi::to_string ( MarketStatus  value)
constexprnoexcept

◆ to_string() [21/35]

constexpr std::string_view kalshi::to_string ( MarketType  value)
constexprnoexcept

◆ to_string() [22/35]

constexpr std::string_view kalshi::to_string ( OrderStatus  value)
constexprnoexcept

◆ to_string() [23/35]

constexpr std::string_view kalshi::to_string ( OrderType  value)
constexprnoexcept

◆ to_string() [24/35]

constexpr std::string_view kalshi::to_string ( OutcomeSide  value)
constexprnoexcept

◆ to_string() [25/35]

constexpr std::string_view kalshi::to_string ( QuoteStatus  value)
constexprnoexcept

◆ to_string() [26/35]

constexpr std::string_view kalshi::to_string ( RFQStatus  value)
constexprnoexcept

◆ to_string() [27/35]

constexpr std::string_view kalshi::to_string ( RestingMarginReservation  value)
constexprnoexcept

◆ to_string() [28/35]

constexpr std::string_view kalshi::to_string ( SelfTradePreventionType  value)
constexprnoexcept

◆ to_string() [29/35]

constexpr std::string_view kalshi::to_string ( SettlementMarketResult  value)
constexprnoexcept

◆ to_string() [30/35]

constexpr std::string_view kalshi::to_string ( SettlementStatus  value)
constexprnoexcept

◆ to_string() [31/35]

constexpr std::string_view kalshi::to_string ( Side  value)
constexprnoexcept

◆ to_string() [32/35]

constexpr std::string_view kalshi::to_string ( StrikeType  value)
constexprnoexcept

◆ to_string() [33/35]

constexpr std::string_view kalshi::to_string ( TimeInForce  value)
constexprnoexcept

◆ to_string() [34/35]

constexpr std::string_view kalshi::to_string ( UserFilter  value)
constexprnoexcept

◆ collect_pages()

template<class Fetch , class Response , class Items >
Result< std::vector< typename Items::value_type > > kalshi::collect_pages ( Fetch &&  fetch,
Items Response::*  items,
std::size_t  max_pages = std::numeric_limits<std::size_t>::max() 
)

Follows cursors through a list operation and collects every page's items.

fetch takes the cursor to request (empty for the first page) and returns the response; items names the response member that holds each page. Collection stops after max_pages pages even if more remain, and fails with ParseError if the server returns the cursor it was just given.

kalshi::GetMarketsParams params{.limit = 1000, .series_ticker = "KXHIGHNY"};
kalshi::Result<std::vector<kalshi::Market>> markets = kalshi::collect_pages(
    [&](std::string_view cursor) {
        params.cursor = cursor.empty() ? std::nullopt : std::optional<std::string>(cursor);
        return client.get_markets(params);
    },
    &kalshi::GetMarketsResponse::markets); 

◆ should_retry() [1/2]

bool kalshi::should_retry ( HttpMethod  method,
const HttpResponse &  response,
const RetryPolicy &  policy 
)
noexcept

◆ should_retry() [2/2]

bool kalshi::should_retry ( HttpMethod  method,
const Error &  error,
const RetryPolicy &  policy 
)
noexcept

◆ retry_delay()

std::chrono::milliseconds kalshi::retry_delay ( std::uint8_t  attempt,
const RetryPolicy &  policy 
)

Backoff before the attempt after attempt (1-based), with jitter applied.

◆ to_string() [35/35]

constexpr std::string_view kalshi::to_string ( WsState  state)
constexprnoexcept