#include "SimpleSellStrategy.h" #include "Stock.h" #include SimpleSellStrategy::SimpleSellStrategy( double minGain ) : minGain_( minGain ) { } SimpleSellStrategy::~SimpleSellStrategy() { } long SimpleSellStrategy::buy( Stock* stock, double capitalAvailable, double buyPrice, long amount ) { double stockPrice = stock->price(); double gain = ( stockPrice - buyPrice ) / buyPrice; if ( gain >= minGain_ ) { price_ = stockPrice * 1.001; return - amount; } return 0; }