Table of Contents

Class BaseConnectorSettings

Namespace
OFT.Core
Assembly
ATAS.DataFeedsCore.dll

Base of the connection settings: reads Type, Description and Logo from the attributes of the settings class, copies the common settings to the connector and raises PropertyChanged. A connector derives its settings from BaseConnectorSettings<T, TSelf>.

public abstract class BaseConnectorSettings : IConnectorSettings
Inheritance
object
BaseConnectorSettings
Implements
Derived
Extension Methods

Constructors

BaseConnectorSettings()

Initializes the settings: generates a new Id, reads Type, Description and Logo from the attributes of the settings class, enables market data and AllowUpdatePositionsPnL, and disables automatic connection. The platform calls the public parameterless constructor of the derived class when it creates new settings and when it restores a saved connection while starting, so keep the constructor fast.

protected BaseConnectorSettings()

Properties

AccountKind

Derived from the connector category: simulators and prop connections are kinds of their own, the rest is live or demo by IsDemo.

Not in ATAS 8.0.15 yet: available from the next version.

[Browsable(false)]
public virtual AccountKind AccountKind { get; }

Property Value

AccountKind

AllowUpdatePositionsPnL

Whether the best bid/ask updates recalculate the open PnL of the positions; ApplySettings(IDataFeedConnector) copies it to AllowUpdatePositionsPnL. true by default. Trading-only: third-party connectors have no positions.

[Browsable(false)]
public bool AllowUpdatePositionsPnL { get; set; }

Property Value

bool

ConnectionMode

Not in ATAS 8.0.15 yet: available from the next version.

[Browsable(false)]
public virtual string? ConnectionMode { get; }

Property Value

string

ConnectorServer

Added in ATAS 8.0.15.

[Browsable(false)]
public virtual string? ConnectorServer { get; }

Property Value

string

Description

Description of the connector shown in the "Add connection" dialog and the settings window: the System.ComponentModel.DescriptionAttribute of the settings class, or an empty string without it.

[Browsable(false)]
public string Description { get; }

Property Value

string

DisplayName

User-facing connection name: Name when set, otherwise a connector-specific fallback (e.g. the login).

Not in ATAS 8.0.15 yet: available from the next version.

[Display(Order = 1, GroupName = "Common", Name = "ConnectionName", Description = "ConnectionNameDescription", ResourceType = typeof(Strings))]
public virtual string DisplayName { get; set; }

Property Value

string

Features

What the connection supports. Mandatory: a third-party connector returns MarketData; trading through third-party connectors is not supported, so do not add Executions, StopOrders or OcoOrders.

[Browsable(false)]
public abstract ConnectorFeatures Features { get; }

Property Value

ConnectorFeatures

Id

Unique identifier of the connection. BaseConnectorSettings generates a new one in its constructor.

[Browsable(false)]
public Guid Id { get; set; }

Property Value

Guid

IsAutoConnectEnabled

Whether the platform connects this connection automatically when it starts.

[Browsable(false)]
public bool IsAutoConnectEnabled { get; set; }

Property Value

bool

Remarks

false by default.

IsDemo

Indicates that the connector uses a test (demo) environment; false by default. Used for telemetry and for AccountKind.

[Browsable(false)]
public virtual bool IsDemo { get; }

Property Value

bool

IsFavorite

Not in ATAS 8.0.15 yet: available from the next version.

[Browsable(false)]
public bool IsFavorite { get; set; }

Property Value

bool

IsMarketDataEnabled

Whether the connector raises market data (trades, best bid/ask, order book): ApplySettings(IDataFeedConnector) copies it to MarketDataStreamEnabled.

[Browsable(false)]
public bool IsMarketDataEnabled { get; set; }

Property Value

bool

Remarks

true by default.

Resource URI of the connector logo, from the LogoAttribute of the settings class; null without it.

[Browsable(false)]
public Uri Logo { get; }

Property Value

Uri

MarketDataDelayPeriod

Delay of the market data of this connection; ApplySettings(IDataFeedConnector) copies it to MarketDataDelayPeriod. BaseConnectorSettings returns Realtime.

[Browsable(false)]
public virtual MarketDataDelayPeriods MarketDataDelayPeriod { get; }

Property Value

MarketDataDelayPeriods

Name

Name the user gave the connection; null or empty until the user names it. Show DisplayName instead.

[Browsable(false)]
public string Name { get; set; }

Property Value

string

RefreshSecuritiesTime

Local time of day of the daily refresh of the security list while connected; ApplySettings(IDataFeedConnector) copies it to RefreshSecuritiesTime. null (the default) turns the refresh off.

[Browsable(false)]
public TimeOnly? RefreshSecuritiesTime { get; set; }

Property Value

TimeOnly?

SettingsTypes

How the connection settings are edited; Properties by default. Override it only when the connection has no editable properties.

[Browsable(false)]
public virtual ConnectorSettingsTypes SettingsTypes { get; }

Property Value

ConnectorSettingsTypes

Type

Name of the connector type: the System.ComponentModel.DisplayNameAttribute of the settings class, or the class name without it; set by the constructor. It identifies the connector, and the data folder of the connector is named after it. Not saved with the connection.

[Browsable(false)]
public string Type { get; set; }

Property Value

string

Methods

ApplySettings(IDataFeedConnector)

Copies IsMarketDataEnabled, AllowUpdatePositionsPnL, MarketDataDelayPeriod and RefreshSecuritiesTime to the connector, then calls OnApplySettings(IDataFeedConnector). The platform calls it after the connector is created and after every change of the settings.

public void ApplySettings(IDataFeedConnector connector)

Parameters

connector IDataFeedConnector

The connector of this connection.

Exceptions

ArgumentNullException

connector is null.

CheckSupported(out string?)

Checks if connector is supported on this machine

public virtual bool CheckSupported(out string? errorMessage)

Parameters

errorMessage string

Null if supported otherwise contains error text

Returns

bool

true if no problems detected, false if not supported

CompareCredentials(IConnectorSettings)

Compares credentials with another connector of the same type. The caller (HasSameCredentials(IConnectorSettings)) already guarantees that other is the same Type.

Override examples:

  • Login-based: => this.HaveSameLogin(other);
  • Key-based: => Key.HaveSameValue(other.Key);
  • No credentials: => false;

Added in ATAS 8.0.15.

protected abstract bool CompareCredentials(IConnectorSettings other)

Parameters

other IConnectorSettings

Returns

bool

CreateConnector(string)

Creates the connector with OnCreateConnector(string), sets its DataPath and applies the settings to it (ApplySettings(IDataFeedConnector)).

public IDataFeedConnector CreateConnector(string dataPath)

Parameters

dataPath string

The data folder of the connector, named after Type; the platform creates it if needed.

Returns

IDataFeedConnector

The new connector.

GetCategory()

Category of this settings type: the class-level System.ComponentModel.CategoryAttribute, or the group name of a System.ComponentModel.DataAnnotations.DisplayAttribute. Null when the type declares neither.

Not in ATAS 8.0.15 yet: available from the next version.

protected string? GetCategory()

Returns

string

HasSameCredentials(IConnectorSettings)

Added in ATAS 8.0.15.

public bool HasSameCredentials(IConnectorSettings other)

Parameters

other IConnectorSettings

Returns

bool

OnApplySettings(IDataFeedConnector)

Copies the settings of the derived class to the connector; called by ApplySettings(IDataFeedConnector) after the common settings. BaseConnectorSettings<T, TSelf> forwards it to its typed overload.

protected abstract void OnApplySettings(IDataFeedConnector connector)

Parameters

connector IDataFeedConnector

The connector of this connection.

OnCreateConnector(string)

Creates the connector instance; CreateConnector(string) then sets its data path and applies the settings. BaseConnectorSettings<T, TSelf> creates a new T().

protected abstract IDataFeedConnector OnCreateConnector(string dataPath)

Parameters

dataPath string

The data folder of the connector.

Returns

IDataFeedConnector

The new connector.

RaisePropertyChanged(string)

Raises PropertyChanged for a property.

protected void RaisePropertyChanged(string propertyName)

Parameters

propertyName string

The name of the changed property.

SetProperty<TValue>(ref TValue, TValue, string, Action<TValue, TValue>?)

Stores a new property value and, when it differs from the old one (by object.Equals(object, object)), raises PropertyChanged and then calls onChanged.

Added in ATAS 8.0.15.

protected bool SetProperty<TValue>(ref TValue storage, TValue newValue, string propertyName, Action<TValue, TValue>? onChanged = null)

Parameters

storage TValue

The backing field of the property.

newValue TValue

The new value.

propertyName string

The name of the property.

onChanged Action<TValue, TValue>

Called with the old and the new value after the change; null for none.

Returns

bool

true if the value changed; otherwise, false.

Type Parameters

TValue

The type of the property.

ToString()

Returns the Type of the connector.

public override string ToString()

Returns

string

The Type.

Events

PropertyChanged

Occurs when a property value changes; raised by SetProperty<TValue>(ref TValue, TValue, string, Action<TValue, TValue>?) and RaisePropertyChanged(string).

Added in ATAS 8.0.15.

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler