-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Advanced fundamentals fixes cum upgrades (#101)
* Stock advanced fundamentals quartely endpoint fix Fixed an Issue where we were sending quarter instead of quarterly for pulling the data from IEX. Added TimeSeries query params functionality to the Stock Advanced Fundamentals endpoint. * Removed Lang version added by visual studio 2017 * Updated TimeSeries class function names to be more meaningful. Removed unnecessary properties Co-authored-by: Sai Dharmendra Kanneganti <[email protected]>
- Loading branch information
1 parent
0950726
commit c867f10
Showing
8 changed files
with
153 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using Common.Logging.Configuration; | ||
using IEXSharp.Helper; | ||
|
||
namespace IEXSharp.Model.Shared.Request | ||
{ | ||
public class TimeSeries | ||
{ | ||
private readonly TimeSeriesPeriod period; | ||
|
||
public TimeSeries(TimeSeriesPeriod period) | ||
{ | ||
this.period = period; | ||
} | ||
|
||
private string Range { get; set; } | ||
private bool Calendar { get; set; } | ||
private int Limit { get; set; } | ||
private string From { get; set; } | ||
private string To { get; set; } | ||
private int Last { get; set; } | ||
private int First { get; set; } | ||
|
||
public TimeSeries SetRange(int range) | ||
{ | ||
if (range <= 0) return this; | ||
Range = period == TimeSeriesPeriod.Quarterly ? range + "q" : range + "y"; | ||
return this; | ||
} | ||
|
||
public TimeSeries SetDateRange(DateTime? from, DateTime? to = default) | ||
{ | ||
if (from == null) return this; | ||
From = from?.ToTimeSeriesDate(); | ||
To = to?.ToTimeSeriesDate() ?? DateTime.Today.ToTimeSeriesDate(); | ||
return this; | ||
} | ||
|
||
public NameValueCollection TimeSeriesQueryParams() | ||
{ | ||
var nvc = new NameValueCollection(); | ||
|
||
if (From != null) | ||
{ | ||
nvc.Add("from", From); | ||
nvc.Add("to", To); | ||
} | ||
|
||
if (!string.IsNullOrEmpty(Range) && string.IsNullOrEmpty(From)) | ||
{ | ||
nvc.Add("range", Range); | ||
} | ||
|
||
return nvc; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.ComponentModel; | ||
|
||
namespace IEXSharp.Model.Shared.Request | ||
{ | ||
public enum TimeSeriesPeriod | ||
{ | ||
[Description("quarterly")] | ||
Quarterly, | ||
[Description("annual")] | ||
Annual, | ||
[Description("ttm")] | ||
Ttm | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.ComponentModel; | ||
|
||
namespace IEXSharp.Model.Shared.Request | ||
{ | ||
public enum TimeSeriesRange | ||
{ | ||
[Description("today")] | ||
Today, | ||
[Description("yesterday")] | ||
Yesterday, | ||
[Description("ytd")] | ||
Ytd, | ||
[Description("last-week")] | ||
LastWeek, | ||
[Description("last-month")] | ||
LastMonth, | ||
[Description("last-quarter")] | ||
LastQuarter, | ||
[Description("d")] | ||
Days, | ||
[Description("w")] | ||
Weeks, | ||
[Description("m")] | ||
Months, | ||
[Description("q")] | ||
Quarters, | ||
[Description("y")] | ||
Years, | ||
[Description("tomorrow")] | ||
Tomorrow, | ||
[Description("this-week")] | ||
ThisWeek, | ||
[Description("this-month")] | ||
ThisMonth, | ||
[Description("this-quarter")] | ||
ThisQuarter, | ||
[Description("next-week")] | ||
NextWeek, | ||
[Description("next-month")] | ||
NextMonth, | ||
[Description("next-quarter")] | ||
NextQuarter | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters