100 Position(
const std::string& accId,
const std::string& instId)
111 ,
updateTime(std::chrono::system_clock::now())
216 return !(*
this == other);
Definition matching_engine.hpp:23
合约持仓
Definition position.hpp:45
double shortProfit
空头浮动盈亏
Definition position.hpp:65
int64_t getTotalPosition() const
获取总持仓量
Definition position.hpp:149
void updateProfit(double lastPrice, int volumeMultiple)
更新浮动盈亏
Definition position.hpp:130
int64_t getNetPosition() const
获取净持仓
Definition position.hpp:176
double getTotalProfit() const
获取总浮动盈亏
Definition position.hpp:140
double longMargin
多头占用保证金
Definition position.hpp:58
bool operator==(const Position &other) const
相等比较操作符
Definition position.hpp:196
double longProfit
多头浮动盈亏
Definition position.hpp:57
bool operator!=(const Position &other) const
不等比较操作符
Definition position.hpp:215
std::string instrumentId
合约代码(如 "IF2601")
Definition position.hpp:50
bool hasPosition() const
检查是否有持仓
Definition position.hpp:167
std::chrono::system_clock::time_point updateTime
最后更新时间
Definition position.hpp:71
int64_t shortPosition
空头持仓量(手数)
Definition position.hpp:63
int64_t longPosition
多头持仓量(手数)
Definition position.hpp:55
double longAvgPrice
多头持仓均价
Definition position.hpp:56
Position()
默认构造函数
Definition position.hpp:82
Position(const std::string &accId, const std::string &instId)
带标识符的构造函数
Definition position.hpp:100
double shortAvgPrice
空头持仓均价
Definition position.hpp:64
std::string accountId
账户ID
Definition position.hpp:49
double getTotalMargin() const
获取总占用保证金
Definition position.hpp:158
double shortMargin
空头占用保证金
Definition position.hpp:66