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>:
            SECReport8K  googlSec8kReport  = GOOGL.Data.Get <SECReport8K>();
            SECReport10K googlSec10kReport = GOOGL.Data.Get <SECReport10K>();

            Log($"{Time:o}:  8K: {googlSec8kReport}");
            Log($"{Time:o}: 10K: {googlSec10kReport}");

            // 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 <SECReport8K>  googlSec8kReports  = GOOGL.Data.GetAll <SECReport8K>();
            List <SECReport10K> googlSec10kReports = GOOGL.Data.GetAll <SECReport10K>();

            Log($"{Time:o}: List:  8K: {googlSec8kReports.Count}");
            Log($"{Time:o}: List: 10K: {googlSec10kReports.Count}");

            if (!Portfolio.Invested)
            {
                Buy(GOOGL.Symbol, 10);
            }
        }
Beispiel #2
0
        public override void OnData(Slice data)
        {
            foreach (var security in _securities)
            {
                SECReport8K  report8K  = security.Data.Get <SECReport8K>();
                SECReport10K report10K = security.Data.Get <SECReport10K>();

                if (!security.HoldStock && report8K != null && report10K != null)
                {
                    SetHoldings(security.Symbol, 1d / _securities.Count);
                }
            }
        }