protected double QueryDatabase(double JDE, int acuracyLevel, SeriesType series) { List <long> lst = new List <long>(); double T = (JDE - 2451545.0) / 365250; double ret = 0.0; for (int i = 0; i <= acuracyLevel; i++) { lst.Add(0); var query = from PeriodicTerm term in PeriodicTerms where term.Series == (series.ToString() + i) select term; foreach (PeriodicTerm Term in query) { lst[i] += (long)Term.Calculate(T); } if (i == 0) { ret = lst[i]; } else if (i == 1) { ret += lst[i] * T; } else { ret += lst[i] * Math.Pow(T, i); } } return(ret / Math.Pow(10, 8)); }
public override string ToString() { List <string> options = new List <string>(); if (this.LineColor != null) { options.Add(string.Format("color:'{0}'", this.LineColor.HexConverter())); } if (this.LineWidth != null) { options.Add(string.Format("lineWidth:{0}", this.LineWidth.ToString())); } if (this.DashedLine != null) { options.Add(string.Format("lineDashStyle:{0}", getDashDotted(this.DashedLine))); } options.Add(string.Format("visibleInLegend:{0}", this.VisibleInLegend.ToString().ToLower())); if (this.Options.Count() > 0) { options.AddRange(Options); } if (options.Count() > 0) { return(string.Format("{0}: {{ type:'{1}', {2} }}", Column, SeriesType.ToString().LowerCaseFirst(), string.Join(", ", options))); } else { return(string.Format("{0}: {{ type:'{1}' }}", Column, SeriesType.ToString().LowerCaseFirst())); } }
protected virtual string GetFileDirectory(string rootDirectory, EventVehicleLapTimes data) { SeriesType seriesType = (SeriesType)(data.SeriesId - 1); var series = seriesType.ToString(); var track = data.TrackName; var runName = data.RunName; var eventDate = DateTime.Now.ToString("MM-dd-yyyy"); var subDirectoryPath = $"{series}\\{track}\\{eventDate}\\{runName}"; foreach (var c in Path.GetInvalidPathChars()) { subDirectoryPath = subDirectoryPath.Replace(c.ToString(), ""); } var fullFileDirectory = Path.Combine(rootDirectory, subDirectoryPath); if (!Directory.Exists(fullFileDirectory)) { Directory.CreateDirectory(fullFileDirectory); } return(fullFileDirectory); }
protected void RegisterChartSeries(SeriesType Type, string FriendlyName, bool bEnabled) { NetworkChart.Series.Add(new Series(Type.ToString())); Debug.Assert(NetworkChart.Series[( int )Type].Name == Type.ToString()); NetworkChart.Series[( int )Type].XValueType = ChartValueType.Int32; NetworkChart.Series[( int )Type].Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (( byte )(0))); NetworkChart.Series[( int )Type].Legend = "DefaultLegend"; NetworkChart.Series[( int )Type].ChartArea = "DefaultChartArea"; ChartListBox.Items.Add(FriendlyName); Debug.Assert(ChartListBox.Items.Count - 1 == ( int )Type); UpdateChartSeries(Type, SeriesChartType.FastLine, bEnabled); }
public async Task <TechnicalIndicator <HilbertTransformPhasor> > HT_PHASOR(string symbol, TimeInterval interval, SeriesType seriesType) { return(await ApiClient.SendGetAsync <TechnicalIndicator <HilbertTransformPhasor> >(BuildUri(ApiFunction.HT_PHASOR), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "series_type", seriesType.ToString() } })); }
public async Task <TechnicalIndicator> KAMA(string symbol, TimeInterval interval, uint timePeriod, SeriesType seriesType) { return(await ApiClient.SendGetAsync <TechnicalIndicator>(BuildUri(ApiFunction.KAMA), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "time_period", timePeriod.ToString() }, { "series_type", seriesType.ToString() } })); }
public async Task <TechnicalIndicator <MesaAdaptiveMovingAverage> > MAMA(string symbol, TimeInterval interval, SeriesType seriesType, float fastlimit = 0.01f, float slowlimit = 0.01f) { return(await ApiClient.SendGetAsync <TechnicalIndicator <MesaAdaptiveMovingAverage> >(BuildUri(ApiFunction.MAMA), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "series_type", seriesType.ToString() }, { "fastlimit", fastlimit.ToString(CultureInfo.InvariantCulture) }, { "slowlimit", slowlimit.ToString(CultureInfo.InvariantCulture) } })); }
internal override Hashtable ToHashtable() { Hashtable hashtables = new Hashtable(); if (this.Data.Any <SeriesData>()) { hashtables.Add("data", base.HashifyList(this.Data)); } if (this.Id != this.Id_DefaultValue) { hashtables.Add("id", this.Id); } double?index = this.Index; double?indexDefaultValue = this.Index_DefaultValue; if ((index.GetValueOrDefault() == indexDefaultValue.GetValueOrDefault() ? index.HasValue != indexDefaultValue.HasValue : true)) { hashtables.Add("index", this.Index); } indexDefaultValue = this.LegendIndex; index = this.LegendIndex_DefaultValue; if ((indexDefaultValue.GetValueOrDefault() == index.GetValueOrDefault() ? indexDefaultValue.HasValue != index.HasValue : true)) { hashtables.Add("legendIndex", this.LegendIndex); } if (this.Name != this.Name_DefaultValue) { hashtables.Add("name", this.Name); } if (this.Stack != this.Stack_DefaultValue) { hashtables.Add("stack", this.Stack); } if (this.Type != this.Type_DefaultValue) { SeriesType type = this.Type; hashtables.Add("type", Highcharts.FirstCharacterToLower(type.ToString())); } if (this.XAxis != this.XAxis_DefaultValue) { hashtables.Add("xAxis", this.XAxis); } if (this.YAxis != this.YAxis_DefaultValue) { hashtables.Add("yAxis", this.YAxis); } index = this.ZIndex; indexDefaultValue = this.ZIndex_DefaultValue; if ((index.GetValueOrDefault() == indexDefaultValue.GetValueOrDefault() ? index.HasValue != indexDefaultValue.HasValue : true)) { hashtables.Add("zIndex", this.ZIndex); } return(hashtables); }
public async Task <TechnicalIndicator <Macd> > MACD(string symbol, TimeInterval interval, SeriesType seriesType, uint fastperiod = 12, uint slowperiod = 26, uint signalperiod = 9) { return(await ApiClient.SendGetAsync <TechnicalIndicator <Macd> >(BuildUri(ApiFunction.MACD), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "series_type", seriesType.ToString() }, { "fastperiod", fastperiod.ToString() }, { "slowperiod", slowperiod.ToString() }, { "signalperiod", signalperiod.ToString() } })); }
public async Task <TechnicalIndicator> PPO(string symbol, TimeInterval interval, SeriesType seriesType, uint fastperiod = 12, uint slowperiod = 26, MovingAverageType matype = MovingAverageType.Simple) { return(await ApiClient.SendGetAsync <TechnicalIndicator>(BuildUri(ApiFunction.PPO), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "series_type", seriesType.ToString() }, { "fastperiod", fastperiod.ToString() }, { "slowperiod", slowperiod.ToString() }, { "matype", ((int)matype).ToString() } })); }
public async Task <TechnicalIndicator <BollingerBands> > BBANDS(string symbol, TimeInterval interval, uint timePeriod, SeriesType seriesType, uint nbdevup = 2, uint nbdevdn = 2, MovingAverageType matype = MovingAverageType.Simple) { return(await ApiClient.SendGetAsync <TechnicalIndicator <BollingerBands> >(BuildUri(ApiFunction.BBANDS), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "time_period", timePeriod.ToString() }, { "series_type", seriesType.ToString() }, { "nbdevup", nbdevup.ToString() }, { "nbdevdn", nbdevdn.ToString() }, { "matype", ((int)matype).ToString() } })); }
public async Task <IActionResult> GetEmaAsync(string symbol, Intervals interval, int timePeriod, SeriesType seriesType) { var result = await _alphaVantageService.GetEmaAsync(symbol, interval, timePeriod, seriesType); return(Ok(new { symbol, interval = interval.ToString(), timePeriod, seriesType = seriesType.ToString(), Data = result })); }
public async Task <TechnicalIndicator <StochasticFast> > STOCHRSI(string symbol, TimeInterval interval, uint timePeriod, SeriesType seriesType, uint fastkperiod = 5, uint fastdperiod = 3, MovingAverageType fastdmatype = MovingAverageType.Simple) { return(await ApiClient.SendGetAsync <TechnicalIndicator <StochasticFast> >(BuildUri(ApiFunction.STOCHRSI), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "time_period", timePeriod.ToString() }, { "series_type", seriesType.ToString() }, { "fastkperiod", fastkperiod.ToString() }, { "fastdperiod", fastdperiod.ToString() }, { "fastdmatype", ((int)fastdmatype).ToString() } })); }
public async Task <TechnicalIndicator <Macd> > MACDEXT(string symbol, TimeInterval interval, SeriesType seriesType, uint fastperiod = 12, uint slowperiod = 26, uint signalperiod = 9, MovingAverageType fastmatype = MovingAverageType.Simple, MovingAverageType slowmatype = MovingAverageType.Simple, MovingAverageType signalmatype = MovingAverageType.Simple) { return(await ApiClient.SendGetAsync <TechnicalIndicator <Macd> >(BuildUri(ApiFunction.MACDEXT), new Dictionary <string, string> { { "symbol", symbol }, { "interval", interval.GetDescription() }, { "series_type", seriesType.ToString() }, { "fastperiod", fastperiod.ToString() }, { "slowperiod", slowperiod.ToString() }, { "signalperiod", signalperiod.ToString() }, { "fastmatype", ((int)fastmatype).ToString() }, { "slowmatype", ((int)slowmatype).ToString() }, { "signalmatype", ((int)signalmatype).ToString() } })); }
public override string ToString() { return(Type.ToString()); }
/// <summary> /// Builds the query string for the request /// </summary> /// <param name="param"></param> /// <returns></returns> protected string BuildQueryString(int deviceId, Scope scope, SeriesType seriesType, bool humanReadable, DateTime startDate, DateTime endDate, List <Channel> channels, DeviceClass deviceClass) { if (channels.Count == 0) { throw new ArgumentNullException(nameof(channels), "You must provide atleast one channel"); } string channelParam = ""; if (channels.Count > 1) { foreach (Channel channel in channels) { channelParam = $"{channelParam}&Channel={channel.ToString()}"; } } else { channelParam = $"Channel={channels[0].ToString()}"; } // Only need device class if we are scoped to device string deviceClassParam = ""; if (scope == Scope.Device) { deviceClassParam = $"&DeviceClass={deviceClass.ToString()}"; } return($"?Scope={scope}&StartDate={startDate.ToString("d.M.yyyy")}&EndDate={endDate.ToString("d.M.yyyy")}&HumanReadable={humanReadable.ToString()}&SeriesType={seriesType.ToString()}{deviceClassParam}" + $"&{channelParam}"); }
protected void RegisterChartSeries( SeriesType Type, string FriendlyName, bool bEnabled ) { NetworkChart.Series.Add( new Series( Type.ToString() ) ); Debug.Assert( NetworkChart.Series[( int )Type].Name == Type.ToString() ); NetworkChart.Series[( int )Type].XValueType = ChartValueType.Int32; NetworkChart.Series[( int )Type].Font = new System.Drawing.Font( "Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ( ( byte )( 0 ) ) ); NetworkChart.Series[( int )Type].Legend = "DefaultLegend"; NetworkChart.Series[( int )Type].ChartArea = "DefaultChartArea"; ChartListBox.Items.Add( FriendlyName ); Debug.Assert( ChartListBox.Items.Count - 1 == ( int )Type ); UpdateChartSeries( Type, SeriesChartType.FastLine, bEnabled ); }