本文整理汇总了C#中SecurityId类的典型用法代码示例。如果您正苦于以下问题:C# SecurityId类的具体用法?C# SecurityId怎么用?C# SecurityId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecurityId类属于命名空间,在下文中一共展示了SecurityId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:AGiorgetti,项目名称:lokad-cqrs,代码行数:7,代码来源:UserAggregate.cs
示例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"));
}
开发者ID:JeetKunDoug,项目名称:lokad-cqrs,代码行数:8,代码来源:DemoMessages.cs
示例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;
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:14,代码来源:MarketDepthGenerator.cs
示例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;
}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:10,代码来源:StudioStorageRegistry.cs
示例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();
}
开发者ID:reddream,项目名称:StockSharp,代码行数:16,代码来源:OrderLogGenerator.cs
示例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 });
}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:11,代码来源:StudioConnector.cs
示例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,
};
}
开发者ID:reddream,项目名称:StockSharp,代码行数:22,代码来源:Extensions.cs
示例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 });
}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:46,代码来源:BtceMessageAdapter_MarketData.cs
示例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;
}
开发者ID:reddream,项目名称:StockSharp,代码行数:19,代码来源:ExecutionLogConverter.cs
示例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;
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:23,代码来源:ExecutionLogConverter.cs
示例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;
}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:23,代码来源:FindSecurityWindow.xaml.cs
示例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 });
}
开发者ID:xyicheng,项目名称:StockSharp,代码行数:40,代码来源:ETradeMessageAdapter_MarketData.cs
示例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();
}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:9,代码来源:MessageAdapter.cs
示例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 });
}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:8,代码来源:MessageAdapter.cs
示例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);
}
开发者ID:pantov,项目名称:StockSharp,代码行数:9,代码来源:TradeGenerator.cs
示例16: TradeGenerator
/// <summary>
/// Initialize <see cref="TradeGenerator"/>.
/// </summary>
/// <param name="securityId">The identifier of the instrument, for which data shall be generated.</param>
protected TradeGenerator(SecurityId securityId)
: base(securityId)
{
IdGenerator = new IncrementalIdGenerator();
}
开发者ID:pantov,项目名称:StockSharp,代码行数:9,代码来源:TradeGenerator.cs
示例17: ReadPortfolioPosition
private void ReadPortfolioPosition(IBSocket socket, ServerVersions version)
{
var contractId = version >= ServerVersions.V6 ? socket.ReadInt() : -1;
var secName = socket.ReadStr();
var type = socket.ReadSecurityType();
var expiryDate = socket.ReadExpiry();
var strike = socket.ReadDecimal();
var optionType = socket.ReadOptionType();
var multiplier = version >= ServerVersions.V7 ? socket.ReadMultiplier() : null;
var boardCode = version >= ServerVersions.V7 ? socket.ReadBoardCode() : null;
var currency = socket.ReadCurrency();
var secCode = (version >= ServerVersions.V2) ? socket.ReadStr() : secName;
var secClass = (version >= ServerVersions.V8) ? socket.ReadStr() : null;
var position = socket.ReadDecimal();
var marketPrice = socket.ReadDecimal();
var marketValue = socket.ReadDecimal();
var averagePrice = 0m;
var unrealizedPnL = 0m;
var realizedPnL = 0m;
if (version >= ServerVersions.V3)
{
averagePrice = socket.ReadDecimal();
unrealizedPnL = socket.ReadDecimal();
realizedPnL = socket.ReadDecimal();
}
var portfolio = version >= ServerVersions.V4 ? socket.ReadStr() : null;
if (version == ServerVersions.V6 && socket.ServerVersion == ServerVersions.V39)
boardCode = socket.ReadBoardCode();
var secId = new SecurityId
{
SecurityCode = secCode,
BoardCode = GetBoardCode(boardCode),
InteractiveBrokers = contractId,
};
SendOutMessage(new SecurityMessage
{
SecurityId = secId,
Name = secName,
SecurityType = type,
ExpiryDate = expiryDate,
Strike = strike,
OptionType = optionType,
Currency = currency,
Multiplier = multiplier ?? 0,
Class = secClass
});
if (portfolio.IsEmpty())
return;
SendOutMessage(
this
.CreatePositionChangeMessage(portfolio, secId)
.Add(PositionChangeTypes.CurrentValue, position)
.Add(PositionChangeTypes.CurrentPrice, marketPrice)
.Add(PositionChangeTypes.AveragePrice, averagePrice)
.Add(PositionChangeTypes.UnrealizedPnL, unrealizedPnL)
.Add(PositionChangeTypes.RealizedPnL, realizedPnL));
// TODO
//pos.SetMarketValue(marketValue);
}
开发者ID:xyicheng,项目名称:StockSharp,代码行数:71,代码来源:InteractiveBrokersMessageAdapter_Transaction.cs
示例18: ReadMyTrade
private void ReadMyTrade(IBSocket socket, ServerVersions version)
{
/* requestId */
if (version >= ServerVersions.V7)
socket.ReadInt();
// http://www.interactivebrokers.com/en/software/api/apiguide/java/execution.htm
var transactionId = socket.ReadInt();
//Handle the 2^31-1 == 0 bug
if (transactionId == int.MaxValue)
transactionId = 0;
//Read Contract Fields
var contractId = version >= ServerVersions.V5 ? socket.ReadInt() : -1;
var secName = socket.ReadStr();
var type = socket.ReadSecurityType();
var expiryDate = socket.ReadExpiry();
var strike = socket.ReadDecimal();
var optionType = socket.ReadOptionType();
var multiplier = version >= ServerVersions.V9 ? socket.ReadMultiplier() : null;
var boardCode = socket.ReadBoardCode();
var currency = socket.ReadCurrency();
var secCode = socket.ReadLocalCode(secName);
var secClass = (version >= ServerVersions.V10) ? socket.ReadStr() : null;
var tradeId = socket.ReadStr();
var time = socket.ReadDateTime("yyyyMMdd HH:mm:ss");
var portfolio = socket.ReadStr();
/* exchange */
socket.ReadStr();
var side = socket.ReadTradeSide();
var volume = socket.ReadDecimal();
var price = socket.ReadDecimal();
var permId = version >= ServerVersions.V2 ? socket.ReadInt() : (int?)null;
var clientId = version >= ServerVersions.V3 ? socket.ReadInt() : (int?)null;
var liquidation = version >= ServerVersions.V4 ? socket.ReadInt() : (int?)null;
var cumulativeQuantity = version >= ServerVersions.V6 ? socket.ReadInt() : (int?)null;
var averagePrice = version >= ServerVersions.V6 ? socket.ReadDecimal() : (decimal?)null;
var orderRef = version >= ServerVersions.V8 ? socket.ReadStr() : null;
var evRule = version >= ServerVersions.V9 ? socket.ReadStr() : null;
var evMultiplier = version >= ServerVersions.V9 ? socket.ReadDecimal() : (decimal?)null;
var secId = new SecurityId
{
SecurityCode = secCode,
BoardCode = GetBoardCode(boardCode),
InteractiveBrokers = contractId,
};
SendOutMessage(new SecurityMessage
{
SecurityId = secId,
Name = secName,
SecurityType = type,
ExpiryDate = expiryDate,
Strike = strike,
OptionType = optionType,
Currency = currency,
Multiplier = multiplier ?? 0,
Class = secClass
});
// заявка была создана руками
if (transactionId == 0)
return;
_secIdByTradeIds[tradeId] = secId;
var execMsg = new ExecutionMessage
{
ExecutionType = ExecutionTypes.Transaction,
OriginalTransactionId = transactionId,
TradeStringId = tradeId,
OriginSide = side,
TradePrice = price,
TradeVolume = volume,
PortfolioName = portfolio,
ServerTime = time,
SecurityId = secId,
HasTradeInfo = true,
};
if (permId != null)
execMsg.SetPermId(permId.Value);
if (clientId != null)
execMsg.SetClientId(clientId.Value);
if (liquidation != null)
execMsg.SetLiquidation(liquidation.Value);
if (cumulativeQuantity != null)
execMsg.SetCumulativeQuantity(cumulativeQuantity.Value);
if (averagePrice != null)
execMsg.SetAveragePrice(averagePrice.Value);
//.........这里部分代码省略.........
开发者ID:xyicheng,项目名称:StockSharp,代码行数:101,代码来源:InteractiveBrokersMessageAdapter_Transaction.cs
示例19: NeedProcess
/// <summary>
/// Нужно ли обрабатывать маркет-данные.
/// </summary>
/// <param name="dataType">Тип маркет-данных.</param>
/// <param name="securityId">Идентификатор инструмента.</param>
/// <returns>Нужно ли обрабатывать маркет-данные.</returns>
public bool NeedProcess(MarketDataTypes dataType, SecurityId securityId)
{
return _fixServer.HasSubscriptions(dataType, new SecurityId
{
SecurityCode = securityId.SecurityCode,
BoardCode = GetBoardCode(securityId.BoardCode)
});
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:14,代码来源:LuaFixServer.cs
示例20: InitSecurity
private Security InitSecurity(SecurityId securityId)
{
var id = securityId.ToStringId();
var security = _entityRegistry.Securities.ReadById(id);
if (security != null)
return security;
security = new Security
{
Id = id,
ExtensionInfo = new Dictionary<object, object>(),
Code = securityId.SecurityCode,
Board = ExchangeBoard.GetOrCreateBoard(securityId.SecurityCode),
Type = securityId.SecurityType,
};
_entityRegistry.Securities.Save(security);
_logManager.Application.AddInfoLog(LocalizedStrings.Str2871Params.Put(id));
return security;
}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:22,代码来源:ImportPane.xaml.cs
注:本文中的SecurityId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论