29 namespace graphene {
namespace grouped_orders {
63 {
return _tracked_groups; }
72 flat_set<uint16_t> _tracked_groups;
75 map< limit_order_group_key, limit_order_group_data > _og_data;
86 auto create_ogo = [&]() {
101 bool capped_max =
false;
102 bool capped_min =
false;
115 bool check_previous =
false;
116 if( itr == idx.end() || itr->first.group != group
120 check_previous =
true;
123 bool update_max =
false;
124 if( capped_price > itr->second.max_price )
129 if( capped_price > max_price )
130 check_previous =
true;
132 if( !check_previous )
134 if( capped_min && o.
sell_price < itr->first.min_price )
143 if( update_max || ( capped_max && o.
sell_price > itr->second.max_price ) )
145 itr->second.total_for_sale += o.
for_sale;
152 if( itr == idx.begin() )
168 if( capped_price < min_price )
170 else if( capped_max && o.
sell_price >= itr->first.min_price )
174 itr->second.total_for_sale += o.
for_sale;
198 remove_order( o,
false );
206 void limit_order_group_index::remove_order(
const limit_order_object& o,
bool remove_empty )
208 auto& idx = _og_data;
214 if( itr == idx.end() || itr->first.group != group
220 wlog(
"can not find the order group containing order for removing (price dismatch): ${o}", (
"o",o) );
225 if( itr->second.total_for_sale < o.
for_sale )
227 wlog(
"can not find the order group containing order for removing (amount dismatch): ${o}", (
"o",o) );
228 else if( !remove_empty || itr->second.total_for_sale > o.
for_sale )
229 itr->second.total_for_sale -= o.
for_sale;
242 my(
std::make_unique<detail::grouped_orders_plugin_impl>(*this) )
251 return "grouped_orders";
255 boost::program_options::options_description& cli,
256 boost::program_options::options_description& cfg
260 (
"tracked-groups", boost::program_options::value<string>()->default_value(
"[10,100]"),
261 "Group orders by percentage increase on price. Specify a JSON array of numbers here, each number is a group, number 1 means 0.01%. ")
269 if( options.count(
"tracked-groups" ) > 0 )
271 const std::string& groups = options[
"tracked-groups"].as<
string>();
273 my->_tracked_groups.erase( 0 );
290 return my->_tracked_groups;
298 return logidx.get_order_groups();