Skip to content

Commit c02a8fa

Browse files
Improve Wolverine brokerage model limitations (#9252)
1 parent e620d3f commit c02a8fa

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

Common/Brokerages/WolverineBrokerageModel.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using QuantConnect.Orders;
1818
using QuantConnect.Securities;
1919
using QuantConnect.Orders.Fees;
20+
using System.Collections.Generic;
2021

2122
namespace QuantConnect.Brokerages
2223
{
@@ -25,6 +26,18 @@ namespace QuantConnect.Brokerages
2526
/// </summary>
2627
public class WolverineBrokerageModel : DefaultBrokerageModel
2728
{
29+
/// <summary>
30+
/// Supported order types
31+
/// </summary>
32+
private HashSet<OrderType> SupportedOrderTypes { get; } =
33+
[
34+
OrderType.Market,
35+
OrderType.MarketOnClose,
36+
OrderType.Limit,
37+
OrderType.StopMarket,
38+
OrderType.StopLimit
39+
];
40+
2841
/// <summary>
2942
/// Constructor for Wolverine brokerage model
3043
/// </summary>
@@ -51,23 +64,18 @@ public override bool CanSubmitOrder(Security security, Order order, out Brokerag
5164
return false;
5265
}
5366

54-
message = null;
55-
if (security.Type != SecurityType.Equity)
67+
if (security.Type != SecurityType.Equity && security.Type != SecurityType.Option)
5668
{
5769
message = new BrokerageMessageEvent(BrokerageMessageType.Warning, "NotSupported",
5870
Messages.DefaultBrokerageModel.UnsupportedSecurityType(this, security));
59-
6071
return false;
6172
}
62-
63-
if (order.Type != OrderType.Market)
73+
if (!SupportedOrderTypes.Contains(order.Type))
6474
{
6575
message = new BrokerageMessageEvent(BrokerageMessageType.Warning, "NotSupported",
66-
Messages.WolverineBrokerageModel.UnsupportedOrderType(order));
67-
76+
Messages.DefaultBrokerageModel.UnsupportedOrderType(this, order, SupportedOrderTypes));
6877
return false;
6978
}
70-
7179
return base.CanSubmitOrder(security, order, out message);
7280
}
7381

0 commit comments

Comments
 (0)