build
This commit is contained in:
1 parent
59115ce886
commit
f88e1b5903
5 files changed
+7
-11
No files matched your search
@@ -96,7 +96,7 @@ void POVAlgo::update_params()
|
||||
|
||||
void POVAlgo::on_ticker(SecurityKey k, const TradeVector& vec)
|
||||
{
|
||||
TimeSlicer::on_ticker(k, vec);
|
||||
Slicer::on_ticker(k, vec);
|
||||
|
||||
auto side = algo().definition().side();
|
||||
auto other_side = securities::other_side(side);
|
||||
|
||||
@@ -270,7 +270,7 @@ OrderKey Slicer::send_child(Price price, Quantity size, Channel chan)
|
||||
}
|
||||
if(aggression().max_participation_pct() > 0)
|
||||
{
|
||||
double pct = (double)size.value() / (double)me->esimator.running_volume().value();
|
||||
double pct = (double)size.value() / (double)me->estimator.running_volume().value();
|
||||
if(pct*100.0 > aggression().max_participation_pct())
|
||||
{
|
||||
double new_size = me->estimator.running_volume().value() * (aggression().max_participation_pct() / 100.0);
|
||||
|
||||
@@ -90,7 +90,7 @@ void VWAPAlgo::update_params()
|
||||
|
||||
void VWAPAlgo::compute_first_generation(Price&, Quantity& size)
|
||||
{
|
||||
double ratio = running_volume().value() / volume_estimator().day_volume().value();
|
||||
double ratio = volume_estimator().running_volume().value() / volume_estimator().day_volume().value();
|
||||
ratio = std::min(1.0, ratio);
|
||||
ratio = std::max(0.0, ratio);
|
||||
size = Quantity( ratio * size.value() );
|
||||
@@ -99,7 +99,7 @@ void VWAPAlgo::compute_first_generation(Price&, Quantity& size)
|
||||
void VWAPAlgo::compute_next_generation(Price&, Quantity& size)
|
||||
{
|
||||
//TODO predict this period based on prior
|
||||
double ratio = running_volume().value() / volume_estimator().day_volume().value();
|
||||
double ratio = volume_estimator().running_volume().value() / volume_estimator().day_volume().value();
|
||||
ratio = std::min(1.0, ratio);
|
||||
ratio = std::max(0.0, ratio);
|
||||
size = Quantity( ratio * size.value() );
|
||||
|
||||
@@ -17,7 +17,7 @@ const VolumeDistribution& VolumeEstimator::volume_distribution() const
|
||||
{
|
||||
return me->volume_distribution;
|
||||
}
|
||||
const Quantity& VolumeEstimator::running_volume() const
|
||||
Quantity VolumeEstimator::running_volume()
|
||||
{
|
||||
return me->running_volume;
|
||||
}
|
||||
@@ -26,16 +26,12 @@ VolumeEstimator::VolumeEstimator() : me(new PImpl()) {}
|
||||
VolumeEstimator::~VolumeEstimator() {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void VolumeEstimator::on_ticker(SecurityKey, const TradeVector& vec)
|
||||
{
|
||||
for(const auto& t : vec)
|
||||
me->running_volume = std::max(me->running_volume, t.total_volume);
|
||||
me->running_volume = Quantity( std::max(me->running_volume.value(), t.total_volume.value()) );
|
||||
}
|
||||
|
||||
|
||||
bool VolumeEstimator::update_params(const api::orderman::VolumeDistribution& vd)
|
||||
{
|
||||
me->volume_distribution = vd;
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
public:
|
||||
const api::orderman::VolumeDistribution& volume_distribution() const;
|
||||
const Quantity& VolumeEstimator::running_volume() const;
|
||||
Quantity running_volume();
|
||||
|
||||
protected:
|
||||
struct PImpl;
|
||||
|
||||
Reference in new issue
Block a user