本文整理汇总了C++中Position::GetQuantity方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::GetQuantity方法的具体用法?C++ Position::GetQuantity怎么用?C++ Position::GetQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::GetQuantity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oLocker
QList<Transaction*> AccountTradeInfo::CreateTransaction(Order const*pOrder,QDateTime const& oTimestamp,size_t nQuantity,double dPrice)
{
QMutexLocker oLocker(&m_mLock);
OrderOperator oOperator;
QList<Transaction*> lTransactions;
auto iPos = m_lPositions.begin();
while(iPos != m_lPositions.begin())
{
Position *pPosition = *iPos;
Transaction* pTransaction = oOperator.Close(pPosition,pOrder,oTimestamp,nQuantity,dPrice);
lTransactions.append(pTransaction);
if(pPosition->GetQuantity() == 0)
{
iPos = m_lPositions.erase(iPos);
RemovePosition(pPosition);
}
else
{
break;
}
}
m_lTradeDayTransactions.append(lTransactions);
UpdateOrder(const_cast<Order*>(pOrder));
SaveTransaction(lTransactions);
return lTransactions;
}
示例2: GetPositionQuantity
size_t AccountTradeInfo::GetPositionQuantity(Direction eDirection,HedgeFlag eHedgeFlag) const
{
QMutexLocker oLocker(&m_mLock);
size_t nQuantity = 0;
for(auto iPos = m_lPositions.begin() ; iPos != m_lPositions.end() ; iPos++)
{
Position *pPosition = *iPos;
if(pPosition->GetDirection() == eDirection && pPosition->GetHedgeFlag() == eHedgeFlag)
{
nQuantity += pPosition->GetQuantity();
}
}
return nQuantity;
}