public void CacheTest() { var taks = new Task <ProtocolTests>[] { new Task <ProtocolTests>(() => null) }; var type = taks.GetType(); var fullName = type.Name; //var genericType = type.GetGenericTypeDefinition(); //var genericFullname = genericType.FullName; //var gt = type.GenericTypeArguments[0]; //var gf = gt.FullName; var element = type.GetElementType()?.FullName; var cache = new Cache(); var watch = Stopwatch.StartNew(); var seed = ByteArray.New(18).Bytes; for (int i = 0; i < 1000000; i++) { var key = ByteArray.Create(seed); if (!cache.Contains(key)) { cache.AddData(key, seed, 0, seed.Length); } cache.TryGetData(key, out var b); } watch.Stop(); }
/// <summary> /// Update any security properties based on the latest market data and time /// </summary> /// <param name="data">New data packet from LEAN</param> public void SetMarketPrice(BaseData data) { //Add new point to cache: if (data == null) return; Cache.AddData(data); UpdateConsumersMarketPrice(data); }
/// <summary> /// Update any security properties based on the lastest market data and time /// </summary> /// <param name="data">New data packet from LEAN</param> public void SetMarketPrice(BaseData data) { //Add new point to cache: if (data == null) { return; } Cache.AddData(data); Holdings.UpdateMarketPrice(data.Value); }
/// <summary> /// Update any security properties based on the latest market data and time /// </summary> /// <param name="data">New data packet from LEAN</param> public void SetMarketPrice(BaseData data) { //Add new point to cache: if (data == null) { return; } Cache.AddData(data); Holdings.UpdateMarketPrice(Price); VolatilityModel.Update(this, data); }
/// <summary> /// Update the Market Online Calculations: /// </summary> /// <param name="data">New Data packet:</param> /// <param name="frontier">time frontier / where we are in time.</param> public void Update(DateTime frontier, BaseData data) { //Update the Exchange/Timer: Exchange.SetDateTimeFrontier(frontier); //Add new point to cache: if (data != null) { Cache.AddData(data); Holdings.UpdatePrice(data.Value); } }
/// <summary> /// Update any security properties based on the lastest market data and time /// </summary> /// <param name="data">New data packet from LEAN</param> /// <param name="frontier">Time frontier / where we are in time.</param> public void SetMarketPrice(DateTime frontier, BaseData data) { //Update the Exchange/Timer: Exchange.SetDateTimeFrontier(frontier); //Add new point to cache: if (data == null) { return; } Cache.AddData(data); Holdings.UpdateMarketPrice(data.Value); }
/// <summary> /// Update any security properties based on the latest realtime data and time /// </summary> /// <param name="data">New data packet from LEAN</param> public void SetRealTimePrice(BaseData data) { //Add new point to cache: if (data == null) { return; } Cache.AddData(data); if (data is OpenInterest || data.Price == 0m) { return; } Holdings.UpdateMarketPrice(Price); }
/// <summary> /// Update the Market Online Calculations: /// </summary> /// <param name="data">New Data packet:</param> /// <param name="frontier"></param> public void Update(DateTime frontier, MarketData data) { //Update the Exchange/Timer: Exchange.SetDateTimeFrontier(frontier); //Update the Holdings Copy of Price Variable: Holdings.UpdatePrice(Close); //Add new point to cache: if (data != null) { Cache.AddData(data); } //Update Online Calculations: }
public void AddData(DataObject data) { _cache.AddData(data); }