本文整理汇总了C#中SecurityId类的典型用法代码示例。如果您正苦于以下问题:C# SecurityId类的具体用法?C# SecurityId怎么用?C# SecurityId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SecurityId类属于命名空间,在下文中一共展示了SecurityId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public void Create(UserId userId, SecurityId securityId)
{
if (_state.Version != 0)
throw new DomainError("User already has non-zero version");
Apply(new UserCreated(userId, securityId, DefaultLoginActivityThreshold));
}
示例2: Create
public static IEnumerable<ISampleMessage> Create()
{
var security = new SecurityId(0);
yield return (new CreateSecurityAggregate(security));
yield return (new AddSecurityPassword(security, "Rinat Abdullin", "[email protected]", "password"));
yield return (new AddSecurityIdentity(security, "Rinat's Open ID", "http://abdullin.myopenid.org"));
yield return (new AddSecurityKey(security, "some key"));
}
示例3: MarketDepthGenerator
/// <summary>
/// Initialize <see cref="MarketDepthGenerator"/>.
/// </summary>
/// <param name="securityId">The identifier of the instrument, for which data shall be generated.</param>
protected MarketDepthGenerator(SecurityId securityId)
: base(securityId)
{
UseTradeVolume = true;
MinSpreadStepCount = 1;
MaxSpreadStepCount = int.MaxValue;
MaxBidsDepth = 10;
MaxAsksDepth = 10;
MaxGenerations = 20;
}
示例4: GetDrive
IMarketDataStorageDrive IMarketDataDrive.GetStorageDrive(SecurityId securityId, Type dataType, object arg, StorageFormats format)
{
var drive = GetDrive();
var storageDrive = drive.GetStorageDrive(securityId, dataType, arg, format);
if (drive == _remoteDrive)
storageDrive = new CacheableMarketDataDrive(storageDrive, _cacheDrive.GetStorageDrive(securityId, dataType, arg, format));
return storageDrive;
}
示例5: OrderLogGenerator
/// <summary>
/// Создать <see cref="OrderLogGenerator"/>.
/// </summary>
/// <param name="securityId">Идентификатор инструмента, для которого необходимо генерировать данные.</param>
/// <param name="tradeGenerator">Генератор тиковых сделок случайным методом.</param>
public OrderLogGenerator(SecurityId securityId, TradeGenerator tradeGenerator)
: base(securityId)
{
if (tradeGenerator == null)
throw new ArgumentNullException("tradeGenerator");
//_lastOrderPrice = startPrice;
TradeGenerator = tradeGenerator;
IdGenerator = new IncrementalIdGenerator();
}
示例6: ReplaceSecurityId
private void ReplaceSecurityId(SecurityId securityId, Action<SecurityId> setSecurityId)
{
if (securityId.Native == null)
return;
SecurityId id;
if (!_securityIds.TryGetValue(securityId.Native, out id))
return;
setSecurityId(new SecurityId { SecurityCode = id.SecurityCode, BoardCode = id.BoardCode, Native = securityId.Native });
}
示例7: CreatePositionChangeMessage
/// <summary>
/// Создать <see cref="PositionChangeMessage"/>.
/// </summary>
/// <param name="adapter">Апаптер к торговой системе.</param>
/// <param name="pfName">Название портфеля.</param>
/// <param name="securityId">Идентификатор инструмента.</param>
/// <returns>Сообщение об изменении позиции.</returns>
public static PositionChangeMessage CreatePositionChangeMessage(this IMessageAdapter adapter, string pfName, SecurityId securityId)
{
if (adapter == null)
throw new ArgumentNullException("adapter");
var time = adapter.CurrentTime;
return new PositionChangeMessage
{
PortfolioName = pfName,
SecurityId = securityId,
LocalTime = time.LocalDateTime,
ServerTime = time,
};
}
示例8: ProcessSecurityLookup
private void ProcessSecurityLookup(SecurityLookupMessage lookupMsg)
{
var reply = _client.GetInstruments();
foreach (var info in reply.Items.Values)
{
var secId = new SecurityId
{
SecurityCode = info.Name.ToStockSharpCode(),
BoardCode = _boardCode,
};
// NOTE сейчас BTCE транслирует для данного тикера
// кол-во знаков после запятой 3 и мин цена 0.0001
if (secId.SecurityCode.CompareIgnoreCase("ltc/eur"))
info.MinPrice = 0.001;
// NOTE сейчас BTCE транслирует для данного тикера
// кол-во знаков после запятой 2, но цены содержат 5 знаков
if (secId.SecurityCode.CompareIgnoreCase("btc/cnh"))
info.DecimalDigits = 5;
if (secId.SecurityCode.CompareIgnoreCase("btc/usd"))
info.DecimalDigits = 5;
SendOutMessage(new SecurityMessage
{
SecurityId = secId,
Decimals = info.DecimalDigits,
VolumeStep = (decimal)info.MinVolume,
SecurityType = SecurityTypes.CryptoCurrency,
OriginalTransactionId = lookupMsg.TransactionId,
});
SendOutMessage(new Level1ChangeMessage
{
SecurityId = secId,
ServerTime = reply.Timestamp.ApplyTimeZone(TimeHelper.Moscow)
}
.TryAdd(Level1Fields.MinPrice, (decimal)info.MinPrice)
.TryAdd(Level1Fields.MaxPrice, (decimal)info.MaxPrice)
.Add(Level1Fields.State, info.IsHidden ? SecurityStates.Stoped : SecurityStates.Trading));
}
SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = lookupMsg.TransactionId });
}
示例9: ExecutionLogConverter
public ExecutionLogConverter(SecurityId securityId,
SortedDictionary<decimal, RefPair<List<ExecutionMessage>, QuoteChange>> bids,
SortedDictionary<decimal, RefPair<List<ExecutionMessage>, QuoteChange>> asks,
MarketEmulatorSettings settings)
{
if (bids == null)
throw new ArgumentNullException("bids");
if (asks == null)
throw new ArgumentNullException("asks");
if (settings == null)
throw new ArgumentNullException("settings");
_bids = bids;
_asks = asks;
_settings = settings;
SecurityId = securityId;
}
示例10: ExecutionLogConverter
public ExecutionLogConverter(SecurityId securityId,
SortedDictionary<decimal, RefPair<List<ExecutionMessage>, QuoteChange>> bids,
SortedDictionary<decimal, RefPair<List<ExecutionMessage>, QuoteChange>> asks,
MarketEmulatorSettings settings, Func<DateTime, DateTimeOffset> getServerTime)
{
if (bids == null)
throw new ArgumentNullException(nameof(bids));
if (asks == null)
throw new ArgumentNullException(nameof(asks));
if (settings == null)
throw new ArgumentNullException(nameof(settings));
if (getServerTime == null)
throw new ArgumentNullException(nameof(getServerTime));
_bids = bids;
_asks = asks;
_settings = settings;
_getServerTime = getServerTime;
SecurityId = securityId;
}
示例11: Ok_Click
private void Ok_Click(object sender, RoutedEventArgs e)
{
var secId = new SecurityId();
//{
// SecurityCode = SecCode.Text,
//};
if (!BoardName.Text.IsEmpty())
secId.BoardCode = BoardName.Text;
if (!ContractId.Text.IsEmpty())
secId.Native = ContractId.Text.To<int>();
MainWindow.Instance.Trader.LookupSecurities(new SecurityLookupMessage
{
SecurityId = secId,
Name = SecCode.Text,
Currency = CurrencyTypes.USD,
SecurityType = SecType.GetSelectedValue<SecurityTypes>() ?? default(SecurityTypes),
TransactionId = MainWindow.Instance.Trader.TransactionIdGenerator.GetNextId(),
});
DialogResult = true;
}
示例12: ClientOnProductLookupResult
/// <summary>Коллбэк результата поиска инструментов.</summary>
/// <param name="lookupTransId">Номер транзакции операции Lookup.</param>
/// <param name="data">Список инструментов, удовлетворяющих условию поиска.</param>
/// <param name="ex">Ошибка поиска.</param>
private void ClientOnProductLookupResult(long lookupTransId, IEnumerable<ProductInfo> data, Exception ex)
{
if (ex != null)
{
SendOutError(new ETradeException(LocalizedStrings.Str3363, ex));
if (lookupTransId > 0)
SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = lookupTransId });
return;
}
foreach(var info in data.Where(info => info.securityType == "EQ"))
{
var secId = new SecurityId
{
SecurityCode = info.symbol,
BoardCode = AssociatedBoardCode,
};
var msg = new SecurityMessage
{
SecurityId = secId,
Name = info.companyName,
ShortName = info.companyName,
SecurityType = SecurityTypes.Stock,
PriceStep = 0.01m,
Currency = CurrencyTypes.USD,
};
SendOutMessage(msg);
}
if (lookupTransId > 0)
SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = lookupTransId });
}
示例13: CreateOrderLogMarketDepthBuilder
/// <summary>
/// Create market depth builder.
/// </summary>
/// <param name="securityId">Security ID.</param>
/// <returns>Order log to market depth builder.</returns>
public virtual IOrderLogMarketDepthBuilder CreateOrderLogMarketDepthBuilder(SecurityId securityId)
{
throw new NotSupportedException();
}
示例14: SendOutSecurityMessage
/// <summary>
/// Initialize a new message <see cref="SecurityMessage"/> and pass it to the method <see cref="SendOutMessage"/>.
/// </summary>
/// <param name="securityId">Security ID.</param>
protected void SendOutSecurityMessage(SecurityId securityId)
{
SendOutMessage(new SecurityMessage { SecurityId = securityId });
}
示例15: RandomWalkTradeGenerator
/// <summary>
/// Initializes a new instance of the <see cref="RandomWalkTradeGenerator"/>.
/// </summary>
/// <param name="securityId">The identifier of the instrument, for which data shall be generated.</param>
public RandomWalkTradeGenerator(SecurityId securityId)
: base(securityId)
{
Interval = TimeSpan.FromMilliseconds(50);
}