kalshi-cpp 0.6.2
C++23 client for Kalshi's Predictions API
Loading...
Searching...
No Matches
kalshi::HttpClient Class Referencefinal

libcurl transport. More...

#include <kalshi/http_client.hpp>

Inheritance diagram for kalshi::HttpClient:
kalshi::HttpTransport

Public Member Functions

 HttpClient (Signer signer, ClientConfig config={})
 
 HttpClient (ClientConfig config={})
 
 ~HttpClient () override
 
 HttpClient (HttpClient &&) noexcept
 
HttpClient & operator= (HttpClient &&) noexcept
 
 HttpClient (const HttpClient &)=delete
 
HttpClient & operator= (const HttpClient &)=delete
 
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.
 
const ClientConfig & config () const noexcept
 
Result< HttpResponse > del (std::string_view path, std::string_view body={}) const
 
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
 
- 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
 

Detailed Description

libcurl transport.

Signs every request when constructed with a Signer; without one it sends unauthenticated requests, which is enough for public market data.

Requests on one client run one at a time because they share a libcurl handle and its connection cache. Use one client per thread for parallelism.

Constructor & Destructor Documentation

◆ HttpClient() [1/4]

kalshi::HttpClient::HttpClient ( Signer  signer,
ClientConfig  config = {} 
)
explicit

◆ HttpClient() [2/4]

kalshi::HttpClient::HttpClient ( ClientConfig  config = {})
explicit

◆ ~HttpClient()

kalshi::HttpClient::~HttpClient ( )
override

◆ HttpClient() [3/4]

kalshi::HttpClient::HttpClient ( HttpClient &&  )
noexcept

◆ HttpClient() [4/4]

kalshi::HttpClient::HttpClient ( const HttpClient &  )
delete

Member Function Documentation

◆ operator=() [1/2]

HttpClient & kalshi::HttpClient::operator= ( HttpClient &&  )
noexcept

◆ operator=() [2/2]

HttpClient & kalshi::HttpClient::operator= ( const HttpClient &  )
delete

◆ request()

Result< HttpResponse > kalshi::HttpClient::request ( HttpMethod  method,
std::string_view  path,
std::string_view  body = {} 
) const
overridevirtual

path is relative to the base URL and may carry a query string.

Implements kalshi::HttpTransport.

◆ config()

const ClientConfig & kalshi::HttpClient::config ( ) const
noexcept

◆ del()

Result< HttpResponse > kalshi::HttpTransport::del ( std::string_view  path,
std::string_view  body = {} 
) const
inline

◆ get()

Result< HttpResponse > kalshi::HttpTransport::get ( std::string_view  path) const
inline

◆ post()

Result< HttpResponse > kalshi::HttpTransport::post ( std::string_view  path,
std::string_view  body = {} 
) const
inline

◆ put()

Result< HttpResponse > kalshi::HttpTransport::put ( std::string_view  path,
std::string_view  body = {} 
) const
inline

The documentation for this class was generated from the following file: