GetInstrument()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > Instruments > Instrument >

GetInstrument()

Previous page Return to chapter overview Next page

Definition

Returns an Instrument object by the master instrument name configured in the database.

 

Note:  This method does NOT add additional data for real-time or historical processing.  For adding an additional data to your script, please see the AddDataSeries() method.

 

 

Method Return Value

An Instrument object

 

Syntax

Instrument.GetInstrument(string instrumentName)

 

Parameters

instrumentName

A string value representing a name of an instrument

 

 

Examples

ns


protected override void OnStateChange()
{
  if (State == State.Historical)
  {
    Instrument myInstrument = Instrument.GetInstrument("AAPL");
 
    Print("AAPL's tick size is " + myInstrument.MasterInstrument.TickSize);
  }
}