17 using System.Collections.Generic;
18 using System.ComponentModel;
20 using System.Threading;
21 using Newtonsoft.Json;
33 private volatile int _incrementalId;
34 private decimal _quantity;
35 private decimal _price;
41 [JsonProperty(PropertyName =
"id")]
61 [JsonProperty(PropertyName =
"contingentId")]
67 [JsonProperty(PropertyName =
"brokerId")]
68 public List<string>
BrokerId {
get;
internal set; }
73 [JsonProperty(PropertyName =
"symbol")]
79 [JsonProperty(PropertyName =
"price")]
82 get {
return _price; }
83 internal set { _price = value.Normalize(); }
89 [JsonProperty(PropertyName =
"priceCurrency")]
95 [JsonProperty(PropertyName =
"time")]
96 public DateTime
Time {
get;
internal set; }
101 [JsonProperty(PropertyName =
"createdTime")]
107 [JsonProperty(PropertyName =
"lastFillTime", NullValueHandling = NullValueHandling.Ignore)]
113 [JsonProperty(PropertyName =
"lastUpdateTime", NullValueHandling = NullValueHandling.Ignore)]
119 [JsonProperty(PropertyName =
"canceledTime", NullValueHandling = NullValueHandling.Ignore)]
125 [JsonProperty(PropertyName =
"quantity")]
128 get {
return _quantity; }
129 internal set { _quantity = value.Normalize(); }
135 [JsonProperty(PropertyName =
"type")]
141 [JsonProperty(PropertyName =
"status")]
153 [JsonProperty(PropertyName =
"tag" ,DefaultValueHandling = DefaultValueHandling.Ignore)]
154 public string Tag {
get;
internal set; }
159 [JsonProperty(PropertyName =
"properties")]
165 [JsonProperty(PropertyName =
"securityType")]
171 [JsonProperty(PropertyName =
"direction")]
197 [JsonProperty(PropertyName =
"value"), Obsolete(
"Please use Order.GetValue(security) or security.Holdings.HoldingsValue")]
203 [JsonProperty(PropertyName =
"orderSubmissionData")]
209 [JsonProperty(PropertyName =
"isMarketable")]
230 [JsonProperty(PropertyName =
"groupOrderManager", DefaultValueHandling = DefaultValueHandling.Ignore)]
236 [JsonProperty(PropertyName =
"priceAdjustmentMode")]
244 Time =
new DateTime();
286 : this(symbol, quantity, time, null, tag, properties)
300 var security = securities[
Symbol];
338 internal int GetNewId()
340 return Interlocked.Increment(ref _incrementalId);
351 throw new ArgumentException(
"Attempted to apply updates to the incorrect order!");
357 if (request.
Tag !=
null)
421 string tag,
IOrderProperties properties, decimal limitPrice, decimal stopPrice, decimal triggerPrice, decimal trailingAmount,
428 order =
new MarketOrder(symbol, quantity, time, tag, properties);
432 order =
new LimitOrder(symbol, quantity, limitPrice, time, tag, properties);
436 order =
new StopMarketOrder(symbol, quantity, stopPrice, time, tag, properties);
440 order =
new StopLimitOrder(symbol, quantity, stopPrice, limitPrice, time, tag, properties);
444 order =
new TrailingStopOrder(symbol, quantity, stopPrice, trailingAmount, trailingAsPercentage, time, tag, properties);
448 order =
new LimitIfTouchedOrder(symbol, quantity, triggerPrice, limitPrice, time, tag, properties);
464 order =
new ComboLimitOrder(symbol, quantity, limitPrice, time, groupOrderManager, tag, properties);
468 order =
new ComboLegLimitOrder(symbol, quantity, limitPrice, time, groupOrderManager, tag, properties);
472 order =
new ComboMarketOrder(symbol, quantity, time, groupOrderManager, tag, properties);
476 throw new ArgumentOutOfRangeException();