Exemplo n.º 1
0
        public MatchService()
        {
            preHandler  = new OrderPreHandler();
            postHandler = new OrderPostHandler();
            Model       = new OptionModel();
            Model.Init();

            esi    = new EntitySvcImp(Model);
            market = new Market(Model);

            Matcher = new OrderMatcher(market);
            Matcher.OnAfterMatch += RaiseAfterMatch;

            foreach (var v in Model.LegacyOrders)
            {
                market.Handle(v);
            }

            preHandler.Market = market;
            Monitor           = new OrderMonitor(Matcher, market, Model);

            monitorHandler = new OrderMonitorHandler(Monitor, (a, b) => { if (OnUserMsge != null)
                                                                          {
                                                                              OnUserMsge(a, b);
                                                                          }
                                                     });


            sysShare = new SysShare(Model.Traders);

            ks = new KlineSvc(this.Model);
            Matcher.OnFinish          += matcher_OnFinish;
            Matcher.OnPositionChanged += matcher_OnPositionChanged;
            Matcher.OnPartialFinish   += matcher_OnPartialFinish;
            Matcher.OnDeal            += Matcher_OnDeal;


            foreach (var v in Model.Traders)
            {
                v.ReraiseBailEvent();
                v.InitBailEvent();
            }

            Model.Traders.First().SetMarket(market);

            DeepPool = new DeepDataPool2(Model, Matcher.Container);
            //恢复最近的成交
            foreach (var v in Model.LatestDeals)
            {
                market.Deals.Handle(v);
            }
            Model.LatestDeals.Clear();
            processor = new OrderSvcImp(this.Model, this.preHandler,
                                        this.postHandler, this.Matcher, log, IsAcceptByFuse);
            ks.Init();
            PosSvc = new PositionSvcImp(this.market);
        }
Exemplo n.º 2
0
 public OrderSvcImp(IOptionModel Model,
                    OrderPreHandler preHandler,
                    OrderPostHandler postHandler,
                    OrderMatcher Matcher,
                    TextLog log,
                    Func <Order, bool> IsAcceptByFuse)
 {
     this.Model   = Model; this.preHandler = preHandler; this.postHandler = postHandler;
     this.Matcher = Matcher; this.log = log; this.IsAcceptByFuse = IsAcceptByFuse;
 }