当前位置: 首页>>代码示例>>C#>>正文


C# Market.Date方法代码示例

本文整理汇总了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;
        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:31,代码来源:SymmetryMLPSnapshot.cs

示例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));
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:11,代码来源:GrossNotionalTimeSeries.cs

示例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;
//.........这里部分代码省略.........
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:SymmetryMLPSnapshot.cs


注:本文中的Market.Date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。