AlgoStudio - default stop limit order stop price to 0 instead of NaN to remove red-error-border

This commit is contained in:
John Colvin committed 2019-01-31 22:03:27 -06:00
1 parent ef4ad21a01
commit 0f18d733eb
1 file changed
+12
@@ -45,6 +45,18 @@ namespace mbts.spark {
// TODO: the StopLimitOrderDefinition needs relative vs absolute prices to function as a useful template (talk to Pedro)
}
protected override void _on_security_changed(SecurityMD? security_md) {
base._on_security_changed(security_md);
if (!security_md.HasValue) {
if (double.IsNaN(stop_price)) {
// If security is null, then it is safe to default to 0.0 and clear the error
// (obviously the user isn't placing any orders with a null security!), thus removing the red error border.
// Note: algo vms in AlgoStudioWindow pass a null security_md down the pipe (1/31/2019).
stop_price = 0;
}
}
}
// no need to constantly poll the md, just check the inline props when the popup opens, and right before sending an order
// (if the user never looks at the popup, assume that the bid_price will be used)
// TODO: add settings so the trigger-price can default to something relative to the md, e.g "bid-price" or "ask-price - nticks" or "best-bid-price with a minimum size of 10"