本文整理汇总了C#中OEC.GetSecurityState方法的典型用法代码示例。如果您正苦于以下问题:C# OEC.GetSecurityState方法的具体用法?C# OEC.GetSecurityState怎么用?C# OEC.GetSecurityState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OEC
的用法示例。
在下文中一共展示了OEC.GetSecurityState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessContract
private void ProcessContract(OEC.API.Contract contract, Price currentPrice, long originalTransactionId)
{
var secId = contract.ToSecurityId();
SendOutMessage(new SecurityMessage
{
SecurityId = secId,
Name = contract.Name,
UnderlyingSecurityCode = contract.BaseSymbol,
Currency = contract.Currency.Name.ToCurrency(),
Strike = contract.Strike.ToDecimal(),
ExpiryDate = contract.HasExpiration ? contract.ExpirationDate.ApplyTimeZone(TimeHelper.Est) : (DateTimeOffset?)null,
PriceStep = contract.TickSize.ToDecimal(),
Decimals = contract.PriceFormat > 0 ? contract.PriceFormat : (int?)null,
OptionType = contract.IsOption ? (contract.Put ? OptionTypes.Put : OptionTypes.Call) : (OptionTypes?)null,
SecurityType = contract.GetSecurityType(),
OriginalTransactionId = originalTransactionId,
});
if (currentPrice == null)
return;
SendOutMessage(new Level1ChangeMessage
{
SecurityId = secId,
ServerTime = currentPrice.LastDateTime.ApplyTimeZone(TimeHelper.Est),
}
.TryAdd(Level1Fields.LastTradePrice, contract.Cast(currentPrice.LastPrice))
.TryAdd(Level1Fields.BestAskPrice, contract.Cast(currentPrice.AskPrice))
.TryAdd(Level1Fields.BestAskVolume, (decimal)currentPrice.AskVol)
.TryAdd(Level1Fields.BestBidPrice, contract.Cast(currentPrice.BidPrice))
.TryAdd(Level1Fields.BestBidVolume, (decimal)currentPrice.BidVol)
.TryAdd(Level1Fields.Change, contract.Cast(currentPrice.Change))
.TryAdd(Level1Fields.OpenInterest, (decimal)currentPrice.OpenInterest)
.TryAdd(Level1Fields.OpenPrice, contract.Cast(currentPrice.OpenPrice))
.TryAdd(Level1Fields.HighPrice, contract.Cast(currentPrice.HighPrice))
.TryAdd(Level1Fields.LowPrice, contract.Cast(currentPrice.LowPrice))
.TryAdd(Level1Fields.LastTradeVolume, (decimal)currentPrice.LastVol)
.TryAdd(Level1Fields.SettlementPrice, contract.Cast(currentPrice.Settlement))
.TryAdd(Level1Fields.Volume, (decimal)currentPrice.TotalVol)
.TryAdd(Level1Fields.StepPrice, (decimal)contract.ContractSize)
.Add(Level1Fields.State, contract.GetSecurityState()));
}
示例2: ProcessContract
private void ProcessContract(OEC.API.Contract contract, Price currentPrice, long originalTransactionId)
{
ProcessContract(contract, originalTransactionId);
if (currentPrice == null)
return;
SendOutMessage(new Level1ChangeMessage
{
SecurityId = contract.ToSecurityId(),
ServerTime = currentPrice.LastDateTime.ApplyTimeZone(TimeHelper.Est),
}
.TryAdd(Level1Fields.LastTradePrice, contract.Cast(currentPrice.LastPrice))
.TryAdd(Level1Fields.BestAskPrice, contract.Cast(currentPrice.AskPrice))
.TryAdd(Level1Fields.BestAskVolume, (decimal)currentPrice.AskVol)
.TryAdd(Level1Fields.BestBidPrice, contract.Cast(currentPrice.BidPrice))
.TryAdd(Level1Fields.BestBidVolume, (decimal)currentPrice.BidVol)
.TryAdd(Level1Fields.Change, contract.Cast(currentPrice.Change))
.TryAdd(Level1Fields.OpenInterest, (decimal)currentPrice.OpenInterest)
.TryAdd(Level1Fields.OpenPrice, contract.Cast(currentPrice.OpenPrice))
.TryAdd(Level1Fields.HighPrice, contract.Cast(currentPrice.HighPrice))
.TryAdd(Level1Fields.LowPrice, contract.Cast(currentPrice.LowPrice))
.TryAdd(Level1Fields.LastTradeVolume, (decimal)currentPrice.LastVol)
.TryAdd(Level1Fields.SettlementPrice, contract.Cast(currentPrice.Settlement))
.TryAdd(Level1Fields.Volume, (decimal)currentPrice.TotalVol)
.TryAdd(Level1Fields.StepPrice, (decimal)contract.ContractSize)
.Add(Level1Fields.State, contract.GetSecurityState()));
}