public override void OnData(Slice slice) { // The Security object's Data property provides convenient access // to the various types of data related to that security. You can // access not only the security's price data, but also any custom // data that is mapped to the security, such as our SEC reports. // 1. Get the most recent data point of a particular type: // 1.a Using the C# generic method, Get<T>: LinkedData customLinkedData = Equity.Data.Get <LinkedData>(); Log($"{Time:o}: LinkedData: {customLinkedData}"); // 2. Get the list of data points of a particular type for the most recent time step: // 2.a Using the C# generic method, GetAll<T>: List <LinkedData> customLinkedDataList = Equity.Data.GetAll <LinkedData>(); Log($"{Time:o}: List: LinkedData: {customLinkedDataList.Count}"); if (!Portfolio.Invested) { Buy(Equity.Symbol, 10); } }
//private DateTime? endDate; public void Fill(Func <T, long> _keySelector, DateTime?_startDate = null) { try { KeySelector = _keySelector; startDate = _startDate; //endDate = DateTime.Now.AddMonths(1); var updaterFactory = new DataDBUpdaterFactory <T>(KeySelector); linkedData = updaterFactory.GetLinkedFullyObservableDBData(); } catch (Exception e) { return; } exist = true; if (data == null) { data = new Dictionary <long, T>(); Data = new FullyObservableCollection <T>(data.Values); Subsribe(Data); } FillUpdate(); }