17 using System.Runtime.CompilerServices;
24 using System.Collections.Generic;
32 public static partial class Messages
39 public static string UnsupportedMarketOnOpenOrdersForFuturesAndFutureOptions =
40 "MarketOnOpen orders are not supported for futures and future options.";
42 public static string NoDataForSymbol =
43 "There is no data for this symbol yet, please check the security.HasData flag to ensure there is at least one data point.";
45 public static string OrderUpdateNotSupported =
"Brokerage does not support update. You must cancel and re-create instead.";
47 [MethodImpl(MethodImplOptions.AggressiveInlining)]
48 public static string UnsupportedSecurityType(
IBrokerageModel brokerageModel, Securities.Security security)
50 return Invariant($
"The {brokerageModel.GetType().Name} does not support {security.Type} security type.");
53 [MethodImpl(MethodImplOptions.AggressiveInlining)]
54 public static string InvalidSecurityTypeToGetFillModel(
IBrokerageModel brokerageModel, Securities.Security security)
56 return Invariant($
"{brokerageModel.GetType().Name}.GetFillModel: Invalid security type {security.Type}");
59 [MethodImpl(MethodImplOptions.AggressiveInlining)]
60 public static string InvalidOrderQuantity(Securities.Security security, decimal quantity)
62 return Invariant($
@"The minimum order size (in quote currency) for {security.Symbol.Value} is {
63 security.SymbolProperties.MinimumOrderSize}. Order quantity was {quantity}.");
66 [MethodImpl(MethodImplOptions.AggressiveInlining)]
67 public static string InvalidOrderSize(Securities.Security security, decimal quantity, decimal price)
69 return Invariant($
@"The minimum order size (in quote currency) for {security.Symbol.Value} is {security.SymbolProperties.MinimumOrderSize}. Order size was {quantity * price}.");
72 [MethodImpl(MethodImplOptions.AggressiveInlining)]
73 public static string UnsupportedOrderType(
IBrokerageModel brokerageModel, Orders.Order order, IEnumerable<OrderType> supportedOrderTypes)
75 return Invariant($
"The {brokerageModel.GetType().Name} does not support {order.Type} order type. Only supports [{string.Join(',', supportedOrderTypes)}]");
78 [MethodImpl(MethodImplOptions.AggressiveInlining)]
79 public static string UnsupportedTimeInForce(
IBrokerageModel brokerageModel, Orders.Order order)
81 return Invariant($
@"The {brokerageModel.GetType().Name} does not support {
82 order.TimeInForce.GetType().Name} time in force.");
85 [MethodImpl(MethodImplOptions.AggressiveInlining)]
86 public static string InvalidSecurityTypeForLeverage(Securities.Security security)
88 return Invariant($
"Invalid security type: {security.Type}");
97 public static string UnsupportedAccountType =
"The Alpha Streams brokerage does not currently support Cash trading.";
105 [MethodImpl(MethodImplOptions.AggressiveInlining)]
106 public static string NonIntegerOrderQuantity(Orders.Order order)
108 return Invariant($
"Order Quantity must be Integer, but provided {order.Quantity}.");
117 [MethodImpl(MethodImplOptions.AggressiveInlining)]
118 public static string UnsupportedOrderTypeForSecurityType(Orders.Order order, Securities.Security security)
120 return Invariant($
"{order.Type} orders are not supported for this symbol ${security.Symbol}");
123 [MethodImpl(MethodImplOptions.AggressiveInlining)]
124 public static string UnsupportedOrderTypeWithLinkToSupportedTypes(Orders.Order order, Securities.Security security)
126 return Invariant($
@"{order.Type} orders are not supported for this symbol. Please check 'https://api.binance.com/api/v3/exchangeInfo?symbol={
127 security.SymbolProperties.MarketTicker}' to see supported order types.");
136 public static string UnsupportedAccountType =
"The Binance.US brokerage does not currently support Margin trading.";
144 public static string DisconnectCode =
"Disconnect";
146 public static string ReconnectCode =
"Reconnect";
148 [MethodImpl(MethodImplOptions.AggressiveInlining)]
149 public static string ToString(Brokerages.BrokerageMessageEvent messageEvent)
151 return Invariant($
"{messageEvent.Type} - Code: {messageEvent.Code} - {messageEvent.Message}");
160 public static string BrokerageErrorContext =
"Brokerage Error";
162 public static string Disconnected =
"DefaultBrokerageMessageHandler.Handle(): Disconnected.";
164 public static string Reconnected =
"DefaultBrokerageMessageHandler.Handle(): Reconnected.";
166 public static string DisconnectedWhenExchangesAreClosed =
167 "DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are closed, checking back before exchange open.";
169 public static string StillDisconnected =
"DefaultBrokerageMessageHandler.Handle(): Still disconnected, goodbye.";
171 public static string BrokerageDisconnectedShutDownContext =
"Brokerage Disconnect";
173 [MethodImpl(MethodImplOptions.AggressiveInlining)]
174 public static string BrokerageInfo(Brokerages.BrokerageMessageEvent messageEvent)
176 return $
"Brokerage Info: {messageEvent.Message}";
179 [MethodImpl(MethodImplOptions.AggressiveInlining)]
180 public static string BrokerageWarning(Brokerages.BrokerageMessageEvent messageEvent)
182 return $
"Brokerage Warning: {messageEvent.Message}";
185 [MethodImpl(MethodImplOptions.AggressiveInlining)]
186 public static string DisconnectedWhenExchangesAreOpen(TimeSpan reconnectionTimeout)
188 return Invariant($
@"DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are open, trying to reconnect for {
189 reconnectionTimeout.TotalMinutes} minutes.");
192 [MethodImpl(MethodImplOptions.AggressiveInlining)]
193 public static string TimeUntilNextMarketOpen(TimeSpan timeUntilNextMarketOpen)
195 return Invariant($
"DefaultBrokerageMessageHandler.Handle(): TimeUntilNextMarketOpen: {timeUntilNextMarketOpen}");
204 public static string NullOrder =
"Order is null.";
206 public static string PriceNotSet =
"Price is not set.";
214 public static string TriggerPriceTooHigh =
"Trigger price too high: must be below current market price.";
216 public static string TriggerPriceTooLow =
"Trigger price too low: must be above current market price.";
224 public static string InvalidOrderPrice =
225 "Limit Buy orders and Stop Sell orders must be below market, Limit Sell orders and Stop Buy orders must be above market.";
227 [MethodImpl(MethodImplOptions.AggressiveInlining)]
228 public static string InvalidOrderQuantityForLotSize(Securities.Security security)
230 return Invariant($
"The order quantity must be a multiple of LotSize: [{security.SymbolProperties.LotSize}].");
233 [MethodImpl(MethodImplOptions.AggressiveInlining)]
234 public static string PriceOutOfRange(
OrderType orderType,
OrderDirection orderDirection, decimal orderPrice, decimal currentPrice)
236 return Invariant($
@"The {orderType} {orderDirection} order price ({
237 orderPrice}) is too far from the current market price ({currentPrice}).");
246 public static string UnsupportedAccountType =
"The Coinbase brokerage does not currently support Margin trading.";
248 [MethodImpl(MethodImplOptions.AggressiveInlining)]
249 public static string StopMarketOrdersNoLongerSupported(DateTime stopMarketOrderSupportEndDate)
251 return Invariant($
"Stop Market orders are no longer supported since {stopMarketOrderSupportEndDate}.");
260 [MethodImpl(MethodImplOptions.AggressiveInlining)]
261 public static string UnsupportedExerciseForIndexAndCashSettledOptions(Brokerages.InteractiveBrokersBrokerageModel brokerageModel,
264 return Invariant($
@"The {brokerageModel.GetType().Name} does not support {
265 order.Type} exercises for index and cash-settled options.");
268 [MethodImpl(MethodImplOptions.AggressiveInlining)]
269 public static string InvalidForexOrderSize(decimal min, decimal max,
string currency)
271 return Invariant($
"The minimum and maximum limits for the allowable order size are ({min}, {max}){currency}.");
280 public static string UnsupportedSecurityType =
"This model only supports equities and options.";
282 public static string UnsupportedTimeInForceType = $
"This model only supports orders with the following time in force types: {typeof(DayTimeInForce)} and {typeof(GoodTilCanceledTimeInForce)}";
284 public static string ExtendedMarketHoursTradingNotSupported =
285 "Tradier does not support extended market hours trading. Your order will be processed at market open.";
287 public static string OrderQuantityUpdateNotSupported =
"Tradier does not support updating order quantities.";
289 public static string OpenOrdersCancelOnReverseSplitSymbols =
"Tradier Brokerage cancels open orders on reverse split symbols";
291 public static string ShortOrderIsGtc =
"You cannot place short stock orders with GTC, only day orders are allowed";
293 public static string SellShortOrderLastPriceBelow5 =
"Sell Short order cannot be placed for stock priced below $5";
295 public static string IncorrectOrderQuantity =
"Quantity should be between 1 and 10,000,000";
303 public static string InvalidStopMarketOrderPrice =
304 "StopMarket Sell orders must be below market, StopMarket Buy orders must be above market.";
306 public static string InvalidStopLimitOrderPrice =
307 "StopLimit Sell orders must be below market, StopLimit Buy orders must be above market.";
309 public static string InvalidStopLimitOrderLimitPrice =
310 "StopLimit Buy limit price must be greater than or equal to stop price, StopLimit Sell limit price must be smaller than or equal to stop price.";
318 [MethodImpl(MethodImplOptions.AggressiveInlining)]
319 public static string UnsupportedOrderType(Orders.Order order)
321 return Invariant($
"{order.Type} order is not supported by Wolverine. Currently, only Market Order is supported.");
330 [MethodImpl(MethodImplOptions.AggressiveInlining)]
331 public static string UnsupportedOrderType(Orders.Order order)
333 return Invariant($
"{order.Type} order is not supported by RBI. Currently, only Market Order, Limit Order, StopMarket Order and StopLimit Order are supported.");