Class BaseConnectorSettings<T, TSelf>
- Namespace
- OFT.Core
- Assembly
- ATAS.DataFeedsCore.dll
The base class of the settings of a connector. The platform finds a public non-abstract settings class with a public parameterless constructor and creates the connector through it. A derived class must override Features, OnApplySettings(T) and CompareCredentials(TSelf), and can override CheckSupported(out string?) and SettingsTypes. Its System.ComponentModel.DisplayNameAttribute is the connector name and must be unique; System.ComponentModel.DescriptionAttribute and System.ComponentModel.CategoryAttribute set the text and the group in the "Add connection" dialog. Its public properties are shown in the connection settings and saved with the connection as JSON. Third-party connectors provide market data only; trading through them is not supported.
Added in ATAS 8.0.15.
public abstract class BaseConnectorSettings<T, TSelf> : BaseConnectorSettings, IConnectorSettings where T : class, IDataFeedConnector, new() where TSelf : BaseConnectorSettings<T, TSelf>
Type Parameters
TThe connector type; the settings create it with its parameterless constructor.
TSelfThe derived settings class itself.
- Inheritance
-
objectBaseConnectorSettings<T, TSelf>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseConnectorSettings()
protected BaseConnectorSettings()
Methods
CompareCredentials(IConnectorSettings)
Calls CompareCredentials(TSelf) with the typed settings.
protected override sealed bool CompareCredentials(IConnectorSettings other)
Parameters
otherIConnectorSettingsSettings of the same type.
Returns
- bool
The result of CompareCredentials(TSelf).
CompareCredentials(TSelf)
Returns true if both connections use the same account: the platform does not connect two such connections at once. Mandatory; return false when the connection has no credentials.
protected abstract bool CompareCredentials(TSelf other)
Parameters
otherTSelfSettings of the same type.
Returns
OnApplySettings(IDataFeedConnector)
Calls OnApplySettings(T) with the typed connector.
protected override void OnApplySettings(IDataFeedConnector connector)
Parameters
connectorIDataFeedConnectorThe connector of this connection.
Exceptions
- InvalidOperationException
connectoris not aT.
OnApplySettings(T)
Copies the settings of the derived class to the connector. Mandatory. The platform calls it after the connector is created and after every change of the settings; changed settings whose application throws are not saved. It also runs while the platform starts, so keep it fast and free of I/O.
protected abstract void OnApplySettings(T connector)
Parameters
connectorTThe connector of this connection.
OnCreateConnector(string)
Creates the connector with the parameterless constructor of T.
protected override IDataFeedConnector OnCreateConnector(string dataPath)
Parameters
dataPathstringThe data folder of the connector; not used here.
Returns
- IDataFeedConnector
The new connector.