private static void WriteTo(StringBuilder writer, TimeSeriesRange range) { if (range.From.HasValue) { writer.Append("'") .Append(range.From.Value.GetDefaultRavenFormat()) .Append("'") .Append(", "); } else { writer.Append("null,"); } if (range.To.HasValue) { writer.Append("'") .Append(range.To.Value.GetDefaultRavenFormat()) .Append("'"); } else { writer.Append("null"); } }
public async Task DividendsAsyncTest(TimeSeriesRange range) { var response = await sandBoxClient.CorporateActions.DividendsAsync("AAPL", range); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); // can sometimes be empty in case no dividend got declared in the selected time range if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.Greater(data.exDate, DateTime.MinValue); Assert.Greater(data.declaredDate, DateTime.MinValue); Assert.Greater(data.paymentDate, DateTime.MinValue); Assert.Greater(data.amount, 0); Assert.Greater(data.grossAmount, 0); Assert.IsFalse(string.IsNullOrEmpty(data.currency)); Assert.IsFalse(string.IsNullOrEmpty(data.refid)); Assert.IsFalse(string.IsNullOrEmpty(data.figi)); Assert.IsFalse(string.IsNullOrEmpty(data.marker)); Assert.IsFalse(string.IsNullOrEmpty(data.flag)); Assert.IsFalse(string.IsNullOrEmpty(data.securityType)); }
public async Task SpinOffAsyncTest(string symbol, TimeSeriesRange range, bool calendar, int last, string refId) { var response = await sandBoxClient.CorporateActions.SpinOffAsync(symbol, range, calendar, last, refId); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.NotNull(data.symbol); Assert.NotNull(data.recordDate); Assert.NotNull(data.withdrawalFromDate); Assert.NotNull(data.withdrawalToDate); Assert.NotNull(data.electionDate); Assert.NotNull(data.effectiveDate); Assert.NotNull(data.minPrice); Assert.NotNull(data.maxPrice); Assert.NotNull(data.hasWithdrawalRights); Assert.NotNull(data.currency); }
private string CreateRangeString(TimeSeriesRange range) { string duration = range switch { TimeSeriesRange.OneDay => "-1d", TimeSeriesRange.OneWeek => "-1w", TimeSeriesRange.OneMonth => "-1mo", TimeSeriesRange.OneYear => "-1y", _ => "1d" }; return($"|> range(start: {duration})"); }
public async Task SecuritySwapAsyncTest(string symbol, TimeSeriesRange range, bool calendar, int last, string refId) { var response = await sandBoxClient.CorporateActions.SecuritySwapAsync(symbol, range, calendar, last, refId); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.NotNull(data.symbol); Assert.NotNull(data.recordDate); Assert.NotNull(data.resultSecurityType); }
public async Task SplitsAdvancedAsyncTest(string symbol, TimeSeriesRange range, bool calendar, int last, string refId) { var response = await sandBoxClient.CorporateActions.SplitsAdvancedAsync(symbol, range, calendar, last, refId); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.NotNull(data.symbol); Assert.NotNull(data.recordDate); Assert.NotNull(data.splitType); Assert.NotNull(data.oldParValue); Assert.NotNull(data.oldParValueCurrency); }
public async Task DividendsAdvancedAsyncTest(string symbol, TimeSeriesRange range, bool calendar, int last, string refId) { var response = await sandBoxClient.CorporateActions.DividendsAdvancedAsync(symbol, range, calendar, last, refId); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); // can sometimes be empty in case no dividend got declared in the selected time range if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.Greater(data.exDate, DateTime.MinValue); Assert.Greater(data.amount, 0); Assert.Greater(data.grossAmount, 0); Assert.IsFalse(string.IsNullOrEmpty(data.currency)); Assert.IsFalse(string.IsNullOrEmpty(data.securityType)); }
public async Task RightToPurchaseAsyncTest(string symbol, TimeSeriesRange range, bool calendar, int last, string refId) { var response = await sandBoxClient.CorporateActions.RightToPurchaseAsync(symbol, range, calendar, last, refId); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); if (!response.Data.Any()) { return; } var data = response.Data.First(); Assert.NotNull(data.symbol); Assert.NotNull(data.recordDate); Assert.NotNull(data.subscriptionStart); Assert.NotNull(data.subscriptionEnd); Assert.NotNull(data.issuePrice); Assert.NotNull(data.currency); Assert.NotNull(data.isOverSubscription); Assert.NotNull(data.currency); Assert.NotNull(data.resultSecurityType); }
public async Task <IEXResponse <IEnumerable <AdvancedDividendResponse> > > DividendsAsync(string symbol, TimeSeriesRange range = TimeSeriesRange._this__quarter, bool calendar = false, int?last = null, string refid = null) { if (symbol == null) { throw new ArgumentNullException("Support for calls without symbol is not yet supported. Please submit a pull request on GitHub if you would like to add it."); } if (calendar) { throw new ArgumentException("Support for 'calendar' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it."); } if (last != null) { throw new ArgumentException("Support for 'last' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it."); } if (refid != null) { throw new ArgumentException("Support for 'refid' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it."); } const string urlPattern = "time-series/advanced_dividends/[symbol]"; var qsb = new QueryStringBuilder(); qsb.Add("range", range.ToString().ToLower().Replace("__", "-").Replace("_", string.Empty)); var pathNvc = new NameValueCollection { { "symbol", symbol } }; return(await executor.ExecuteAsync <IEnumerable <AdvancedDividendResponse> >(urlPattern, pathNvc, qsb)); }
public static TimeSeriesIncludesToken Create(string sourcePath, TimeSeriesRange range) { return(new TimeSeriesIncludesToken(sourcePath, range)); }
private TimeSeriesIncludesToken(string sourcePath, TimeSeriesRange range) { _range = range; _sourcePath = sourcePath; }