NinjaScript > Language Reference > Data >

OnFundamentalData()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
The OnFundamentalData() method is called for every change in fundamental data for the underlying instrument.

 

Programming to this method is considered advanced programming and exposed for experienced programmer
This method is not called on historical data (backtest)

 

Method Return Value

This method does not return a value.

 

Method Parameters

FundamentalDataEventArgs e

 

Syntax
You must override the method in your strategy or indicator with the following syntax.

 

protected override void OnFundamentalData(FundamentalDataEventArgs e)
{

 
}

 
 

Examples

protected override void OnFundamentalData(FundamentalDataEventArgs e)
{
    // Print some data to the Output window
    if (e.FundamentalDataType == FundamentalDataType.CurrentYearsEarningsPerShare)
         Print("The current year's EPS is " + e.DoubleValue);
}

 

 

Tips

1.With multi-time frame and instrument strategies, OnFundamentalData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnFundamentalData() method for a specific instrument.
2.Do not leave an unused OnFundamentalData() method declared in your NinjaScript object. This will unnecessarily attach a data stream to your strategy which uses unnecessary CPU cycles.