ladder mid tick rounds down for negative numbers (still rounds up for positive)

This commit is contained in:
John Colvin committed 2020-06-16 16:40:28 -05:00
1 parent d8d5f3b93c
commit ec0b726751
1 file changed
+3 -1
@@ -111,7 +111,9 @@ namespace mbts.spark {
raw_mid = (bid + ask) / 2.0;
}
double tick_size = spec.ticksize(raw_mid);
return raw_mid - (raw_mid % tick_size);
return raw_mid < 0 ?
raw_mid + (raw_mid % tick_size) :
raw_mid - (raw_mid % tick_size);
}
public static TickFactors deduce_ticks(IEnumerable<ContractSpecification> contract_specs) {