Table of Contents

Class AlpacaMessageAdapter

Namespace
StockSharp.Alpaca
Assembly
StockSharp.Alpaca.dll

The message adapter for StockSharp.Alpaca.

[MediaIcon("Alpaca_logo.svg")]
[Display(ResourceType = typeof(LocalizedStrings), Name = "Alpaca", Description = "StockConnector", GroupName = "America")]
[MessageAdapterCategory(MessageAdapterCategories.US|MessageAdapterCategories.Stock|MessageAdapterCategories.RealTime|MessageAdapterCategories.Ticks|MessageAdapterCategories.Candles|MessageAdapterCategories.MarketDepth|MessageAdapterCategories.Level1|MessageAdapterCategories.Transactions|MessageAdapterCategories.Futures|MessageAdapterCategories.Options)]
[OrderCondition(typeof(AlpacaOrderCondition))]
public class AlpacaMessageAdapter : AsyncMessageAdapter, IMessageAdapter, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanged, IKeySecretAdapter, IDemoAdapter
Inheritance
AlpacaMessageAdapter
Implements
ICloneable<IMessageChannel>
IPersistable
Inherited Members
Extension Methods

Constructors

AlpacaMessageAdapter(IdGenerator)

Initializes a new instance of the AlpacaMessageAdapter.

public AlpacaMessageAdapter(IdGenerator transactionIdGenerator)

Parameters

transactionIdGenerator IdGenerator

Transaction id generator.

Properties

CryptoLocation

Data for the stock market.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Crypto", Description = "Source", GroupName = "Connection", Order = 4)]
public string CryptoLocation { get; set; }

Property Value

string

FeatureName

Feature name.

public override string FeatureName { get; }

Property Value

string

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

Key

Key.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Key", Description = "KeyDot", GroupName = "Connection", Order = 0)]
public SecureString Key { get; set; }

Property Value

SecureString

Secret

Secret.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Secret", Description = "SecretDesc", GroupName = "Connection", Order = 1)]
public SecureString Secret { get; set; }

Property Value

SecureString

Sections

Sections.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Sections", Description = "SectionsDesc", GroupName = "Connection", Order = 5)]
public IEnumerable<AlpacaSections> Sections { get; set; }

Property Value

IEnumerable<AlpacaSections>

StockFeed

Data for the stock market.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Stock", Description = "StockData", GroupName = "Connection", Order = 4)]
public string StockFeed { get; set; }

Property Value

string

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 message, CancellationToken cancellationToken)

Parameters

message OrderCancelMessage
cancellationToken CancellationToken

CancellationToken.

Returns

ValueTask

ValueTask.

CancelOrderGroupAsync(OrderGroupCancelMessage, CancellationToken)

public override ValueTask CancelOrderGroupAsync(OrderGroupCancelMessage cancelMsg, CancellationToken cancellationToken)

Parameters

cancelMsg OrderGroupCancelMessage

OrderGroupCancelMessage.

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.

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

OnNewsSubscriptionAsync(MarketDataMessage, CancellationToken)

protected override ValueTask OnNewsSubscriptionAsync(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

OnTicksSubscriptionAsync(MarketDataMessage, CancellationToken)

protected override ValueTask OnTicksSubscriptionAsync(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.

ToString()

public override string ToString()

Returns

string