Lean  $LEAN_TAG$
TerminalLinkOrderProperties.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 
17 using System.Collections.Generic;
18 
19 namespace QuantConnect.Orders
20 {
21  /// <summary>
22  /// The terminal link order properties
23  /// </summary>
25  {
26  /// <summary>
27  /// The EMSX Instructions is the free form instructions that may be sent to the broker
28  /// </summary>
29  public string Notes { get; set; }
30 
31  /// <summary>
32  /// The EMSX Handling Instruction is the instructions for handling the order or route.The values can be
33  /// preconfigured or a value customized by the broker.
34  /// </summary>
35  public string HandlingInstruction { get; set; }
36 
37  /// <summary>
38  /// The execution instruction field
39  /// </summary>
40  public string ExecutionInstruction { get; set; }
41 
42  /// <summary>
43  /// Custom user order notes 1
44  /// </summary>
45  public string CustomNotes1 { get; set; }
46 
47  /// <summary>
48  /// Custom user order notes 2
49  /// </summary>
50  public string CustomNotes2 { get; set; }
51 
52  /// <summary>
53  /// Custom user order notes 3
54  /// </summary>
55  public string CustomNotes3 { get; set; }
56 
57  /// <summary>
58  /// Custom user order notes 4
59  /// </summary>
60  public string CustomNotes4 { get; set; }
61 
62  /// <summary>
63  /// Custom user order notes 5
64  /// </summary>
65  public string CustomNotes5 { get; set; }
66 
67  /// <summary>
68  /// The EMSX account
69  /// </summary>
70  public string Account { get; set; }
71 
72  /// <summary>
73  /// The EMSX broker code
74  /// </summary>
75  public string Broker { get; set; }
76 
77  /// <summary>
78  /// The EMSX order strategy details.
79  /// Strategy parameters must be appended in the correct order as expected by EMSX.
80  /// </summary>
81  public StrategyParameters Strategy { get; set; }
82 
83  /// <summary>
84  /// Whether to automatically include the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell)
85  /// </summary>
86  public bool AutomaticPositionSides { get; set; }
87 
88  /// <summary>
89  /// Can optionally specify the position side in the order direction (buy-to-open, sell-to-close, etc.) instead of the default (buy, sell)
90  /// </summary>
91  /// <remarks>Has precedence over <see cref="AutomaticPositionSides"/></remarks>
92  public OrderPosition? PositionSide { get; set; }
93 
94  /// <summary>
95  /// Models an EMSX order strategy parameter
96  /// </summary>
97  public class StrategyParameters
98  {
99  /// <summary>
100  /// The strategy name
101  /// </summary>
102  public string Name { get; set; }
103 
104  /// <summary>
105  /// The strategy fields
106  /// </summary>
107  public List<StrategyField> Fields { get; set; }
108 
109  /// <summary>
110  /// Creates a new TerminalLink order strategy instance
111  /// </summary>
112  /// <param name="name">The strategy name</param>
113  /// <param name="fields">The strategy fields</param>
114  public StrategyParameters(string name, List<StrategyField> fields)
115  {
116  Name = name;
117  Fields = fields;
118  }
119  }
120 
121  /// <summary>
122  /// Models an EMSX order strategy field
123  /// </summary>
124  public class StrategyField
125  {
126  /// <summary>
127  /// The strategy field value
128  /// </summary>
129  public string Value { get; set; }
130 
131  /// <summary>
132  /// Whether the strategy field carries a value
133  /// </summary>
134  public bool HasValue { get; set; }
135 
136  /// <summary>
137  /// Creates a new TerminalLink order strategy field carrying a value.
138  /// </summary>
139  /// <param name="value">The strategy field value</param>
140  public StrategyField(string value)
141  {
142  Value = value;
143  HasValue = true;
144  }
145 
146  /// <summary>
147  /// Creates a new TerminalLink order strategy field without a value.
148  /// </summary>
149  public StrategyField()
150  {
151  HasValue = false;
152  }
153  }
154  }
155 }