High-performance asynchronous FIX client using ASIO.
More...
#include <FixClientSession.h>
|
| | FixClientSession (asio::io_context &ioContext, const std::string &senderCompId, const std::string &targetCompId, const std::string &seqStoreDir="seq_store") |
| | Constructs a new FIX Client Session.
|
| |
| | ~FixClientSession () |
| |
| void | connect (const std::string &host, short port) |
| | Connects to the remote FIX server asynchronously.
|
| |
| void | disconnect () |
| | Closes the socket and stops reading.
|
| |
| const std::string & | getSenderCompId () const |
| |
| FixClientState | getState () const |
| |
| void | sendAuthRequest (const std::string &username, const std::string &password) |
| | Helper to send an authenticated UserRequest (35=BE)
|
| |
| void | sendLogon (int heartbeatInterval=30, bool forceReset=false) |
| | Sends a Logon (35=A) request. Must be called after connect() is successful.
|
| |
| void | sendLogout (const std::string &reason="") |
| | Sends a Logout (35=5) request.
|
| |
| void | sendMarketDataRequest (const std::string &symbol, char subscriptionRequestType='1') |
| |
| void | sendMessage (const std::string &msgType, const std::string &bodyStr) |
| | Queues a raw FIX message body to be properly headed, trailed, sequenced, and sent.
|
| |
| void | sendNewOrder (const std::string &symbol, char side, double price, int qty, char type='2', char tif='0') |
| |
| void | setHeartbeatInterval (int seconds) |
| |
| void | setMessageCallback (MessageCallback cb) |
| |
| void | setStateChangeCallback (StateChangeCallback cb) |
| |
High-performance asynchronous FIX client using ASIO.
◆ MessageCallback
Callback type for when a fully parsed message falls out of the protocol engine.
◆ StateChangeCallback
Callback type for state transitions (e.g. Disconnected -> Active).
◆ FixClientSession()
| fix_client::FixClientSession::FixClientSession |
( |
asio::io_context & |
ioContext, |
|
|
const std::string & |
senderCompId, |
|
|
const std::string & |
targetCompId, |
|
|
const std::string & |
seqStoreDir = "seq_store" |
|
) |
| |
Constructs a new FIX Client Session.
- Parameters
-
| ioContext | The ASIO event loop to run on. |
| senderCompId | This client's identification string (e.g. "MahaSahayak"). |
| targetCompId | The exchange's identification string (e.g. "BETA_EXCHANGE"). |
◆ ~FixClientSession()
| fix_client::FixClientSession::~FixClientSession |
( |
| ) |
|
◆ changeState()
| void fix_client::FixClientSession::changeState |
( |
FixClientState |
newState | ) |
|
|
private |
◆ connect()
| void fix_client::FixClientSession::connect |
( |
const std::string & |
host, |
|
|
short |
port |
|
) |
| |
Connects to the remote FIX server asynchronously.
◆ disconnect()
| void fix_client::FixClientSession::disconnect |
( |
| ) |
|
Closes the socket and stops reading.
◆ doRead()
| void fix_client::FixClientSession::doRead |
( |
| ) |
|
|
private |
◆ doWrite()
| void fix_client::FixClientSession::doWrite |
( |
std::shared_ptr< std::string > |
message | ) |
|
|
private |
◆ getSenderCompId()
| const std::string & fix_client::FixClientSession::getSenderCompId |
( |
| ) |
const |
|
inline |
◆ getState()
◆ handleHeartbeat()
| void fix_client::FixClientSession::handleHeartbeat |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ handleLogonResponse()
| void fix_client::FixClientSession::handleLogonResponse |
( |
const std::string & |
msgStr, |
|
|
uint32_t |
inSeq |
|
) |
| |
|
private |
◆ handleLogoutResponse()
| void fix_client::FixClientSession::handleLogoutResponse |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ handleProtocolMessage()
| void fix_client::FixClientSession::handleProtocolMessage |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ handleResendRequest()
| void fix_client::FixClientSession::handleResendRequest |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ handleSequenceReset()
| void fix_client::FixClientSession::handleSequenceReset |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ handleTestRequest()
| void fix_client::FixClientSession::handleTestRequest |
( |
const std::string & |
msgStr | ) |
|
|
private |
◆ sendAuthRequest()
| void fix_client::FixClientSession::sendAuthRequest |
( |
const std::string & |
username, |
|
|
const std::string & |
password |
|
) |
| |
Helper to send an authenticated UserRequest (35=BE)
◆ sendLogon()
| void fix_client::FixClientSession::sendLogon |
( |
int |
heartbeatInterval = 30, |
|
|
bool |
forceReset = false |
|
) |
| |
Sends a Logon (35=A) request. Must be called after connect() is successful.
- Parameters
-
| heartbeatInterval | Required heartbeat interval (default 30s). |
| forceReset | If true, sends ResetSeqNumFlag=Y and drops seq store to 1. |
◆ sendLogout()
| void fix_client::FixClientSession::sendLogout |
( |
const std::string & |
reason = "" | ) |
|
Sends a Logout (35=5) request.
◆ sendMarketDataRequest()
| void fix_client::FixClientSession::sendMarketDataRequest |
( |
const std::string & |
symbol, |
|
|
char |
subscriptionRequestType = '1' |
|
) |
| |
◆ sendMessage()
| void fix_client::FixClientSession::sendMessage |
( |
const std::string & |
msgType, |
|
|
const std::string & |
bodyStr |
|
) |
| |
Queues a raw FIX message body to be properly headed, trailed, sequenced, and sent.
- Parameters
-
| msgType | The Tag 35 value (e.g. "D" for new order). |
| bodyStr | The raw tag=value body string. |
◆ sendNewOrder()
| void fix_client::FixClientSession::sendNewOrder |
( |
const std::string & |
symbol, |
|
|
char |
side, |
|
|
double |
price, |
|
|
int |
qty, |
|
|
char |
type = '2', |
|
|
char |
tif = '0' |
|
) |
| |
◆ setHeartbeatInterval()
| void fix_client::FixClientSession::setHeartbeatInterval |
( |
int |
seconds | ) |
|
|
inline |
◆ setMessageCallback()
| void fix_client::FixClientSession::setMessageCallback |
( |
MessageCallback |
cb | ) |
|
|
inline |
◆ setStateChangeCallback()
◆ startHeartbeatTimer()
| void fix_client::FixClientSession::startHeartbeatTimer |
( |
| ) |
|
|
private |
◆ startTestRequestTimer()
| void fix_client::FixClientSession::startTestRequestTimer |
( |
| ) |
|
|
private |
◆ FixClientSessionTests
| friend class FixClientSessionTests |
|
friend |
◆ ChunkSize
| constexpr size_t fix_client::FixClientSession::ChunkSize = 8192 |
|
staticconstexprprivate |
◆ mHeartbeatInterval
| int fix_client::FixClientSession::mHeartbeatInterval = 30 |
|
private |
◆ mHeartbeatTimer
| asio::steady_timer fix_client::FixClientSession::mHeartbeatTimer |
|
private |
◆ mIoContext
| asio::io_context& fix_client::FixClientSession::mIoContext |
|
private |
◆ mMessageCb
◆ mReadBuffer
| std::string fix_client::FixClientSession::mReadBuffer |
|
private |
◆ mReadChunk
| std::vector<char> fix_client::FixClientSession::mReadChunk |
|
private |
◆ mResolver
| asio::ip::tcp::resolver fix_client::FixClientSession::mResolver |
|
private |
◆ mSenderCompId
| std::string fix_client::FixClientSession::mSenderCompId |
|
private |
◆ mSeqStore
◆ mSocket
| asio::ip::tcp::socket fix_client::FixClientSession::mSocket |
|
private |
◆ mState
◆ mStateChangeCb
◆ mTargetCompId
| std::string fix_client::FixClientSession::mTargetCompId |
|
private |
◆ mTestReqTimer
| asio::steady_timer fix_client::FixClientSession::mTestReqTimer |
|
private |
The documentation for this class was generated from the following files: