本文整理汇总了C++中OrderList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderList::end方法的具体用法?C++ OrderList::end怎么用?C++ OrderList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderList
的用法示例。
在下文中一共展示了OrderList::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
ZR::RetVal MyOrders::match( Order * myOrder )
{
if( myOrder->m_locked ) return ZR::ZR_FINISH;
OrderList asks;
m_asks->filterOrders( asks, myOrder->m_currency );
ZR::ZR_Number amount = myOrder->m_amount;
for( OrderIterator askIt = asks.begin(); askIt != asks.end(); askIt++ ) {
Order * other = *askIt;
if( other->m_ignored ) continue; // trying to execute this order did not go well in the past. Don't try again.
if( other->m_isMyOrder ) continue; // don't fill own orders
if( myOrder->m_matched.find( other->m_order_id ) != myOrder->m_matched.end() ) continue; // matched that already
if( myOrder->m_price < other->m_price ) break; // no need to try and find matches beyond
std::cerr << "Zero Reserve: Match at ask price " << other->m_price.toStdString() << std::endl;
myOrder->m_matched.insert( other->m_order_id );
if( amount > other->m_amount ) {
buy( other, myOrder, other->m_amount );
}
else {
buy( other, myOrder, amount );
return ZR::ZR_FINISH;
}
amount -= other->m_amount;
}
return ZR::ZR_SUCCESS;
}
示例2: init
ZR::RetVal MyOrders::init()
{
try {
OrderList myorders;
ZrDB::Instance()->loadOrders( &myorders );
for( OrderIterator it = myorders.begin(); it != myorders.end(); it++) {
Order * order = *it;
addOrder( order );
if( order->m_orderType == Order::ASK ) {
m_asks->addOrder( order );
}
else {
m_bids->addOrder( order );
}
}
}
catch( std::runtime_error & e ) {
g_ZeroReservePlugin->placeMsg( std::string( "Exception caught: " ) + e.what() );
return ZR::ZR_FAILURE;
}
return ZR::ZR_SUCCESS;
}