• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Market类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Market的典型用法代码示例。如果您正苦于以下问题:C# Market类的具体用法?C# Market怎么用?C# Market使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Market类属于命名空间,在下文中一共展示了Market类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ShouldExecuteInstructionWhenThereIsEnoughLiquidityOnOneMarket

        public void ShouldExecuteInstructionWhenThereIsEnoughLiquidityOnOneMarket()
        {
            // Given market A: 150 @ $100, market B: 55 @ $101 
            // When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price
            var marketA = new Market
            {
                                  SellQuantity = 150,
                                  SellPrice = 100M
                              };
            
            var marketB = new Market
            {
                                  SellQuantity = 55,
                                  SellPrice = 101M
                              };

            var marketsInvolved = new[] { marketA, marketB };

            ICanRouteOrders canRouteOrders = null;//new OrderRoutingService(marketsInvolved);
            ICanReceiveMarketData canReceiveMarketData = new MarketDataProvider(marketsInvolved);
            IProvideMarkets provideMarkets = new MarketProvider(marketsInvolved);
            var sor = new SmartOrderRoutingEngine(provideMarkets, canRouteOrders, canReceiveMarketData);

            var investorInstructionDto = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M);

            OrderExecutedEventArgs orderExecutedEventArgs = null;
            sor.Subscribe(investorInstructionDto.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, null);
                //investorInstruction.Executed += (sender, args) => { orderExecutedEventArgs = args; };
            
            // orderRequest.Route(); ?
            sor.Route(investorInstructionDto);

            // TODO :introduce autoreset event instead
            Check.That(orderExecutedEventArgs).HasFieldsWithSameValues(new { Way = Way.Buy, Quantity = 125, Price = 100M });
        }
开发者ID:ctguxp,项目名称:SimpleOrderRouting,代码行数:35,代码来源:SorAcceptanceTests.cs


示例2: Save

		public static int Save(Market m)
		{
			var ctx = new AutoNewsEntities();
			if (m.Id == 0)
			{
				if (ctx.Markets.Count(o => (o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) > 0)
				{
					throw new Exception("名称或CRM ID已存在!");
				}
				ctx.Markets.Add(m);
				return 1;
			}
			
			//id != 0
            if (ctx.Markets.Count(o => ((o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) && o.Id != m.Id) > 0)
			{
				throw new Exception("名称或CRM ID已存在!");
			}
			var market = ctx.Markets.Single(o => o.Id == m.Id);
			market.Auto = m.Auto;
			market.EndTime = m.EndTime;
			market.MarketCrmId = m.MarketCrmId;
			market.Name = m.Name;
			market.StartTime = m.StartTime;
			ctx.SaveChanges();
			return 2;
		}
开发者ID:jesusblessf6,项目名称:AutoPrice,代码行数:27,代码来源:MarketHelper.cs


示例3: MockTradeFinderFactory

 public MockTradeFinderFactory(Map map, Market market, string logFilePath, Parameters parameters) : base("")
 {
     this.map = map;
     this.market = market;
     this.logFilePath = logFilePath;
     this.parameters = parameters;
 }
开发者ID:spiffydudex,项目名称:navbot,代码行数:7,代码来源:MockTradeFinderFactory.cs


示例4: resetReferencesForNewLevel

    public static void resetReferencesForNewLevel()
    {
        // Managers
        manager = GameObject.FindGameObjectWithTag("Manager");
        stateManager = manager.GetComponent<StateManager>();
        stateTiming = manager.GetComponent<StateTiming>();

        // Game stats and information
        gameStats = manager.GetComponent<GameStats>();
        itemDatabase = manager.GetComponent<Item_Database>();
        inventory = manager.GetComponent<Inventory>();
        market = manager.GetComponent<Market>();
        marketArrays = manager.GetComponent<MarketArrays>();
        soundEffects = GameObject.FindObjectOfType<SoundEffectsDatabase>().GetComponent<SoundEffectsDatabase>();

        // Cameras
        realtimeCamera = GameObject.FindGameObjectWithTag("Camera_Realtime").GetComponent<Camera>();
        strategicCamera = GameObject.FindGameObjectWithTag("Camera_Strategic").GetComponent<Camera>();

        // Game entities
        player = GameObject.FindGameObjectWithTag("Player");
        castle = GameObject.FindGameObjectWithTag("Castle");
        soundEffect = (GameObject)Resources.Load("OneTimeSoundEffect", typeof(GameObject));

        // Data
        lastLevelIndex = Application.loadedLevel;
        currentLevel = 1;
    }
开发者ID:B-LiTE,项目名称:MemeTeam,代码行数:28,代码来源:References.cs


示例5: 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


示例6: ShouldFaileWhenOrderExceedsAllMarketCapacityAndPartialExecutionNotAllowed

        public void ShouldFaileWhenOrderExceedsAllMarketCapacityAndPartialExecutionNotAllowed()
        {
            // Given market A: 150 @ $100, market B: 55 @ $101 
            // When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price
            var marketA = new Market
            {
                                  SellQuantity = 15,
                                  SellPrice = 100M
                              };
            
            var marketB = new Market
            {
                                  SellQuantity = 55,
                                  SellPrice = 101M
                              };

            var sor = CreateSmartOrderRoutingEngine(new[] { marketA, marketB });

            var investorInstruction = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M, allowPartialExecution: false);

            // Subscribes to the instruction's events
            OrderExecutedEventArgs orderExecutedEventArgs = null;
            string failureReason = null;

            sor.Subscribe(investorInstruction.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, (args) => { failureReason = args; });

            // orderRequest.Route(); ?
            sor.Route(investorInstruction);

            // Couldn't execute because order with excessive quantity
            Check.That(failureReason).IsNotNull().And.IsEqualIgnoringCase("Excessive quantity!");
            Check.That(orderExecutedEventArgs).IsNull();
        }
开发者ID:ctguxp,项目名称:SimpleOrderRouting,代码行数:33,代码来源:SorAcceptanceTests.cs


示例7: Start

    // Use this for initialization
    void Start()
    {
        animator = GetComponent<Animator>();

        //mainGame = GameLogicGameObject.GetComponent<WeedGame>();
        market = GameLogicGameObject.GetComponent<Market>();
    }
开发者ID:LouieBloo,项目名称:ClickGameRepoGod,代码行数:8,代码来源:MainLeaf.cs


示例8: HandleLines

 static bool HandleLines(IList<string> lines, Market market, char[] seps, StringBuilder sb)
 {
     //Read First Line to fin Vol Surface and if its Rho or Nu
     bool isRho = true;
     InterestVolatility vol = null;
     var firstLine = lines.FirstOrDefault();
     if (string.IsNullOrEmpty(firstLine))
     {
         sb.Append("Cannot parse first line");
         return false;
     }
     var ss = firstLine.Split(seps);
     var sdate = ss[2];
     var stype = ss[3];
     var ticker = ss[4];
     var date = SimpleDate.Parse(sdate);
     isRho = stype.ToUpper().Contains("RHO");
      var isBeta = stype.ToUpper().Contains("BETA");
     ss = ticker.Split('.');
     var name = ss[0];
     var ccy = ss[1];
     var time = date.ToDateTime(23, 59, 59);
     market.Time = time;
     market.ClearMarketDatas();
     var vols = market.GetAll(true, false, false, true, false, false, false, false, false, false, false, false, false);
     foreach (var im in vols)
     {
         var ivol = im as InterestVolatility;
         if (ivol != null && ivol.Currency.Equals(ccy))
         {
             vol = ivol;
             break;
         }
     }
     if (vol == null)
     {
         sb.Append("Cannot Find Any Vol for " + ticker);
         return false;
     }
     var output = vol.Output as InterestVolatilityOutput;
     if (output == null)
     {
         sb.Append("Invalid Vol not built " + vol);
         return false;
     }
     var data = new List<SabrData>();
     foreach (var line in lines)
     {
         var d = new SabrData();
         ss = line.Split(seps);
         var tick = ss[4];
         d.Date = SimpleDate.Parse(ss[2]).ToDateTime();
         d.ComponentTicker = tick;
         d.InstrumentType = ss[3];
         d.Value = Convert.ToDouble(ss[5]);
         data.Add(d);
     }
     return HandleData(vol, isRho, isBeta, data, market, sb);
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:59,代码来源:SabrImporter.cs


示例9: AddTopMarket

 public Market AddTopMarket(int marketId)
 {
     var market = new Market() {
         Id = marketId
     };
     
     return _marketDataStore.TopMarketSave(market);
 }
开发者ID:digimonsta,项目名称:FeatureDemandPlanning,代码行数:8,代码来源:MarketDataContext.cs


示例10: Value

 public object Value(string columnName, Market market, PLItem item, PLReport report)
 {
     if (mColumns.ContainsKey(columnName))
     {
         return mColumns[columnName].Value(market, item, report);
     }
     return null;
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:8,代码来源:SymmetryPlPlugin.cs


示例11: Value

 public object Value(Market market, PLEntry entry, PlBlotter blotter)
 {
     if (entry != null)
     {
         return entry.EndNominal - entry.StartNominal;
     }
     return null;
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:8,代码来源:DayTradePlColumn.cs


示例12: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     itemDatabase = TestObjectFactory.CreateItemDatabase();
     map = TestObjectFactory.CreateMap();
     market = TestObjectFactory.CreateMarket(itemDatabase, map);
     kernite = itemDatabase.GetItemType("Kernite");
     navitas = itemDatabase.GetItemType("Navitas");
 }
开发者ID:spiffydudex,项目名称:navbot,代码行数:8,代码来源:MarketTest.cs


示例13: Value

 public object Value(Market market, PLEntry entry, PlBlotter blotter)
 {
     if(entry != null && entry.Trade != null && entry.Trade.InitialPartyId != 0)
     {
         var party = Env.Current.StaticData.GetPartyById(entry.Trade.InitialPartyId);
         return party.Code;
     }
     return null;
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:9,代码来源:ExecutingPartyPlColumn.cs


示例14: MarketOrderShouldDecreaseAvailableQuantity

        public void MarketOrderShouldDecreaseAvailableQuantity()
        {
            var market = new Market { SellPrice = 100M, SellQuantity = 50 };

            var order = market.CreateMarketOrder(Way.Buy, quantity: 10);
            market.Send(order);

            Check.That(market.SellQuantity).IsEqualTo(40);
        }
开发者ID:ctguxp,项目名称:SimpleOrderRouting,代码行数:9,代码来源:MarketTests.cs


示例15: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     testLogPath = TestObjectFactory.TestDirectory + "Logs";
     testNoLogPath = TestObjectFactory.TestDirectory + "NoLogs";
     archiveBasePath = TestObjectFactory.TestDirectory + "Logs" + "\\Temp";
     map = TestObjectFactory.CreateMap();
     database = TestObjectFactory.CreateItemDatabase();
     market = TestObjectFactory.CreateMarket(database, map);
     parameters = new Parameters(1000.0f, 100.0f, "Sol", TripType.SingleTrip);
 }
开发者ID:spiffydudex,项目名称:navbot,代码行数:10,代码来源:TradeFinderFactoryTest.cs


示例16: RequestAccess

        public RequestAccess( Market market, Product product, RequestStatus status, ControllerStatus cstatus, string description, int submittedByID)
        {
            this.Status = status;
            this.ControllerStatus = cstatus;
            this.Description = description;
            this.SubmittedByUserId = submittedByID;

            this.MarketAccess = market;
            this.ProductAccess = product;
        }
开发者ID:pistr119,项目名称:MSSE682,代码行数:10,代码来源:RequestAccess.cs


示例17: IsExcluded

 public override bool IsExcluded(ProductEvent pevent, Trade trade, Market market)
 {
     var isExcluded = base.IsExcluded(pevent, trade, market);
     if (isExcluded) return true;
     if (trade.Product is Swap)
     {
         var swap = trade.Product as Swap;
         if (swap.PayLeg.IsFixedRate && swap.ReceiveLeg.IsFixedRate) return true;
     }
     return false;
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:11,代码来源:SymmetrySEFIrsTradeImportExport.cs


示例18: LimitOrderShouldCaptureExec

        public void LimitOrderShouldCaptureExec()
        {
            var market = new Market { SellPrice = 100M, SellQuantity = 50 };
            var executed = false;
            var order = market.CreateLimitOrder(Way.Buy, price: 100M, quantity: 10, allowPartialExecution: false);

            market.OrderExecuted += (s, a) => executed = true;
            market.Send(order);

            Check.That(executed).IsTrue();
            Check.That(market.SellQuantity).IsEqualTo(40);
        }
开发者ID:ctguxp,项目名称:SimpleOrderRouting,代码行数:12,代码来源:MarketTests.cs


示例19: Ukraine

 public Ukraine(Market m = Market.USE )
 {
     // all calendar instances on the same market share the same implementation instance
      switch ( m )
      {
     case Market.USE:
        calendar_ = Impl.Singleton;
        break;
     default:
        throw new ApplicationException( "unknown market" );
      }
 }
开发者ID:akasolace,项目名称:qlnet,代码行数:12,代码来源:Ukraine.cs


示例20: Value

 public object Value(Market market, PLEntry entry, PlBlotter blotter)
 {
     if (entry != null && entry.Trade != null)
     {
         var swaption = entry.Trade.Product as Swaption;
         if (swaption != null && swaption.Swap != null)
         {
             return swaption.Swap.EndDate;
         }
     }
     return null;
 }
开发者ID:heimanhon,项目名称:researchwork,代码行数:12,代码来源:SwapMaturityPlColumn.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MarkovDiscreteFunction类代码示例发布时间:2022-05-24
下一篇:
C# MarkerType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap