21 using Newtonsoft.Json;
24 using System.Collections.Generic;
32 [ProtoContract(SkipConstructor =
true)]
33 [ProtoInclude(8, typeof(
Tick))]
34 [ProtoInclude(100, typeof(
TradeBar))]
35 [ProtoInclude(200, typeof(
QuoteBar))]
36 [ProtoInclude(300, typeof(
Dividend))]
37 [ProtoInclude(400, typeof(
Split))]
40 private decimal _value;
85 public DateTime
Time {
get;
set; }
107 public virtual decimal
Value
145 #pragma warning disable 618 // This implementation is left here for backwards compatibility of the BaseData API
146 return Reader(config, line, date, dataFeed);
147 #pragma warning restore 618
161 throw new NotImplementedException(
"Each data types has to implement is own Stream reader");
175 #pragma warning disable 618 // This implementation is left here for backwards compatibility of the BaseData API
176 var source =
GetSource(config, date, dataFeed);
177 #pragma warning restore 618
186 var uri =
new Uri(source, UriKind.RelativeOrAbsolute);
188 if (uri.IsAbsoluteUri && !uri.IsLoopback)
203 return Symbol.RequiresMapping();
264 throw new InvalidOperationException(
"BaseData.DataTimeZone(): is only valid for base data types");
276 Update(lastTrade, 0, 0, tradeSize, 0, 0);
286 public void UpdateQuote(decimal bidPrice, decimal bidSize, decimal askPrice, decimal askSize)
288 Update(0, bidPrice, askPrice, 0, bidSize, askSize);
296 public void UpdateBid(decimal bidPrice, decimal bidSize)
298 Update(0, bidPrice, 0, 0, bidSize, 0);
306 public void UpdateAsk(decimal askPrice, decimal askSize)
308 Update(0, 0, askPrice, 0, 0, askSize);
320 public virtual void Update(decimal lastTrade, decimal bidPrice, decimal askPrice, decimal volume, decimal bidSize, decimal askSize)
336 clone.IsFillForward = fillForward;
358 return $
"{Symbol}: {Value.ToStringInvariant("C
")}";
371 [Obsolete(
"Reader(SubscriptionDataConfig, string, DateTime, DataFeedEndpoint) method has been made obsolete, use Reader(SubscriptionDataConfig, string, DateTime, bool) instead.")]
374 throw new InvalidOperationException(
375 $
"Please implement Reader(SubscriptionDataConfig, string, DateTime, bool) on your custom data type: {GetType().Name}"
387 [Obsolete(
"GetSource(SubscriptionDataConfig, DateTime, DataFeedEndpoint) method has been made obsolete, use GetSource(SubscriptionDataConfig, DateTime, bool) instead.")]
390 throw new InvalidOperationException(
391 $
"Please implement GetSource(SubscriptionDataConfig, DateTime, bool) on your custom data type: {GetType().Name}"
402 var deserialized = JsonConvert.DeserializeObject(serialized, JsonSerializerSettings);
404 var enumerable = deserialized as IEnumerable<BaseData>;
405 if (enumerable !=
null)
410 var data = deserialized as
BaseData;
413 return new[] { data };
416 return Enumerable.Empty<
BaseData>();
419 private static readonly JsonSerializerSettings JsonSerializerSettings =
new JsonSerializerSettings
421 TypeNameHandling = TypeNameHandling.All