Class DateSeries
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
Encapsulates series of dates conforming to ISeries interface.
public class DateSeries : ISeries, IEnumerable<DateTime>, IEnumerable
- Inheritance
-
DateSeries
- Implements
- Inherited Members
- Extension Methods
Constructors
DateSeries()
Instantiates an empty DateSeries.
public DateSeries()
DateSeries(IEnumerable<DateTime>)
Instantiates a new DateSeries using the specified enumerable of dates.
public DateSeries(IEnumerable<DateTime> dates)
Parameters
dates
IEnumerable<DateTime>
DateSeries(int)
Instantiates a new DateSeries of the specified capacity.
public DateSeries(int capacity)
Parameters
capacity
int
Properties
Count
Gets the number of dates in the collection.
public int Count { get; }
Property Value
CurrentDate
Gets the current date if concurrency is being maintained, otherwise returns DateTime.MinValue.
public DateTime CurrentDate { get; }
Property Value
FirstDate
Gets the first date on which valid data is available.
public DateTime FirstDate { get; }
Property Value
Index
Gets the current index.
public int Index { get; }
Property Value
Indexing
Gets the indexing strategy currently being used.
public IndexKind Indexing { get; }
Property Value
this[int]
Gets the date of the specified index value according to the indexing strategy employed (Absolute, RelativeToCurrentBar).
public DateTime this[int index] { get; }
Parameters
index
int
Property Value
LastDate
Gets the last available date of the series or DateTime.MinValue if the series is empty.
public DateTime LastDate { get; }
Property Value
Name
Gets/sets the name.
public string Name { get; set; }
Property Value
NextDate
Gets the next date if available and concurrency is being maintained, otherwise returns DateTime.MaxValue.
public DateTime NextDate { get; }
Property Value
Periodicity
Gets/sets the periodicity of this series. If Periodicity is unknown, an estimate will be made.
public Periodicity Periodicity { get; set; }
Property Value
PreviousDate
Gets the previous date if concurrency is being maintained, otherwise returns DateTime.MinValue.
public DateTime PreviousDate { get; }
Property Value
Symbol
Gets/sets the symbol.
public string Symbol { get; set; }
Property Value
Methods
Add(DateTime)
Adds the specified date to the series. Not for use when used as a property of an ISeries.
public void Add(DateTime date)
Parameters
date
DateTime
Add(TimeSpan)
Adds the value of the specified TimeSpan to all dates in the series.
public void Add(TimeSpan value)
Parameters
value
TimeSpan
Contains(DateTime)
Determines whether a particular date is in the collection.
public bool Contains(DateTime date)
Parameters
date
DateTime
Returns
Contains(DateTime, out int)
Determines whether a particular date is in the collection.
public bool Contains(DateTime date, out int bar)
Parameters
date
DateTimeThe date of interest.
bar
intThe index value of the specified date or a number less than zero if not found. The bitwise complement (~) of negative return values may be used to find the index before which you should insert the specified date.
Returns
GetEnumerator()
Returns an enumerator to iterate through the collection.
public IEnumerator<DateTime> GetEnumerator()
Returns
Load(string)
Loads a list of dates from the specified file.
public static DateSeries Load(string fileName)
Parameters
fileName
string
Returns
Load(string, string, int)
Loads a list of dates from the specified file using the specified column delimiter and column number.
public static DateSeries Load(string fileName, string delimiter, int column)
Parameters
Returns
OnGetValue(int)
Returns the value of the specified index.
protected virtual DateTime OnGetValue(int index)
Parameters
index
int
Returns
OnSetIndex(DateTime)
Sets the current bar based on the specified date.
protected virtual int OnSetIndex(DateTime date)
Parameters
date
DateTime
Returns
RemoveTimeOfDay()
Removes the time of day component from all dates in the series.
public void RemoveTimeOfDay()
Save(string)
Saves this DateSeries to a text file using the specified file name.
public void Save(string fileName)
Parameters
fileName
string
Exceptions
SetValue(int, object)
Sets the index to the specified value.
protected virtual void SetValue(int index, object value)
Parameters
Sync(IEnumerable<DateTime>)
Returns a new DateSeries with the specified dates.
public ISeries Sync(IEnumerable<DateTime> dates)
Parameters
dates
IEnumerable<DateTime>
Returns
ToString()
Returns a string representation of this object.
public override string ToString()