|
kalshi-cpp 0.6.2
C++23 client for Kalshi's Predictions API
|
Transport decorator that paces requests to Kalshi's Read and Write budgets so they are not rejected with 429. More...
#include <kalshi/rate_limit.hpp>
Public Member Functions | |
| RateLimitedTransport (std::shared_ptr< const HttpTransport > inner, RateLimitConfig config) | |
| Result< HttpResponse > | request (HttpMethod method, std::string_view path, std::string_view body={}) const override |
path is relative to the base URL and may carry a query string. | |
| double | cost (HttpMethod method, std::string_view path, std::string_view body) const |
| Token cost this transport charges for a request. | |
Public Member Functions inherited from kalshi::HttpTransport | |
| virtual | ~HttpTransport ()=default |
| Result< HttpResponse > | get (std::string_view path) const |
| Result< HttpResponse > | post (std::string_view path, std::string_view body={}) const |
| Result< HttpResponse > | put (std::string_view path, std::string_view body={}) const |
| Result< HttpResponse > | del (std::string_view path, std::string_view body={}) const |
Static Public Member Functions | |
| static bool | is_write (HttpMethod method, std::string_view path) noexcept |
| Whether a request draws from the Write budget. | |
Transport decorator that paces requests to Kalshi's Read and Write budgets so they are not rejected with 429.
Writes are order, order-group, RFQ, quote, and block-trade mutations; every other request uses the Read budget. Batch requests cost their per-item cost times the number of items. Per-shard Write buckets are not modeled separately, so pacing is conservative when orders target several shards.
Build a config from the account's limits with rate_limit_config() in kalshi/api.hpp.
| kalshi::RateLimitedTransport::RateLimitedTransport | ( | std::shared_ptr< const HttpTransport > | inner, |
| RateLimitConfig | config | ||
| ) |
|
overridevirtual |
path is relative to the base URL and may carry a query string.
Implements kalshi::HttpTransport.
|
staticnoexcept |
Whether a request draws from the Write budget.
| double kalshi::RateLimitedTransport::cost | ( | HttpMethod | method, |
| std::string_view | path, | ||
| std::string_view | body | ||
| ) | const |
Token cost this transport charges for a request.