mirror of
https://github.com/StockSharp/StockSharp.git
synced 2026-12-06 01:22:11 +00:00
96 lines
2.8 KiB
C#
96 lines
2.8 KiB
C#
namespace StockSharp.BitStamp;
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Security;
|
|
|
|
using Ecng.ComponentModel;
|
|
|
|
/// <summary>
|
|
/// The message adapter for <see cref="BitStamp"/>.
|
|
/// </summary>
|
|
[MediaIcon(Media.MediaNames.bitstamp)]
|
|
[Doc("topics/api/connectors/crypto_exchanges/bitstamp.html")]
|
|
[Display(
|
|
ResourceType = typeof(LocalizedStrings),
|
|
Name = LocalizedStrings.BitStampKey,
|
|
Description = LocalizedStrings.CryptoConnectorKey,
|
|
GroupName = LocalizedStrings.CryptocurrencyKey)]
|
|
[MessageAdapterCategory(MessageAdapterCategories.Crypto | MessageAdapterCategories.RealTime |
|
|
MessageAdapterCategories.Free | MessageAdapterCategories.Ticks | MessageAdapterCategories.MarketDepth |
|
|
MessageAdapterCategories.Level1 | MessageAdapterCategories.Transactions | MessageAdapterCategories.OrderLog)]
|
|
public partial class BitStampMessageAdapter : IKeySecretAdapter
|
|
{
|
|
/// <summary>
|
|
/// Default value for <see cref="MessageAdapter.HeartbeatInterval"/>.
|
|
/// </summary>
|
|
public static readonly TimeSpan DefaultHeartbeatInterval = TimeSpan.FromSeconds(1);
|
|
|
|
/// <inheritdoc />
|
|
[Display(
|
|
ResourceType = typeof(LocalizedStrings),
|
|
Name = LocalizedStrings.KeyKey,
|
|
Description = LocalizedStrings.KeyKey + LocalizedStrings.Dot,
|
|
GroupName = LocalizedStrings.ConnectionKey,
|
|
Order = 0)]
|
|
[BasicSetting]
|
|
public SecureString Key { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
[Display(
|
|
ResourceType = typeof(LocalizedStrings),
|
|
Name = LocalizedStrings.SecretKey,
|
|
Description = LocalizedStrings.SecretDescKey,
|
|
GroupName = LocalizedStrings.ConnectionKey,
|
|
Order = 1)]
|
|
[BasicSetting]
|
|
public SecureString Secret { get; set; }
|
|
|
|
private TimeSpan _balanceCheckInterval;
|
|
|
|
/// <summary>
|
|
/// Balance check interval. Required in case of deposit and withdraw actions.
|
|
/// </summary>
|
|
[Display(
|
|
ResourceType = typeof(LocalizedStrings),
|
|
Name = LocalizedStrings.BalanceKey,
|
|
Description = LocalizedStrings.BalanceCheckIntervalKey,
|
|
GroupName = LocalizedStrings.ConnectionKey,
|
|
Order = 3)]
|
|
public TimeSpan BalanceCheckInterval
|
|
{
|
|
get => _balanceCheckInterval;
|
|
set
|
|
{
|
|
if (value < TimeSpan.Zero)
|
|
throw new ArgumentOutOfRangeException(nameof(value));
|
|
|
|
_balanceCheckInterval = value;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Save(SettingsStorage storage)
|
|
{
|
|
base.Save(storage);
|
|
|
|
storage.SetValue(nameof(Key), Key);
|
|
storage.SetValue(nameof(Secret), Secret);
|
|
storage.SetValue(nameof(BalanceCheckInterval), BalanceCheckInterval);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void Load(SettingsStorage storage)
|
|
{
|
|
base.Load(storage);
|
|
|
|
Key = storage.GetValue<SecureString>(nameof(Key));
|
|
Secret = storage.GetValue<SecureString>(nameof(Secret));
|
|
BalanceCheckInterval = storage.GetValue<TimeSpan>(nameof(BalanceCheckInterval));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override string ToString()
|
|
{
|
|
return base.ToString() + ": " + LocalizedStrings.Key + " = " + Key.ToId();
|
|
}
|
|
} |