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 'https://api.binance.com/api/v3/exchangeInfo?symbol={
201 security.SymbolProperties.MarketTicker}' to see supported order types.");
234 [MethodImpl(MethodImplOptions.AggressiveInlining)]
235 public static string ToString(Brokerages.BrokerageMessageEvent messageEvent)
237 return Invariant($
"{messageEvent.Type} - Code: {messageEvent.Code} - {messageEvent.Message}");
254 public static string Disconnected =
"DefaultBrokerageMessageHandler.Handle(): Disconnected.";
259 public static string Reconnected =
"DefaultBrokerageMessageHandler.Handle(): Reconnected.";
266 "DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are closed, checking back before exchange open.";
271 public static string StillDisconnected =
"DefaultBrokerageMessageHandler.Handle(): Still disconnected, goodbye.";
281 [MethodImpl(MethodImplOptions.AggressiveInlining)]
282 public static string BrokerageInfo(Brokerages.BrokerageMessageEvent messageEvent)
284 return $
"Brokerage Info: {messageEvent.Message}";
290 [MethodImpl(MethodImplOptions.AggressiveInlining)]
293 return $
"Brokerage Warning: {messageEvent.Message}";
300 [MethodImpl(MethodImplOptions.AggressiveInlining)]
303 return Invariant($
@"DefaultBrokerageMessageHandler.Handle(): Disconnect when exchanges are open, trying to reconnect for {
304 reconnectionTimeout.TotalMinutes} minutes.");
310 [MethodImpl(MethodImplOptions.AggressiveInlining)]
313 return Invariant($
"DefaultBrokerageMessageHandler.Handle(): TimeUntilNextMarketOpen: {timeUntilNextMarketOpen}");
346 public static string TriggerPriceTooLow =
"Trigger price too low: must be above current market price.";
359 "Limit Buy orders and Stop Sell orders must be below market, Limit Sell orders and Stop Buy orders must be above market.";
365 [MethodImpl(MethodImplOptions.AggressiveInlining)]
368 return Invariant($
"The order quantity must be a multiple of LotSize: [{security.SymbolProperties.LotSize}].");
374 [MethodImpl(MethodImplOptions.AggressiveInlining)]
377 return Invariant($
@"The {orderType} {orderDirection} order price ({
378 orderPrice}) is too far from the current market price ({currentPrice}).");
395 [MethodImpl(MethodImplOptions.AggressiveInlining)]
398 return Invariant($
"Stop Market orders are no longer supported since {stopMarketOrderSupportEndDate}.");
411 [MethodImpl(MethodImplOptions.AggressiveInlining)]
415 return Invariant($
@"The {brokerageModel.GetType().Name} does not support {
416 order.Type} exercises for index and cash-settled options.");
422 [MethodImpl(MethodImplOptions.AggressiveInlining)]
425 return Invariant($
"The minimum and maximum limits for the allowable order size are ({min}, {max}){currency}.");
442 public static string UnsupportedTimeInForceType = $
"This model only supports orders with the following time in force types: {typeof(DayTimeInForce)} and {typeof(GoodTilCanceledTimeInForce)}";
448 "Tradier does not support extended market hours trading. Your order will be processed at market open.";
463 public static string ShortOrderIsGtc =
"You cannot place short stock orders with GTC, only day orders are allowed";
485 "StopMarket Sell orders must be below market, StopMarket Buy orders must be above market.";
491 "StopLimit Sell orders must be below market, StopLimit Buy orders must be above market.";
497 "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.";
508 [MethodImpl(MethodImplOptions.AggressiveInlining)]
511 return Invariant($
"{order.Type} order is not supported by Wolverine. Currently, only Market Order is supported.");
525 [MethodImpl(MethodImplOptions.AggressiveInlining)]
528 return Invariant($
"{order.Type} order is not supported by RBI. Currently, only Market Order, Limit Order, StopMarket Order and StopLimit Order are supported.");