17 using System.Runtime.CompilerServices;
24 using System.Collections.Generic;
32 public static partial class Messages
43 "MarketOnOpen orders are not supported for futures and future options.";
49 "There is no data for this symbol yet, please check the security.HasData flag to ensure there is at least one data point.";
54 public static string OrderUpdateNotSupported =
"Brokerage does not support update. You must cancel and re-create instead.";
59 [MethodImpl(MethodImplOptions.AggressiveInlining)]
62 return Invariant($
"The {brokerageModel.GetType().Name} does not support {security.Type} security type.");
68 [MethodImpl(MethodImplOptions.AggressiveInlining)]
71 return Invariant($
"Unfortunately, the {brokerageModel.GetType().Name} brokerage model does not support updating the quantity of Cross Zero Orders.");
77 [MethodImpl(MethodImplOptions.AggressiveInlining)]
80 return Invariant($
"{brokerageModel.GetType().Name}.GetFillModel: Invalid security type {security.Type}");
86 [MethodImpl(MethodImplOptions.AggressiveInlining)]
89 return Invariant($
@"The minimum order size (in quote currency) for {security.Symbol.Value} is {
90 security.SymbolProperties.MinimumOrderSize}. Order quantity was {quantity}.");
96 [MethodImpl(MethodImplOptions.AggressiveInlining)]
97 public static string InvalidOrderSize(Securities.Security security, decimal quantity, decimal price)
99 return Invariant($
@"The minimum order size (in quote currency) for {security.Symbol.Value} is {security.SymbolProperties.MinimumOrderSize}. Order size was {quantity * price}.");
106 [MethodImpl(MethodImplOptions.AggressiveInlining)]
109 return Invariant($
"The {brokerageModel.GetType().Name} does not support {order.Type} order type. Only supports [{string.Join(',', supportedOrderTypes)}]");
116 [MethodImpl(MethodImplOptions.AggressiveInlining)]
119 return Invariant($
@"The {brokerageModel.GetType().Name} does not support {
120 order.TimeInForce.GetType().Name} time in force.");
126 [MethodImpl(MethodImplOptions.AggressiveInlining)]
129 return Invariant($
"Invalid security type: {security.Type}");
135 [MethodImpl(MethodImplOptions.AggressiveInlining)]
138 return Invariant($
"Order type '{orderType}' is not supported for orders that cross the zero holdings threshold in the {brokerageModel.GetType().Name}. This means you cannot change a position from positive to negative or vice versa using this order type. Please close the existing position first.");
144 [MethodImpl(MethodImplOptions.AggressiveInlining)]
147 return Invariant($
"Order type '{orderType}' is not supported to update quantity in the {brokerageModel.GetType().Name}.");
171 [MethodImpl(MethodImplOptions.AggressiveInlining)]
174 return Invariant($
"Order Quantity must be Integer, but provided {order.Quantity}.");
187 [MethodImpl(MethodImplOptions.AggressiveInlining)]
190 return Invariant($
"{order.Type} orders are not supported for this symbol ${security.Symbol}");
197 [MethodImpl(MethodImplOptions.AggressiveInlining)]
200 return Invariant($
@"{order.Type} orders are not supported for this symbol. Please check '{baseApiEndpoint}/exchangeInfo?symbol={security.SymbolProperties.MarketTicker}' to see supported order types.");
233 [MethodImpl(MethodImplOptions.AggressiveInlining)]
234 public static string ToString(Brokerages.BrokerageMessageEvent messageEvent)
236 return Invariant($
"{messageEvent.Type} - Code: {messageEvent.Code} - {messageEvent.Message}");
253 public static string Disconnected =
"DefaultBrokerageMessageHandler.Handle(): Disconnected.";
258 public static string Reconnected =
"DefaultBrokerageMessageHandler.Handle(): Reconnected.";
265 "DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are closed, checking back before exchange open.";
270 public static string StillDisconnected =
"DefaultBrokerageMessageHandler.Handle(): Still disconnected, goodbye.";
280 [MethodImpl(MethodImplOptions.AggressiveInlining)]
281 public static string BrokerageInfo(Brokerages.BrokerageMessageEvent messageEvent)
283 return $
"Brokerage Info: {messageEvent.Message}";
289 [MethodImpl(MethodImplOptions.AggressiveInlining)]
292 return $
"Brokerage Warning: {messageEvent.Message}";
299 [MethodImpl(MethodImplOptions.AggressiveInlining)]
302 return Invariant($
@"DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are open, trying to reconnect for {
303 reconnectionTimeout.TotalMinutes} minutes.");
309 [MethodImpl(MethodImplOptions.AggressiveInlining)]
312 return Invariant($
"DefaultBrokerageMessageHandler.Handle(): TimeUntilNextMarketOpen: {timeUntilNextMarketOpen}");
345 public static string TriggerPriceTooLow =
"Trigger price too low: must be above current market price.";
358 "Limit Buy orders and Stop Sell orders must be below market, Limit Sell orders and Stop Buy orders must be above market.";
364 [MethodImpl(MethodImplOptions.AggressiveInlining)]
367 return Invariant($
"The order quantity must be a multiple of LotSize: [{security.SymbolProperties.LotSize}].");
373 [MethodImpl(MethodImplOptions.AggressiveInlining)]
376 return Invariant($
@"The {orderType} {orderDirection} order price ({
377 orderPrice}) is too far from the current market price ({currentPrice}).");
394 [MethodImpl(MethodImplOptions.AggressiveInlining)]
397 return Invariant($
"Stop Market orders are no longer supported since {stopMarketOrderSupportEndDate}.");
410 [MethodImpl(MethodImplOptions.AggressiveInlining)]
414 return Invariant($
@"The {brokerageModel.GetType().Name} does not support {
415 order.Type} exercises for index and cash-settled options.");
421 [MethodImpl(MethodImplOptions.AggressiveInlining)]
424 return Invariant($
"The minimum and maximum limits for the allowable order size are ({min}, {max}){currency}.");
441 public static string UnsupportedTimeInForceType = $
"This model only supports orders with the following time in force types: {typeof(DayTimeInForce)} and {typeof(GoodTilCanceledTimeInForce)}";
447 "Tradier does not support extended market hours trading. Your order will be processed at market open.";
462 public static string ShortOrderIsGtc =
"You cannot place short stock orders with GTC, only day orders are allowed";
484 "StopMarket Sell orders must be below market, StopMarket Buy orders must be above market.";
490 "StopLimit Sell orders must be below market, StopLimit Buy orders must be above market.";
496 "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.";
507 [MethodImpl(MethodImplOptions.AggressiveInlining)]
510 return Invariant($
"{order.Type} order is not supported by Wolverine. Currently, only Market Order is supported.");
524 [MethodImpl(MethodImplOptions.AggressiveInlining)]
527 return Invariant($
"{order.Type} order is not supported by RBI. Currently, only Market Order, Limit Order, StopMarket Order and StopLimit Order are supported.");