客户端状态管理器
More...
#include <client_state.hpp>
客户端状态管理器
线程安全地管理客户端状态,支持:
- 从 FIX 回调线程更新状态
- 从 TUI 渲染线程读取状态
- 状态变更通知
◆ StateChangeCallback
◆ ClientState()
| fix40::client::ClientState::ClientState |
( |
| ) |
|
|
default |
◆ addMessage()
| void fix40::client::ClientState::addMessage |
( |
const std::string & |
msg | ) |
|
◆ addOrder()
| void fix40::client::ClientState::addOrder |
( |
const OrderInfo & |
order | ) |
|
◆ clearOrders()
| void fix40::client::ClientState::clearOrders |
( |
| ) |
|
◆ clearPositions()
| void fix40::client::ClientState::clearPositions |
( |
| ) |
|
◆ getAccount()
| AccountInfo fix40::client::ClientState::getAccount |
( |
| ) |
const |
◆ getActiveOrders()
| std::vector< OrderInfo > fix40::client::ClientState::getActiveOrders |
( |
| ) |
const |
◆ getConnectionState()
◆ getConnectionStateString()
| std::string fix40::client::ClientState::getConnectionStateString |
( |
| ) |
const |
◆ getLastError()
| std::string fix40::client::ClientState::getLastError |
( |
| ) |
const |
◆ getMessages()
| std::vector< std::string > fix40::client::ClientState::getMessages |
( |
| ) |
const |
◆ getOrders()
| std::vector< OrderInfo > fix40::client::ClientState::getOrders |
( |
| ) |
const |
◆ getPositions()
| std::vector< PositionInfo > fix40::client::ClientState::getPositions |
( |
| ) |
const |
◆ getSearchResults()
| std::vector< std::string > fix40::client::ClientState::getSearchResults |
( |
| ) |
const |
◆ getUserId()
| std::string fix40::client::ClientState::getUserId |
( |
| ) |
const |
◆ loadOrders()
| void fix40::client::ClientState::loadOrders |
( |
const std::string & |
filepath = "" | ) |
|
从文件加载订单
- Parameters
-
| filepath | 文件路径(默认 ~/.fix_client_orders.dat) |
◆ notifyStateChange()
| void fix40::client::ClientState::notifyStateChange |
( |
| ) |
|
◆ saveOrders()
| void fix40::client::ClientState::saveOrders |
( |
const std::string & |
filepath = "" | ) |
|
保存订单到文件
- Parameters
-
| filepath | 文件路径(默认 ~/.fix_client_orders.dat) |
◆ setConnectionState()
| void fix40::client::ClientState::setConnectionState |
( |
ConnectionState |
state | ) |
|
◆ setLastError()
| void fix40::client::ClientState::setLastError |
( |
const std::string & |
error | ) |
|
◆ setOnStateChange()
◆ setOrders()
| void fix40::client::ClientState::setOrders |
( |
const std::vector< OrderInfo > & |
orders | ) |
|
批量设置订单列表
用于“从服务端持久化历史刷新订单列表”等场景: 一次性替换内部订单容器并只触发一次 notifyStateChange(),避免逐条 addOrder 导致的频繁刷新。
- Parameters
-
- Note
- clOrdID 为空的订单会被忽略(静默跳过)。
◆ setPositions()
| void fix40::client::ClientState::setPositions |
( |
const std::vector< PositionInfo > & |
positions | ) |
|
◆ setSearchResults()
| void fix40::client::ClientState::setSearchResults |
( |
const std::vector< std::string > & |
results | ) |
|
◆ setUserId()
| void fix40::client::ClientState::setUserId |
( |
const std::string & |
userId | ) |
|
◆ updateAccount()
| void fix40::client::ClientState::updateAccount |
( |
const AccountInfo & |
info | ) |
|
◆ updateOrder()
| void fix40::client::ClientState::updateOrder |
( |
const std::string & |
clOrdID, |
|
|
const OrderInfo & |
order |
|
) |
| |
◆ updatePosition()
| void fix40::client::ClientState::updatePosition |
( |
const PositionInfo & |
pos | ) |
|
The documentation for this class was generated from the following files: