Table of Contents

Class cTraderMessageAdapter

Namespace
StockSharp.cTrader
Assembly
StockSharp.cTrader.dll

The message adapter for StockSharp.cTrader.

[MediaIcon("cTrader_logo.svg")]
[Display(ResourceType = typeof(LocalizedStrings), Name = "cTrader", Description = "ForexConnector", GroupName = "Forex")]
[MessageAdapterCategory(MessageAdapterCategories.FX|MessageAdapterCategories.RealTime|MessageAdapterCategories.Free|MessageAdapterCategories.Candles|MessageAdapterCategories.MarketDepth|MessageAdapterCategories.Level1|MessageAdapterCategories.Transactions)]
[OrderCondition(typeof(cTraderOrderCondition))]
public class cTraderMessageAdapter : AsyncMessageAdapter, IMessageAdapter, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanged, IDemoAdapter, IAddressAdapter<EndPoint>
Inheritance
cTraderMessageAdapter
Implements
ICloneable<IMessageChannel>
IPersistable
Inherited Members
Extension Methods

Constructors

cTraderMessageAdapter(IdGenerator)

Initializes a new instance of the cTraderMessageAdapter.

public cTraderMessageAdapter(IdGenerator transactionIdGenerator)

Parameters

transactionIdGenerator IdGenerator

Transaction id generator.

Properties

Address

Address.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Address", Description = "AddressDot", GroupName = "Connection", Order = 0)]
public EndPoint Address { get; set; }

Property Value

EndPoint

AllTimeFrames

Possible time-frames.

public static IEnumerable<TimeSpan> AllTimeFrames { get; }

Property Value

IEnumerable<TimeSpan>

FeatureName

Feature name.

public override string FeatureName { get; }

Property Value

string

IsAutoReplyOnTransactonalUnsubscription

Send auto response for OrderStatusMessage and PortfolioLookupMessage unsubscribes.

public override bool IsAutoReplyOnTransactonalUnsubscription { get; }

Property Value

bool

IsDemo

Connect to demo trading instead of real trading server.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Demo", Description = "DemoTradingConnect", GroupName = "Connection", Order = 3)]
public bool IsDemo { get; set; }

Property Value

bool

IsNativeIdentifiers

Identify security in messages by native identifier Native.

public override bool IsNativeIdentifiers { get; }

Property Value

bool

IsNativeIdentifiersPersistable

Native identifier can be stored.

public override bool IsNativeIdentifiersPersistable { get; }

Property Value

bool

IsReplaceCommandEditCurrent

Is the OrderReplaceMessage command edit a current order.

public override bool IsReplaceCommandEditCurrent { get; }

Property Value

bool

TimeFrames

Get possible time-frames for the specified instrument.

protected override IEnumerable<TimeSpan> TimeFrames { get; }

Property Value

IEnumerable<TimeSpan>

Methods

CancelOrderAsync(OrderCancelMessage, CancellationToken)

public override ValueTask CancelOrderAsync(OrderCancelMessage cancelMsg, CancellationToken cancellationToken)

Parameters

cancelMsg OrderCancelMessage

OrderCancelMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

ConnectAsync(ConnectMessage, CancellationToken)

Process ConnectMessage.

public override ValueTask ConnectAsync(ConnectMessage msg, CancellationToken cancellationToken)

Parameters

msg ConnectMessage
cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

DisconnectAsync(DisconnectMessage, CancellationToken)

public override ValueTask DisconnectAsync(DisconnectMessage msg, CancellationToken cancellationToken)

Parameters

msg DisconnectMessage
cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

IsAllDownloadingSupported(DataType)

Is for the specified dataType all securities downloading enabled.

public override bool IsAllDownloadingSupported(DataType dataType)

Parameters

dataType DataType

Data type info.

Returns

bool

Check result.

IsSupportCandlesUpdates(MarketDataMessage)

Support candles subscription and live updates.

public override bool IsSupportCandlesUpdates(MarketDataMessage subscription)

Parameters

subscription MarketDataMessage

MarketDataMessage

Returns

bool

Check result.

Load(SettingsStorage)

Load settings.

public override void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

OnLevel1SubscriptionAsync(MarketDataMessage, CancellationToken)

protected override ValueTask OnLevel1SubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)

Parameters

mdMsg MarketDataMessage
cancellationToken CancellationToken

Returns

ValueTask

OnMarketDepthSubscriptionAsync(MarketDataMessage, CancellationToken)

protected override ValueTask OnMarketDepthSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)

Parameters

mdMsg MarketDataMessage
cancellationToken CancellationToken

Returns

ValueTask

OnTFCandlesSubscriptionAsync(MarketDataMessage, CancellationToken)

protected override ValueTask OnTFCandlesSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)

Parameters

mdMsg MarketDataMessage
cancellationToken CancellationToken

Returns

ValueTask

OrderStatusAsync(OrderStatusMessage, CancellationToken)

public override ValueTask OrderStatusAsync(OrderStatusMessage statusMsg, CancellationToken cancellationToken)

Parameters

statusMsg OrderStatusMessage

OrderStatusMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

PortfolioLookupAsync(PortfolioLookupMessage, CancellationToken)

public override ValueTask PortfolioLookupAsync(PortfolioLookupMessage lookupMsg, CancellationToken cancellationToken)

Parameters

lookupMsg PortfolioLookupMessage

PortfolioLookupMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

RegisterOrderAsync(OrderRegisterMessage, CancellationToken)

public override ValueTask RegisterOrderAsync(OrderRegisterMessage regMsg, CancellationToken cancellationToken)

Parameters

regMsg OrderRegisterMessage

OrderRegisterMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

ReplaceOrderAsync(OrderReplaceMessage, CancellationToken)

public override ValueTask ReplaceOrderAsync(OrderReplaceMessage replaceMsg, CancellationToken cancellationToken)

Parameters

replaceMsg OrderReplaceMessage

OrderReplaceMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

ResetAsync(ResetMessage, CancellationToken)

Process ResetMessage.

public override ValueTask ResetAsync(ResetMessage resetMsg, CancellationToken cancellationToken)

Parameters

resetMsg ResetMessage

ResetMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

Remarks

Must NOT throw.

Save(SettingsStorage)

Save settings.

public override void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

SecurityLookupAsync(SecurityLookupMessage, CancellationToken)

public override ValueTask SecurityLookupAsync(SecurityLookupMessage lookupMsg, CancellationToken cancellationToken)

Parameters

lookupMsg SecurityLookupMessage

SecurityLookupMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

TimeAsync(TimeMessage, CancellationToken)

Process TimeMessage.

public override ValueTask TimeAsync(TimeMessage timeMsg, CancellationToken cancellationToken)

Parameters

timeMsg TimeMessage

TimeMessage.

cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.