Esempio n. 1
0
        /// <summary>
        /// Private constructor used to keep track of how a user defined the insight period.
        /// </summary>
        /// <param name="symbol">The symbol this insight is for</param>
        /// <param name="periodSpec">A specification defining how the insight's period was defined, via time span, via resolution/barcount, via close time</param>
        /// <param name="type">The type of insight, price/volatility</param>
        /// <param name="direction">The predicted direction</param>
        /// <param name="magnitude">The predicted magnitude as a percentage change</param>
        /// <param name="confidence">The confidence in this insight</param>
        /// <param name="sourceModel">An identifier defining the model that generated this insight</param>
        /// <param name="weight">The portfolio weight of this insight</param>
        private Insight(Symbol symbol, IPeriodSpecification periodSpec, InsightType type, InsightDirection direction, double?magnitude, double?confidence, string sourceModel = null, double?weight = null)
        {
            Id          = Guid.NewGuid();
            Score       = new InsightScore();
            SourceModel = sourceModel;

            Symbol    = symbol;
            Type      = type;
            Direction = direction;

            // Optional
            Magnitude  = magnitude;
            Confidence = confidence;
            Weight     = weight;

            _periodSpecification = periodSpec;

            // keep existing behavior of Insight.Price such that we set the period immediately
            var period = (periodSpec as TimeSpanPeriodSpecification)?.Period;

            if (period != null)
            {
                Period = period.Value;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Insight"/> class
        /// </summary>
        /// <param name="symbol">The symbol this insight is for</param>
        /// <param name="type">The type of insight, price/volatility</param>
        /// <param name="direction">The predicted direction</param>
        /// <param name="period">The period over which the prediction will come true</param>
        /// <param name="magnitude">The predicted magnitude as a percentage change</param>
        /// <param name="confidence">The confidence in this insight</param>
        public Insight(Symbol symbol, InsightType type, InsightDirection direction, TimeSpan period, double?magnitude, double?confidence)
        {
            Id    = Guid.NewGuid();
            Score = new InsightScore();

            Symbol    = symbol;
            Type      = type;
            Direction = direction;
            Period    = period;

            // Optional
            Magnitude  = magnitude;
            Confidence = confidence;
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Insight"/> class
        /// </summary>
        /// <param name="symbol">The symbol this insight is for</param>
        /// <param name="period">The period over which the prediction will come true</param>
        /// <param name="type">The type of insight, price/volatility</param>
        /// <param name="direction">The predicted direction</param>
        /// <param name="magnitude">The predicted magnitude as a percentage change</param>
        /// <param name="confidence">The confidence in this insight</param>
        /// <param name="sourceModel">An identifier defining the model that generated this insight</param>
        public Insight(Symbol symbol, TimeSpan period, InsightType type, InsightDirection direction, double? magnitude, double? confidence, string sourceModel = null)
        {
            Id = Guid.NewGuid();
            Score = new InsightScore();
            SourceModel = sourceModel;

            Symbol = symbol;
            Type = type;
            Direction = direction;
            Period = period;

            // Optional
            Magnitude = magnitude;
            Confidence = confidence;

            _periodSpecification = new TimeSpanPeriodSpecification(period);
        }