Class BinanceMessageAdapter
- Namespace
- StockSharp.Binance
- Assembly
- StockSharp.Binance.dll
The message adapter for StockSharp.Binance.
[MediaIcon("Binance_logo.svg")]
[Display(ResourceType = typeof(LocalizedStrings), Name = "Binance", Description = "CryptoConnector", GroupName = "Cryptocurrency")]
[MessageAdapterCategory(MessageAdapterCategories.Crypto|MessageAdapterCategories.RealTime|MessageAdapterCategories.Free|MessageAdapterCategories.Ticks|MessageAdapterCategories.MarketDepth|MessageAdapterCategories.Level1|MessageAdapterCategories.OrderLog|MessageAdapterCategories.Transactions)]
[OrderCondition(typeof(BinanceOrderCondition))]
public class BinanceMessageAdapter : AsyncMessageAdapter, IMessageAdapter, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanged, IKeySecretAdapter, IDemoAdapter
- Inheritance
-
BinanceMessageAdapter
- Implements
-
ICloneable<IMessageChannel>IPersistable
- Inherited Members
- Extension Methods
Constructors
BinanceMessageAdapter(IdGenerator)
Initializes a new instance of the BinanceMessageAdapter.
public BinanceMessageAdapter(IdGenerator transactionIdGenerator)
Parameters
transactionIdGenerator
IdGeneratorTransaction id generator.
Properties
AllTimeFrames
Possible time-frames.
public static IEnumerable<TimeSpan> AllTimeFrames { get; }
Property Value
AssociatedBoards
The adapter can process subscription only with instruments associated with the specified board.
public override string[] AssociatedBoards { get; }
Property Value
- string[]
HostRestFuture
REST host for future.
[Display(ResourceType = typeof(LocalizedStrings), Name = "FuturesSection", Description = "FuturesSection", GroupName = "Addresses", Order = 2)]
public string HostRestFuture { get; set; }
Property Value
HostRestFutureCoin
REST host for future coin.
[Display(ResourceType = typeof(LocalizedStrings), Name = "FuturesCoinSection", Description = "FuturesCoinSection", GroupName = "Addresses", Order = 3)]
public string HostRestFutureCoin { get; set; }
Property Value
HostRestSpot
REST host for spot/margin.
[Display(ResourceType = typeof(LocalizedStrings), Name = "SpotSection", Description = "SpotSection", GroupName = "Addresses", Order = 1)]
public string HostRestSpot { get; set; }
Property Value
HostWebSocketFuture
Websocket host for future.
[Display(ResourceType = typeof(LocalizedStrings), Name = "FuturesSection", Description = "FuturesSection", GroupName = "WebSocketAddresses", Order = 2)]
public string HostWebSocketFuture { get; set; }
Property Value
HostWebSocketFutureCoin
Websocket host for future coin.
[Display(ResourceType = typeof(LocalizedStrings), Name = "FuturesCoinSection", Description = "FuturesCoinSection", GroupName = "WebSocketAddresses", Order = 3)]
public string HostWebSocketFutureCoin { get; set; }
Property Value
HostWebSocketSpot
Websocket host for spot/margin.
[Display(ResourceType = typeof(LocalizedStrings), Name = "SpotSection", Description = "SpotSection", GroupName = "WebSocketAddresses", Order = 1)]
public string HostWebSocketSpot { get; set; }
Property Value
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
IsSupportOrderBookIncrements
Adapter translates incremental order books.
public override bool IsSupportOrderBookIncrements { get; }
Property Value
Key
Key.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Key", Description = "KeyDot", GroupName = "Connection", Order = 0)]
public SecureString Key { get; set; }
Property Value
RemoveListenKeyOnDisconnect
Remove listen key on disconnect.
[Display(ResourceType = typeof(LocalizedStrings), GroupName = "Connection", Order = 4)]
public bool RemoveListenKeyOnDisconnect { get; set; }
Property Value
Secret
Secret.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Secret", Description = "SecretDesc", GroupName = "Connection", Order = 1)]
public SecureString Secret { get; set; }
Property Value
Sections
Sections.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Sections", Description = "SectionsDesc", GroupName = "Connection", Order = 2)]
public IEnumerable<BinanceSections> Sections { get; set; }
Property Value
TimeFrames
Get possible time-frames for the specified instrument.
protected override IEnumerable<TimeSpan> TimeFrames { get; }
Property Value
Methods
CancelOrderAsync(OrderCancelMessage, CancellationToken)
Process OrderCancelMessage.
public override ValueTask CancelOrderAsync(OrderCancelMessage cancelMsg, CancellationToken cancellationToken)
Parameters
cancelMsg
OrderCancelMessagecancellationToken
CancellationToken
Returns
ConnectAsync(ConnectMessage, CancellationToken)
Process ConnectMessage.
public override ValueTask ConnectAsync(ConnectMessage connectMsg, CancellationToken cancellationToken)
Parameters
connectMsg
ConnectMessagecancellationToken
CancellationToken
Returns
DisconnectAsync(DisconnectMessage, CancellationToken)
Process DisconnectMessage.
public override ValueTask DisconnectAsync(DisconnectMessage disconnectMsg, CancellationToken cancellationToken)
Parameters
disconnectMsg
DisconnectMessagecancellationToken
CancellationToken
Returns
IsAllDownloadingSupported(DataType)
Is for the specified dataType
all securities downloading enabled.
public override bool IsAllDownloadingSupported(DataType dataType)
Parameters
dataType
DataTypeData type info.
Returns
- bool
Check result.
IsSupportCandlesUpdates(MarketDataMessage)
Support candles subscription and live updates.
public override bool IsSupportCandlesUpdates(MarketDataMessage subscription)
Parameters
subscription
MarketDataMessage
Returns
- bool
Check result.
Load(SettingsStorage)
Load settings.
public override void Load(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
OnLevel1SubscriptionAsync(MarketDataMessage, CancellationToken)
protected override ValueTask OnLevel1SubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)
Parameters
mdMsg
MarketDataMessagecancellationToken
CancellationToken
Returns
OnMarketDepthSubscriptionAsync(MarketDataMessage, CancellationToken)
protected override ValueTask OnMarketDepthSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)
Parameters
mdMsg
MarketDataMessagecancellationToken
CancellationToken
Returns
OnOrderLogSubscriptionAsync(MarketDataMessage, CancellationToken)
protected override ValueTask OnOrderLogSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)
Parameters
mdMsg
MarketDataMessagecancellationToken
CancellationToken
Returns
OnTFCandlesSubscriptionAsync(MarketDataMessage, CancellationToken)
protected override ValueTask OnTFCandlesSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)
Parameters
mdMsg
MarketDataMessagecancellationToken
CancellationToken
Returns
OnTicksSubscriptionAsync(MarketDataMessage, CancellationToken)
protected override ValueTask OnTicksSubscriptionAsync(MarketDataMessage mdMsg, CancellationToken cancellationToken)
Parameters
mdMsg
MarketDataMessagecancellationToken
CancellationToken
Returns
OrderStatusAsync(OrderStatusMessage, CancellationToken)
Process OrderStatusMessage.
public override ValueTask OrderStatusAsync(OrderStatusMessage statusMsg, CancellationToken cancellationToken)
Parameters
statusMsg
OrderStatusMessagecancellationToken
CancellationToken
Returns
PortfolioLookupAsync(PortfolioLookupMessage, CancellationToken)
Process PortfolioLookupMessage.
public override ValueTask PortfolioLookupAsync(PortfolioLookupMessage lookupMsg, CancellationToken cancellationToken)
Parameters
lookupMsg
PortfolioLookupMessagecancellationToken
CancellationToken
Returns
RegisterOrderAsync(OrderRegisterMessage, CancellationToken)
Process OrderRegisterMessage.
public override ValueTask RegisterOrderAsync(OrderRegisterMessage regMsg, CancellationToken cancellationToken)
Parameters
regMsg
OrderRegisterMessagecancellationToken
CancellationToken
Returns
ResetAsync(ResetMessage, CancellationToken)
Process ResetMessage.
public override ValueTask ResetAsync(ResetMessage resetMsg, CancellationToken cancellationToken)
Parameters
resetMsg
ResetMessagecancellationToken
CancellationToken
Returns
Remarks
Must NOT throw.
Save(SettingsStorage)
Save settings.
public override void Save(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
SecurityLookupAsync(SecurityLookupMessage, CancellationToken)
Process SecurityLookupMessage.
public override ValueTask SecurityLookupAsync(SecurityLookupMessage lookupMsg, CancellationToken cancellationToken)
Parameters
lookupMsg
SecurityLookupMessagecancellationToken
CancellationToken
Returns
TimeAsync(TimeMessage, CancellationToken)
Process TimeMessage.
public override ValueTask TimeAsync(TimeMessage timeMsg, CancellationToken cancellationToken)
Parameters
timeMsg
TimeMessagecancellationToken
CancellationToken
Returns
ToString()
public override string ToString()