Click or drag to resize

How to develop a Market Scanner

The ScannerBase ScriptType lets the user to add custom columns in the Market Scanner View.

Properties

DisplayValue

The Market Scanner View's cells are bounded to the DisplayValue property. Any computed value has to be assigned to the DisplayValue property in order to be displayed in the column cells.

Methods

OnStateChange

The OnStateChanged method is called whenever the State of the script is changed. The various states which a Scanner class have are:

  • Initialize - when a new column is created or an instrument is added.
  • StartUp - when the script is ready to run.
  • Finalize - When the script encounters an error or is being finalized (disposed off). All clear up codes should be placed here.
Example
C#
protected override void OnStateChange()
 {
     //your code here
 }

AddInstrument(String)

The Market Scanner user code supports seconday instruments and it can be added by simply calling the AddInstrument method when the Scanner's State is in StartUp state.

Example
C#
protected override void OnStateChange()
 {
     if (this.State == State.StartUp)
     {
         AddInstrument("RELIANCE NSE"); //add a seconday script

         //do other stuff
     }
 }
Virtual methods

OnLevel1(Int32, Level1EventArgs)

The OnLevel1 method is called upon each incoming Level1EventArgs data when a Level1 stream is opened.

Example
C#
protected override void OnLevel1(int idx, Level1EventArgs e)
{
    //your code here
}

OnPosition(PositionEventArgs)

The OnPosition method is called when the position gets updated.

Example
C#
protected override void OnPosition(PositionEventArgs e)
{
    //your code here
}

OnRender(DrawingContext, ScannerVisualArgs)

The Market Scanner/Option Chain data grid cell, by default displays the string value of the property DisplayValue. However if user wants to display anything other than text, he can do it by overriding the OnRender method.

Example
C#
    protected override void OnRender(DrawingContext dc, ScannerVisualArgs args)
{
    //your code here
}
Configuring properties via GUI using Xaml templates
See Also

Reference

ScannerBase