本文整理汇总了C#中Market.Date方法的典型用法代码示例。如果您正苦于以下问题:C# Market.Date方法的具体用法?C# Market.Date怎么用?C# Market.Date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Market
的用法示例。
在下文中一共展示了Market.Date方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Export
public override IDictionary<long, Dictionary<string, string>> Export(IList<Trade> inTrades, Filter inFilter, Stream stream, Market market, IList<Exception> exceps)
{
var task = _task;
var filter = task.Filter;
var date = market.Date(_effectiveTime);
var trades = Env.Current.Trade.GetTrades2(filter, date, _effectiveTime);
using (var writer = new StreamWriter(stream))
{
WriteHeader(writer);
foreach (var trade in trades)
{
if (trade.Product == null)
{
exceps.Add(new ApplicationException(String.Format("Trade {0} is invalid. Missing product.", trade.Id)));
continue;
}
if(trade.TradeTime > _effectiveTime)
{
continue;
}
string line = WriteTrade(trade, date, _effectiveTime, exceps);
if (!Utilities.IsNullOrEmpty(line))
{
writer.WriteLine(line);
}
}
}
return null;
}
示例2: LoadTradingPositions
static protected IList<Position> LoadTradingPositions(Filter filter, Market market, DateTime valuationTime, SimpleDate fromDate, SimpleDate toDate)
{
var builder = new PositionBuilder { PositionFilter = filter };
builder.AcceptCurrencySecurity = true;
builder.IncludeOtc = true;
builder.ExcludeNonLive = true;
builder.FromDate = fromDate;
builder.ToDate = toDate;
var asOfDate = market.Date(valuationTime);
return builder.Build(new SimpleDate(asOfDate));
}
示例3: using
/*public override IDictionary<long, Dictionary<string, string>> Export(IList<Trade> inTrades, Filter inFilter, Stream stream, Market market, IList<Exception> exceps)
{
var task = _task;
var filter = task.Filter;
var date = market.Date(_effectiveTime);
//consider parameterizing
var excludeMatured = false;
var includeCash = false;
var posBySettleDate = false;
var includeCcyPair = false;
var posFilter = (Filter)filter.Clone();
posFilter.ExcludeNonMultiplyTraded = false;
posFilter.ExcludeMultiplyTraded = false;
posFilter.ExcludeNonLiveTrades = excludeMatured;
using (var writer = new StreamWriter(stream))
{
WriteHeader(writer);
var trades = Env.Current.Trade.GetTrades2(filter, date, _effectiveTime);
foreach (var trade in trades)
{
if (trade.Product == null)
{
exceps.Add(new ApplicationException(String.Format("Trade {0} is invalid. Missing product.", trade.Id)));
continue;
}
if (trade.TradeTime > _effectiveTime)
{
continue;
}
string line = WriteTrade(trade, date, _effectiveTime, exceps, false);
if (!Utilities.IsNullOrEmpty(line))
{
writer.WriteLine(line);
}
}
var positions2 = Env.Current.Trade.LoadPaymentPositions(filter, date, date);
var positions = Env.Current.Trade.LoadMostRecentNewPositions(posFilter, date);
foreach (var pos in positions)
{
if (!includeCash && pos.Product is CurrencySecurity)
{
continue;
}
bool isCashPos = pos.Product is CurrencySecurity;
bool isCurrencyPair = pos.Product is CurrencyPair;
if (excludeMatured)
{
if (isCurrencyPair)
{
if (Utilities.IsZero(pos.TotalSettled.Quantity) && Utilities.IsZero(pos.TotalSettled.Amount)) continue;
}
else
{
if (isCashPos && Utilities.IsZero(pos.TotalSettled.Quantity)) continue;
if (posBySettleDate)
{
if (!isCashPos && Utilities.IsZero(pos.TotalSettled.Quantity)) continue;
}
else if (!isCashPos && Utilities.IsZero(pos.TotalTraded.Quantity)) continue;
}
}
//if (excludeMatured && pos.TotalTraded.Quantity == 0) continue;
if (!includeCcyPair && pos.Product is CurrencyPair) continue;
var trade = posBySettleDate ? pos.ToSettledTrade() : pos.ToTradedTrade();
trade.Id = pos.PositionId;
string line = WriteTrade(trade, date, _effectiveTime, exceps, false);
if (!Utilities.IsNullOrEmpty(line))
{
writer.WriteLine(line);
}
}
}
return null;
}*/
public override IDictionary<long, Dictionary<string, string>> Export(IList<Trade> inTrades, Filter inFilter, Stream stream, Market market, IList<Exception> exceps)
{
var task = _task;
var filter = task.Filter;
var date = market.Date(_effectiveTime);
var trades = Analysis.LoadTradeAndPositions(filter, _effectiveTime, market, true);
using (var writer = new StreamWriter(stream))
{
WriteHeader(writer);
foreach (var trade in trades)
{
if (trade.Product == null)
{
exceps.Add(new ApplicationException(String.Format("Trade {0} is invalid. Missing product.", trade.Id)));
continue;
}
if (trade.Product is CurrencySecurity) continue;
//.........这里部分代码省略.........