public static ISignalSeries Derive( this ISignalSeries self, ObjectDescriptor type, Func<TimedValue<DateTime, Signal>, TimedValue<DateTime, Signal>> converter ) { var convertedSignals = self.Select( s => converter( s ) ); var identifier = self.Identifier.Derive( type ); var series = SignalSeries.FromSortedSet( self.Reference, identifier, convertedSignals ); return series; }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources, IEnumerable<ObjectDescriptor> modifiers ) { Owner = owner; Type = type; Sources = sources.ToList(); Modifiers = modifiers; ShortDesignator = Owner.ShortDesignator + "." + Type.Name; LongDesignator = BuildLongDesignator(); Guid = LongDesignator.GetHashCode(); }
public IPriceSeries Apply( IPriceSeries series ) { double groupInterval = (double)series.Count / (double)myMaxPoints; if ( groupInterval <= 1 ) { return series; } var descriptor = new ObjectDescriptor( "ThinOut", ObjectDescriptor.Param( "MaxCount", myMaxPoints ) ); var seriesId = series.Identifier.Modify( descriptor ); return PriceSeries.FromSortedSet( seriesId, GroupPointsByAverage( series, (int)Math.Ceiling( groupInterval ) ) ); }
public IPriceSeries Calculate( IPriceSeries prices ) { var points = new List<SimplePrice>(); for ( int i = NumDays; i < prices.Count; ++i ) { var pricesRange = new PriceSeriesRange( prices, ClosedInterval.FromOffsetLength( i - NumDays, NumDays ) ); double value = pricesRange.Average( p => p.Value ); var point = new SimplePrice( prices[ i ].Time, value ); points.Add( point ); } var descriptor = new ObjectDescriptor( "SMA", ObjectDescriptor.Param( "NumDays", NumDays ) ); var seriesId = prices.Identifier.Derive( descriptor ); return new PriceSeries( seriesId, points ); }
public SeriesRange(ITimedValueSeries <TTime, TValue> series, int from, int to) { mySeries = series; SetRangeIndices(from, to); var descriptor = new ObjectDescriptor("Range", ObjectDescriptor.Param("from", myFrom), ObjectDescriptor.Param("to", myTo)); Identifier = mySeries.Identifier.Modify(descriptor); }
public SeriesIdentifier(IObjectIdentifier owner, ObjectDescriptor type, IEnumerable <SeriesIdentifier> sources) : this(owner, type, sources, new List <ObjectDescriptor>()) { }
public SeriesIdentifier(IObjectIdentifier owner, ObjectDescriptor type, params SeriesIdentifier[] sources) : this(owner, type, sources, new List <ObjectDescriptor>()) { }
public SeriesIdentifier Derive(ObjectDescriptor type) { return(new SeriesIdentifier(Owner, type, this)); }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources ) : this(owner, type, sources, new List<ObjectDescriptor>()) { }
public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, params SeriesIdentifier[] sources ) : this(owner, type, sources, new List<ObjectDescriptor>()) { }
public SeriesIdentifier Modify( ObjectDescriptor modifier ) { var mods = Modifiers.ToList(); mods.Add( modifier ); return new SeriesIdentifier( Owner, Type, Sources, mods ); }
public SeriesIdentifier Derive( ObjectDescriptor type ) { return new SeriesIdentifier( Owner, type, this ); }