21 using Newtonsoft.Json;
24 using System.Collections.Generic;
33 [ProtoContract(SkipConstructor =
true)]
34 [ProtoInclude(8, typeof(
Tick))]
35 [ProtoInclude(100, typeof(
TradeBar))]
36 [ProtoInclude(200, typeof(
QuoteBar))]
37 [ProtoInclude(300, typeof(
Dividend))]
38 [ProtoInclude(400, typeof(
Split))]
42 private decimal _value;
87 public DateTime
Time {
get;
set; }
113 public virtual decimal
Value
152 #pragma warning disable 618 // This implementation is left here for backwards compatibility of the BaseData API
153 return Reader(config, line, date, dataFeed);
154 #pragma warning restore 618
168 throw new NotImplementedException(
"Each data types has to implement is own Stream reader");
182 #pragma warning disable 618 // This implementation is left here for backwards compatibility of the BaseData API
183 var source =
GetSource(config, date, dataFeed);
184 #pragma warning restore 618
193 var uri =
new Uri(source, UriKind.RelativeOrAbsolute);
195 if (uri.IsAbsoluteUri && !uri.IsLoopback)
210 return Symbol.RequiresMapping();
271 throw new InvalidOperationException(
"BaseData.DataTimeZone(): is only valid for base data types");
283 Update(lastTrade, 0, 0, tradeSize, 0, 0);
293 public void UpdateQuote(decimal bidPrice, decimal bidSize, decimal askPrice, decimal askSize)
295 Update(0, bidPrice, askPrice, 0, bidSize, askSize);
303 public void UpdateBid(decimal bidPrice, decimal bidSize)
305 Update(0, bidPrice, 0, 0, bidSize, 0);
313 public void UpdateAsk(decimal askPrice, decimal askSize)
315 Update(0, 0, askPrice, 0, 0, askSize);
327 public virtual void Update(decimal lastTrade, decimal bidPrice, decimal askPrice, decimal volume, decimal bidSize, decimal askSize)
343 clone.IsFillForward = fillForward;
365 return $
"{Symbol}: {Value.ToStringInvariant("C
")}";
378 [Obsolete(
"Reader(SubscriptionDataConfig, string, DateTime, DataFeedEndpoint) method has been made obsolete, use Reader(SubscriptionDataConfig, string, DateTime, bool) instead.")]
381 throw new InvalidOperationException(
382 $
"Please implement Reader(SubscriptionDataConfig, string, DateTime, bool) on your custom data type: {GetType().Name}"
394 [Obsolete(
"GetSource(SubscriptionDataConfig, DateTime, DataFeedEndpoint) method has been made obsolete, use GetSource(SubscriptionDataConfig, DateTime, bool) instead.")]
397 throw new InvalidOperationException(
398 $
"Please implement GetSource(SubscriptionDataConfig, DateTime, bool) on your custom data type: {GetType().Name}"
409 var deserialized = JsonConvert.DeserializeObject(serialized, JsonSerializerSettings);
411 var enumerable = deserialized as IEnumerable<BaseData>;
412 if (enumerable !=
null)
417 var data = deserialized as
BaseData;
420 return new[] { data };
423 return Enumerable.Empty<
BaseData>();
426 private static readonly JsonSerializerSettings JsonSerializerSettings =
new JsonSerializerSettings
428 TypeNameHandling = TypeNameHandling.All