twapping
This commit is contained in:
1 parent
a3d2df9ba2
commit
18489e64a2
1 file changed
+9
-2
@@ -216,10 +216,12 @@ void TimeSlicer::on_timer()
|
||||
return;
|
||||
}
|
||||
if(me->generation == 0)
|
||||
{
|
||||
first_generation();
|
||||
me->generation++;
|
||||
}
|
||||
else
|
||||
next_generation();
|
||||
me->generation++;
|
||||
break;
|
||||
}
|
||||
case Status::DONE:
|
||||
@@ -310,7 +312,10 @@ OrderKey TimeSlicer::upgrade(OrderKey key, Price price, Channel chan)
|
||||
else
|
||||
{
|
||||
uint32_t quan = cs->second.quantity.value() - cs->second.total_fills.value();
|
||||
return send_child(Price(price), Quantity(quan), chan);
|
||||
if(quan > 0)
|
||||
return send_child(Price(price), Quantity(quan), chan);
|
||||
else
|
||||
return null_order_key();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,6 +340,8 @@ void TimeSlicer::next_generation()
|
||||
double gen = elapsed / me->duration.discretization_interval_in_seconds();
|
||||
if(gen <= me->generation)
|
||||
return;
|
||||
else
|
||||
me->generation++;
|
||||
if(me->total_filled.value() >= algo().quantity().value())
|
||||
{
|
||||
get_done(); //early
|
||||
|
||||
Reference in new issue
Block a user