本文整理汇总了C#中OEC.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OEC.ToString方法的具体用法?C# OEC.ToString怎么用?C# OEC.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OEC
的用法示例。
在下文中一共展示了OEC.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: oecClient_OnPriceChanged
void oecClient_OnPriceChanged(OEC.API.Contract Contract, OEC.API.Price Price)
{
Symbol symbol = GetSymbolFromContract(Contract);
if (symbol != null)
{
Trace.WriteLine(Contract.ToString() + " Price (" + symbol.ToString() + ")");
SymbolPrice symbolPrice = null;
if (!_symbolPrices.TryGetValue(symbol, out symbolPrice))
{
symbolPrice = new SymbolPrice();
symbolPrice.symbol = symbol;
symbolPrice.TotalVol = Price.TotalVol;
_symbolPrices[symbol] = symbolPrice;
}
TickData data;
if (symbolPrice.AskPrice != Price.AskPrice || symbolPrice.AskSize != Price.AskVol)
{
symbolPrice.AskPrice = Price.AskPrice;
symbolPrice.AskSize = Price.AskVol;
data = new TickData();
data.time = Price.LastDateTime;
data.tickType = TickType.Ask;
data.price = Price.AskPrice;
data.size = (UInt64)Price.AskVol;
if (tickListener != null)
{
tickListener(symbol, data);
}
}
if (symbolPrice.BidPrice != Price.BidPrice || symbolPrice.BidSize != Price.BidVol)
{
symbolPrice.BidPrice = Price.BidPrice;
symbolPrice.BidSize = Price.BidVol;
data = new TickData();
data.time = Price.LastDateTime;
data.tickType = TickType.Bid;
data.price = Price.BidPrice;
data.size = (UInt64)Price.BidVol;
if (tickListener != null)
{
tickListener(symbol, data);
}
}
if (symbolPrice.TotalVol != Price.TotalVol || symbolPrice.LastPrice != Price.LastPrice)
{
data = new TickData();
data.time = Price.LastDateTime;
data.tickType = TickType.Trade;
data.price = Price.LastPrice;
if (symbolPrice.TotalVol > Price.TotalVol)
{
data.size = 0;
}
else
{
data.size = (UInt64)(Price.TotalVol - symbolPrice.TotalVol);
}
symbolPrice.LastPrice = Price.LastPrice;
symbolPrice.TotalVol = Price.TotalVol;
if (tickListener != null)
{
tickListener(symbol, data);
}
}
//data = new TickData();
//data.time = DateTime.Now;
//data.tickType = TickType.LastSize;
//data.value = Price.LastVol;
//if (tickListener != null)
//{
// tickListener(symbol, data);
//}
if (symbolPrice.LowPrice != Price.LowPrice)
{
symbolPrice.LowPrice = Price.LowPrice;
data = new TickData();
data.time = Price.LastDateTime;
data.tickType = TickType.LowPrice;
data.price = Price.LowPrice;
if (tickListener != null)
{
tickListener(symbol, data);
}
//.........这里部分代码省略.........
示例2: oecClient_OnLoginFailed
void oecClient_OnLoginFailed(OEC.Data.FailReason Reason)
{
string error = "Login Failed: " + Reason.ToString();
lastError = error;
hadError = true;
connectCompleted = true;
connected = false;
//DisplayError(Reason.ToString());
}
示例3: GetLocalOrder
public BusinessEntities.Order GetLocalOrder(OEC.API.Version version, bool create = true)
{
if (_versionOrderSet.ContainsKey(version))
return _versionOrderSet[version];
_connector.AddWarningLog("GetLocalOrder({0}): заявка не найдена", version.ToString());
if (!create || version.ID <= 0)
return null;
try
{
var portfolio = _connector.FindPortfolioByAccount(version.Order.Account, null);
var security = _connector.FindSecurityByContract(version.Order.Contract);
var vercopy = version;
var orderType = version.Type.ToStockSharp();
var order = _connector.GetOrder(security, orderType, version.ID, id =>
{
var ord = _connector.EntityFactory.CreateOrder(security, orderType, vercopy.ID);
ord.Id = id;
// TODO
//_connector.InitNewOrder(ord);
return ord;
}, ord =>
{
ord.Portfolio = portfolio;
ord.Security = security;
ord.CopyFromOECOrderVersion(vercopy);
return true;
});
BindOrderToOecOrderVersion(order, version);
return order;
}
catch (Exception ex)
{
var msg = "Ошибка создания заявки S# по OEC версии '{0}': {1}".Put(version.ToString(), ex);
_connector.AddWarningLog(msg);
_connector.TransactionAdapter.SendOutMessage(new ErrorMessage { Error = ex });
return null;
}
}