dxFeed .Net API  7.1.0
dxFeed .Net API library intended to provide market data access for DX clients
com.dxfeed.api.candle.CandlePeriod Class Reference

Period attribute of CandleSymbol defines aggregation period of the candles. Aggregation period is defined as pair of a GetValue() and type. More...

Inheritance diagram for com.dxfeed.api.candle.CandlePeriod:
[legend]
Collaboration diagram for com.dxfeed.api.candle.CandlePeriod:
[legend]

Public Member Functions

long GetPeriodIntervalMillis ()
 Returns aggregation period in milliseconds as closely as possible. Certain aggregation types like SECOND and DAY span a specific number of milliseconds. CandleType#MONTH, CandleType#OPTEXP and CandleType#YEAR are approximate. Candle period of CandleType#TICK, CandleType#VOLUME, CandleType#PRICE, CandleType#PRICE_MOMENTUM and CandleType#PRICE_RENKO is not defined and this method returns 0. The result of this method is equal to (long)(this.GetCandleType().getPeriodIntervalMillis() /// this.GetValue()) More...
 
string ChangeAttributeForSymbol (string symbol)
 Returns candle event symbol string with this aggregation period set. More...
 
void CheckInAttributeImpl (CandleSymbol candleSymbol)
 Internal method that initializes attribute in the candle symbol. More...
 
double GetValue ()
 Returns aggregation period value. For example, the value of 5 with the candle type of MINUTE represents 5 minute aggregation period. More...
 
CandleType GetCandleType ()
 Returns aggregation period type. More...
 
override bool Equals (object o)
 Indicates whether this aggregation period is the same as another one. The same aggregation period has the same value and type. More...
 
override int GetHashCode ()
 Returns hash code of this aggregation period. More...
 
override string ToString ()
 Returns string representation of this aggregation period. The string representation is composed of value and type string. For example, 5 minute aggregation is represented as "5m". The value of 1 is omitted in the string representation, so DAY (one day) is represented as "d". This string representation can be converted back into object with Parse(string) method. More...
 

Static Public Member Functions

static CandlePeriod Parse (string s)
 Parses string representation of aggregation period into object. Any string that was returned by ToString() can be parsed. This method is flexible in the way candle types can be specified. See CandleType#Parse(string) for details. More...
 
static CandlePeriod ValueOf (double value, CandleType type)
 Returns candle period with the given value and type. More...
 
static CandlePeriod GetAttributeForSymbol (string symbol)
 Returns candle period of the given candle symbol string. The result is DEFAULT if the symbol does not have candle period attribute. More...
 
static string NormalizeAttributeForSymbol (string symbol)
 Returns candle symbol string with the normalized representation of the candle period attribute. More...
 

Static Public Attributes

static readonly CandlePeriod TICK = new CandlePeriod(PERIOD_VALUE_DEFAULT, CandleType.TICK)
 Tick aggregation where each candle represents an individual tick. More...
 
static readonly CandlePeriod DAY = new CandlePeriod(PERIOD_VALUE_DEFAULT, CandleType.DAY)
 Day aggregation where each candle represents a day. More...
 
static readonly CandlePeriod DEFAULT = TICK
 Default period is TICK. More...
 
static readonly string ATTRIBUTE_KEY = ""
 The attribute key that is used to store the value of CandlePeriod in a symbol string using methods of MarketEventSymbols class. The value of this constant is an empty string, because this is the main attribute that every CandleSymbol must have. The value that this key shall be set to is equal to the corresponding CandlePeriod.ToString() More...
 

Detailed Description

Period attribute of CandleSymbol defines aggregation period of the candles. Aggregation period is defined as pair of a GetValue() and type.

Implementation details

This attribute is encoded in a symbol string with MarketEventSymbols.GetAttributeStringByKey, MarketEventSymbols.ChangeAttributeStringByKey, and MarketEventSymbols.RemoveAttributeStringByKey methods. The key to use with these methods is available via ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandlePeriod.ToString()

Member Function Documentation

◆ ChangeAttributeForSymbol()

string com.dxfeed.api.candle.CandlePeriod.ChangeAttributeForSymbol ( string  symbol)
inline

Returns candle event symbol string with this aggregation period set.

Parameters
symboloriginal candle event symbol.
Returns
candle event symbol string with this aggregation period set.

Implements com.dxfeed.api.candle.ICandleSymbolAttribute.

◆ CheckInAttributeImpl()

void com.dxfeed.api.candle.CandlePeriod.CheckInAttributeImpl ( CandleSymbol  candleSymbol)
inline

Internal method that initializes attribute in the candle symbol.

Parameters
candleSymbolcandle symbol.
Exceptions
InvalidOperationExceptionif used outside of internal initialization logic.

Implements com.dxfeed.api.candle.ICandleSymbolAttribute.

◆ Equals()

override bool com.dxfeed.api.candle.CandlePeriod.Equals ( object  o)
inline

Indicates whether this aggregation period is the same as another one. The same aggregation period has the same value and type.

Parameters
o
Returns
true if this aggregation period is the same as another one.

◆ GetAttributeForSymbol()

static CandlePeriod com.dxfeed.api.candle.CandlePeriod.GetAttributeForSymbol ( string  symbol)
inlinestatic

Returns candle period of the given candle symbol string. The result is DEFAULT if the symbol does not have candle period attribute.

Parameters
symbolcandle symbol string.
Returns
candle period of the given candle symbol string.
Exceptions
ArgumentNullExceptionif string representation is invalid.

◆ GetCandleType()

CandleType com.dxfeed.api.candle.CandlePeriod.GetCandleType ( )
inline

Returns aggregation period type.

Returns
aggregation period type.

◆ GetHashCode()

override int com.dxfeed.api.candle.CandlePeriod.GetHashCode ( )
inline

Returns hash code of this aggregation period.

Returns
hash code of this aggregation period.

◆ GetPeriodIntervalMillis()

long com.dxfeed.api.candle.CandlePeriod.GetPeriodIntervalMillis ( )
inline

Returns aggregation period in milliseconds as closely as possible. Certain aggregation types like SECOND and DAY span a specific number of milliseconds. CandleType#MONTH, CandleType#OPTEXP and CandleType#YEAR are approximate. Candle period of CandleType#TICK, CandleType#VOLUME, CandleType#PRICE, CandleType#PRICE_MOMENTUM and CandleType#PRICE_RENKO is not defined and this method returns 0. The result of this method is equal to (long)(this.GetCandleType().getPeriodIntervalMillis() /// this.GetValue())

See also
CandleType::GetPeriodIntervalMillis()
Returns
aggregation period in milliseconds.

◆ GetValue()

double com.dxfeed.api.candle.CandlePeriod.GetValue ( )
inline

Returns aggregation period value. For example, the value of 5 with the candle type of MINUTE represents 5 minute aggregation period.

Returns
aggregation period value.

◆ NormalizeAttributeForSymbol()

static string com.dxfeed.api.candle.CandlePeriod.NormalizeAttributeForSymbol ( string  symbol)
inlinestatic

Returns candle symbol string with the normalized representation of the candle period attribute.

Parameters
symbolcandle symbol string.
Returns
candle symbol string with the normalized representation of the the candle period attribute.

◆ Parse()

static CandlePeriod com.dxfeed.api.candle.CandlePeriod.Parse ( string  s)
inlinestatic

Parses string representation of aggregation period into object. Any string that was returned by ToString() can be parsed. This method is flexible in the way candle types can be specified. See CandleType#Parse(string) for details.

Parameters
sstring representation of aggregation period.
Returns
aggregation period object.
Exceptions
ArgumentNullExceptions is null
FormatExceptions does not represent a number in a valid format.
OverflowExceptions represents a number that is less than System.Double.MinValue or greater than System.Double.MaxValue.

◆ ToString()

override string com.dxfeed.api.candle.CandlePeriod.ToString ( )
inline

Returns string representation of this aggregation period. The string representation is composed of value and type string. For example, 5 minute aggregation is represented as "5m". The value of 1 is omitted in the string representation, so DAY (one day) is represented as "d". This string representation can be converted back into object with Parse(string) method.

Returns
string representation of this aggregation period.

◆ ValueOf()

static CandlePeriod com.dxfeed.api.candle.CandlePeriod.ValueOf ( double  value,
CandleType  type 
)
inlinestatic

Returns candle period with the given value and type.

Parameters
valuevalue candle period value.
typecandle period type.
Returns
candle period with the given value and type.

Field Documentation

◆ ATTRIBUTE_KEY

readonly string com.dxfeed.api.candle.CandlePeriod.ATTRIBUTE_KEY = ""
static

The attribute key that is used to store the value of CandlePeriod in a symbol string using methods of MarketEventSymbols class. The value of this constant is an empty string, because this is the main attribute that every CandleSymbol must have. The value that this key shall be set to is equal to the corresponding CandlePeriod.ToString()

◆ DAY

readonly CandlePeriod com.dxfeed.api.candle.CandlePeriod.DAY = new CandlePeriod(PERIOD_VALUE_DEFAULT, CandleType.DAY)
static

Day aggregation where each candle represents a day.

◆ DEFAULT

readonly CandlePeriod com.dxfeed.api.candle.CandlePeriod.DEFAULT = TICK
static

Default period is TICK.

◆ TICK

readonly CandlePeriod com.dxfeed.api.candle.CandlePeriod.TICK = new CandlePeriod(PERIOD_VALUE_DEFAULT, CandleType.TICK)
static

Tick aggregation where each candle represents an individual tick.


The documentation for this class was generated from the following file: