Allow negative payups

This commit is contained in:
Taha Afzal committed 2020-12-23 12:32:45 -05:00
1 parent 7650e15a52
commit 3e189a751d
2 files changed
+4 -4

No files matched your search

@@ -243,7 +243,7 @@ extern "C" void init_sniper_plugin(bts::SparkServices& srv) {
*sniper.add_param_desc() = param_bool("Shoot Real Orders");
*sniper.add_param_desc() = param_double("Min Edge");
*sniper.add_param_desc() = param_uint32("Max Shot Qty");
*sniper.add_param_desc() = param_uint32("Leg Payup Ticks");
*sniper.add_param_desc() = param_int32("Leg Payup Ticks");
*sniper.add_param_desc() = param_double("Min Cumm Edge");
*sniper.add_param_desc() = param_uint32("Min Cumm Qty");
*sniper.add_param_desc() = param_uint32("Throttle(ms)");
@@ -203,7 +203,7 @@ struct SniperAlgoParams{
double min_edge; // in price (TODO, should be in ticks)
// max sniper shot qty
uint16_t max_shot_qty;
uint16_t leg_payup_ticks;
int leg_payup_ticks;
double min_cumm_edge;
uint16_t min_cumm_qty;
bool use_trade_summary;
@@ -317,7 +317,7 @@ bool _convert_params (const CustomOrderDefinition& cod,
auto shoot_real_orders = get_if<bool>(params, "Shoot Real Orders");
auto min_edge = get_if<double>(params, "Min Edge");
auto max_shot_qty = get_if<uint32_t>(params, "Max Shot Qty");
auto leg_payup_ticks = get_if<uint32_t>(params, "Leg Payup Ticks");
auto leg_payup_ticks = get_if<int>(params, "Leg Payup Ticks");
auto min_cumm_edge = get_if<double>(params, "Min Cumm Edge");
auto min_cumm_qty = get_if<uint32_t>(params, "Min Cumm Qty");
auto use_trade_summary = get_if<bool>(params, "Use Trade Summary");
@@ -437,7 +437,7 @@ int leg_mult(const SniperLeg& leg){
return leg.leg_side == api::Side::SIDE_BUY ? leg.leg_qty : -1*leg.leg_qty;
}
Price get_payup_price(Price price, uint16_t payup_ticks,
Price get_payup_price(Price price, int payup_ticks,
const api::Security& sec, api::Side side){
int mult = side == api::Side::SIDE_BUY ? 1 : -1;
return Price(price.value() +