17 using System.Collections.Generic;
19 using System.Runtime.CompilerServices;
33 public static partial class Messages
40 [MethodImpl(MethodImplOptions.AggressiveInlining)]
41 public static string FilledAtStalePrice(Securities.Security security,
Prices prices)
43 return Invariant($
"Warning: fill at stale price ({prices.EndTime.ToStringInvariant()} {security.Exchange.TimeZone})");
46 [MethodImpl(MethodImplOptions.AggressiveInlining)]
47 public static string MarketNeverCloses(Securities.Security security,
OrderType orderType)
49 return Invariant($
"Market never closes for this symbol {security.Symbol}, can no submit a {nameof(orderType)} order.");
52 [MethodImpl(MethodImplOptions.AggressiveInlining)]
53 private static string SubscribedTypesToString(HashSet<Type> subscribedTypes)
55 return subscribedTypes ==
null
57 : Invariant($
" SubscribedTypes: [{string.Join(",
", subscribedTypes.Select(type => type.Name))}]");
60 [MethodImpl(MethodImplOptions.AggressiveInlining)]
61 public static string NoMarketDataToGetAskPriceForFilling(Securities.Security security, HashSet<Type> subscribedTypes =
null)
63 return Invariant($
"Cannot get ask price to perform fill for {security.Symbol} because no market data was found.") +
64 SubscribedTypesToString(subscribedTypes);
67 [MethodImpl(MethodImplOptions.AggressiveInlining)]
68 public static string NoMarketDataToGetBidPriceForFilling(Securities.Security security, HashSet<Type> subscribedTypes =
null)
70 return Invariant($
"Cannot get bid price to perform fill for {security.Symbol} because no market data was found.") +
71 SubscribedTypesToString(subscribedTypes);
74 [MethodImpl(MethodImplOptions.AggressiveInlining)]
75 public static string NoDataSubscriptionFoundForFilling(Securities.Security security)
77 return Invariant($
"Cannot perform fill for {security.Symbol} because no data subscription were found.");
86 public static string MarketOnOpenFillNoOfficialOpenOrOpeningPrintsWithinOneMinute =
87 "No trade with the OfficialOpen or OpeningPrints flag within the 1-minute timeout.";
89 public static string MarketOnCloseFillNoOfficialCloseOrClosingPrintsWithinOneMinute =
90 "No trade with the OfficialClose or ClosingPrints flag within the 1-minute timeout.";
92 public static string MarketOnCloseFillNoOfficialCloseOrClosingPrintsWithoutExtendedMarketHours =
93 "No trade with the OfficialClose or ClosingPrints flag for data that does not include extended market hours.";
95 [MethodImpl(MethodImplOptions.AggressiveInlining)]
96 public static string FilledWithLastTickTypeData(
Tick tick)
98 return Invariant($
"Fill with last {tick.TickType} data.");
101 [MethodImpl(MethodImplOptions.AggressiveInlining)]
102 public static string FilledWithQuoteData(Securities.Security security)
104 return Invariant($
@"Warning: No trade information available at {security.LocalTime.ToStringInvariant()} {
105 security.Exchange.TimeZone}, order filled using Quote data");
108 [MethodImpl(MethodImplOptions.AggressiveInlining)]
109 public static string FilledWithQuoteTickData(Securities.Security security,
Tick quoteTick)
111 return Invariant($
@"Warning: fill at stale price ({quoteTick.EndTime.ToStringInvariant()} {
112 security.Exchange.TimeZone}), using Quote Tick data.");
115 [MethodImpl(MethodImplOptions.AggressiveInlining)]
116 public static string FilledWithTradeTickData(Securities.Security security,
Tick tradeTick)
118 return Invariant($
@"Warning: No quote information available at {tradeTick.EndTime.ToStringInvariant()} {
119 security.Exchange.TimeZone}, order filled using Trade Tick data");
122 [MethodImpl(MethodImplOptions.AggressiveInlining)]
123 public static string FilledWithQuoteBarData(Securities.Security security,
QuoteBar quoteBar)
125 return Invariant($
@"Warning: fill at stale price ({quoteBar.EndTime.ToStringInvariant()} {
126 security.Exchange.TimeZone}), using QuoteBar data.");
129 [MethodImpl(MethodImplOptions.AggressiveInlining)]
130 public static string FilledWithTradeBarData(Securities.Security security,
TradeBar tradeBar)
132 return Invariant($
@"Warning: No quote information available at {tradeBar.EndTime.ToStringInvariant()} {
133 security.Exchange.TimeZone}, order filled using TradeBar data");
136 [MethodImpl(MethodImplOptions.AggressiveInlining)]
137 public static string FilledWithOpenDueToFavorableGap(Securities.Security security,
TradeBar tradeBar)
139 return Invariant($
@"Due to a favorable gap at {tradeBar.EndTime.ToStringInvariant()} {security.Exchange.TimeZone}, order filled using the open price ({tradeBar.Open})");
142 [MethodImpl(MethodImplOptions.AggressiveInlining)]
143 public static string FilledWithOpenDueToUnfavorableGap(Securities.Security security,
TradeBar tradeBar)
145 return Invariant($
@"Due to an unfavorable gap at {tradeBar.EndTime.ToStringInvariant()} {security.Exchange.TimeZone}, order filled using the open price ({tradeBar.Open})");