Lean  $LEAN_TAG$
Messages.Orders.Fees.cs
1 /*
2  * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3  * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14 */
15 
16 using System.Runtime.CompilerServices;
17 
19 
20 using static QuantConnect.StringExtensions;
21 
22 namespace QuantConnect
23 {
24  /// <summary>
25  /// Provides user-facing message construction methods and static messages for the <see cref="Orders.Fees"/> namespace
26  /// </summary>
27  public static partial class Messages
28  {
29  /// <summary>
30  /// Provides user-facing messages for the <see cref="Orders.Fees.FeeModel"/> class and its consumers or related classes
31  /// </summary>
32  public static class FeeModel
33  {
34  /// <summary>
35  /// Returns a string message saying the type of the given security is unsupported
36  /// </summary>
37  [MethodImpl(MethodImplOptions.AggressiveInlining)]
38  public static string UnsupportedSecurityType(Securities.Security security)
39  {
40  return Invariant($"Unsupported security type: {security.Type}");
41  }
42  }
43 
44  /// <summary>
45  /// Provides user-facing messages for the <see cref="Orders.Fees.AlphaStreamsFeeModel"/> class and its consumers or related classes
46  /// </summary>
47  public static class AlphaStreamsFeeModel
48  {
49  /// <summary>
50  /// Returns a string message saying the given market is unexpected
51  /// </summary>
52  [MethodImpl(MethodImplOptions.AggressiveInlining)]
53  public static string UnexpectedEquityMarket(string market)
54  {
55  return Invariant($"AlphaStreamsFeeModel(): unexpected equity Market {market}");
56  }
57  }
58 
59  /// <summary>
60  /// Provides user-facing messages for the <see cref="Orders.Fees.ExanteFeeModel"/> class and its consumers or related classes
61  /// </summary>
62  public static class ExanteFeeModel
63  {
64  /// <summary>
65  /// Returns a string message saying the market associated with the given order symbol is unsupported
66  /// </summary>
67  [MethodImpl(MethodImplOptions.AggressiveInlining)]
68  public static string UnsupportedExchange(Orders.Order order)
69  {
70  return Invariant($"Unsupported exchange: ${order.Symbol.ID.Market}");
71  }
72  }
73 
74  /// <summary>
75  /// Provides user-facing messages for the <see cref="Orders.Fees.InteractiveBrokersFeeModel"/> class and its consumers or related classes
76  /// </summary>
77  public static class InteractiveBrokersFeeModel
78  {
79  /// <summary>
80  /// Returns a string message saying the given option market was unexpected
81  /// </summary>
82  [MethodImpl(MethodImplOptions.AggressiveInlining)]
83  public static string UnexpectedOptionMarket(string market)
84  {
85  return Invariant($"InteractiveBrokersFeeModel(): unexpected option Market {market}");
86  }
87 
88  /// <summary>
89  /// Returns a string message saying the given future market was unexpected
90  /// </summary>
91  [MethodImpl(MethodImplOptions.AggressiveInlining)]
92  public static string UnexpectedFutureMarket(string market)
93  {
94  return Invariant($"InteractiveBrokersFeeModel(): unexpected future Market {market}");
95  }
96 
97  /// <summary>
98  /// Returns a string message saying the given equity market was unexpected
99  /// </summary>
100  [MethodImpl(MethodImplOptions.AggressiveInlining)]
101  public static string UnexpectedEquityMarket(string market)
102  {
103  return Invariant($"InteractiveBrokersFeeModel(): unexpected equity Market {market}");
104  }
105 
106  /// <summary>
107  /// Returns a string message saying the type of the given security was unsupported
108  /// </summary>
109  [MethodImpl(MethodImplOptions.AggressiveInlining)]
110  public static string UnitedStatesFutureFeesUnsupportedSecurityType(Securities.Security security)
111  {
112  return Invariant($"InteractiveBrokersFeeModel.UnitedStatesFutureFees(): Unsupported security type: {security.Type}");
113  }
114 
115  /// <summary>
116  /// Returns a string message saying the type of the given security was unsupported
117  /// </summary>
118  [MethodImpl(MethodImplOptions.AggressiveInlining)]
119  public static string EUREXFutureFeesUnsupportedSecurityType(Securities.Security security)
120  {
121  return Invariant($"InteractiveBrokersFeeModel.EUREXFutureFees(): Unsupported security type: {security.Type}");
122  }
123 
124  /// <summary>
125  /// Returns a string message saying the quote currency of the given security was
126  /// unexpected for Hong Kong futures exchange
127  /// </summary>
128  [MethodImpl(MethodImplOptions.AggressiveInlining)]
129  public static string HongKongFutureFeesUnexpectedQuoteCurrency(Securities.Security security)
130  {
131  return Invariant($"Unexpected quote currency {security.QuoteCurrency.Symbol} for Hong Kong futures exchange");
132  }
133  }
134 
135  /// <summary>
136  /// Provides user-facing messages for the <see cref="Orders.Fees.TDAmeritradeFeeModel"/> class and its consumers or related classes
137  /// </summary>
138  public static class TDAmeritradeFeeModel
139  {
140  /// <summary>
141  /// Returns a string message for unsupported security types in TDAmeritradeFeeModel
142  /// </summary>
143  [MethodImpl(MethodImplOptions.AggressiveInlining)]
144  public static string UnsupportedSecurityType(SecurityType securityType)
145  {
146  return $"TDAmeritradeFeeModel doesn't return correct fee model for SecurityType = {nameof(securityType)}";
147  }
148  }
149  }
150 }