17 using System.Collections.Generic;
35 public new static readonly IReadOnlyDictionary<SecurityType, string>
DefaultMarketMap =
new Dictionary<SecurityType, string>
42 }.ToReadOnlyDictionary();
44 private readonly HashSet<OrderType> _supportedOrderTypes =
new()
91 if (!_supportedOrderTypes.Contains(order.
Type))
112 return IsValidOrderPrices(security,
OrderType.Limit, limit.Direction, security.
Price, limit.LimitPrice, ref message);
116 if (stopMarket !=
null)
118 return IsValidOrderPrices(security,
OrderType.StopMarket, stopMarket.Direction, stopMarket.StopPrice, security.
Price, ref message);
162 return IsValidOrderPrices(security, order.
Type, direction, stopPrice, limitPrice, ref message);
220 var maxDistance = Math.Min(
224 var currentPrice = security.
Price;
225 var minPrice = currentPrice - maxDistance;
226 var maxPrice = currentPrice + maxDistance;
228 var outOfRangePrice = orderType ==
OrderType.Limit && orderDirection ==
OrderDirection.Buy && limitPrice < minPrice ||
235 var orderPrice = orderType ==
OrderType.Limit ? limitPrice : stopPrice;