Class Strategy
The base class for strategies
Namespace: TradingPlatform.BusinessLayer
Syntax
public abstract class Strategy : ExecutionEntity, IModule, IDisposable, ICustomizable, IXElementSerialization
Constructors
Strategy()
Declaration
protected Strategy()
Properties
Id
Unique ID of the strategy
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
MonitoringConnectionsIds
Declaration
public virtual string[] MonitoringConnectionsIds { get; }
Property Value
Type | Description |
---|---|
System.String[] |
NewVersionAvailable
Declaration
public bool NewVersionAvailable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Settings
Declaration
public override IList<SettingItem> Settings { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<TradingPlatform.BusinessLayer.SettingItem> |
Overrides
TradingPlatform.BusinessLayer.ExecutionEntity.Settings
State
The current state of the strategy
Declaration
public StrategyState State { get; }
Property Value
Type | Description |
---|---|
StrategyState |
Methods
GetLogs(DateTime, DateTime)
Get logs from the strategy for specified date range
Declaration
public StrategyLoggerEvent[] GetLogs(DateTime from, DateTime to)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | from | |
System.DateTime | to |
Returns
Type | Description |
---|---|
TradingPlatform.BusinessLayer.StrategyLoggerEvent[] |
GetMetrics()
Get current metrics from the strategy
Declaration
public List<StrategyMetric> GetMetrics()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<StrategyMetric> |
Log(String, StrategyLoggingLevel)
Write log message
Declaration
protected void Log(string message, StrategyLoggingLevel level = StrategyLoggingLevel.Info)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | |
StrategyLoggingLevel | level |
OnCreated()
Declaration
protected virtual void OnCreated()
OnGetMetrics()
Declaration
protected virtual List<StrategyMetric> OnGetMetrics()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<StrategyMetric> |
OnRemove()
Declaration
protected virtual void OnRemove()
OnRun()
Declaration
protected virtual void OnRun()
OnStop()
Declaration
protected virtual void OnStop()
Remove()
Remove the strategy
Declaration
public void Remove()
Run()
Run strategy
Declaration
public void Run()
Stop()
Stop strategy
Declaration
public void Stop()
Events
NewLog
Event occured when strategy write a new log
Declaration
public event StrategyEventHandler NewLog
Event Type
Type | Description |
---|---|
TradingPlatform.BusinessLayer.StrategyEventHandler |
SettingsChanged
Event occured if any of strategy settings was changed
Declaration
public event Action SettingsChanged
Event Type
Type | Description |
---|---|
System.Action |