A system clock


Namespace: OpenQuant.API
Assembly: OpenQuant.API (in OpenQuant.API.dll)

Syntax

Visual Basic (Declaration)
Public Class Clock
C#
public class Clock
C++
ref class Clock
J#
public class Clock
JScript
public class Clock

Remarks

The Clock.Now property shows simulation time in the simulation mode and real time in the paper trading or live trading modes. Thus it can be used in the same way in all modes.

 Copy Code
            public class MyStrategy : Strategy
            {
                bool entry = true;
            
                public override void OnBar(Bar bar)
                {
                    if (entry)
                    {        
                        BuyStop(100, bar.high + 0.01);
                
                        entry = false;
                    }
                }
            
                public override void OnPositionOpened()
                {
                    Console.WriteLine("Position opened at " + Clock.Now);
                }
            }
            

Inheritance Hierarchy

System.Object
   OpenQuant.API.Clock

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also