Exemplo n.º 1
0
 public SpotPrice(Func <SpotOrder, bool, List <SpotOrder> > FindPossibleMatch,
                  SpotOrderContainer Container,
                  SpotModel model,
                  Action <SpotOrder, SpotOrder> MakeDeal, Func <SpotOrder, bool> Redo)
     : base(FindPossibleMatch, Container, model, MakeDeal, Redo)
 {
 }
Exemplo n.º 2
0
        public SpotService(IOptionModel om)
        {
            isStop    = Com.BitsQuan.Miscellaneous.AppSettings.Read <bool>("isDisableBtcTrade", true);
            model     = new SpotModel(om);
            pre       = new SpotPre();
            post      = new SpotPost();
            Market    = new SpotMarket();
            match     = new SpotMatch(model);
            creator   = new SpotOrderCreator(model);
            KlinePool = new KlineDataPool(
                new Func <int, Contract>((i) => {
                return(new Contract {
                    Code = "-2", Name = "BTC"
                });
            }));
            KlineDataPoolInitor.InitSpot(KlinePool);
            ohlcGen = new OhlcGenarator();
            OhlcMaker.OnOhlcMaked += OhlcMaker_OnOhlcMaked;

            match.OnDeal   += match_OnDeal;
            match.OnFinish += match_OnFinish;
            foreach (var v in model.SpotOrders.ToList())
            {
                match.Match(v);
            }
            var qc = om.Coins.Where(a => a.Name.ToLower() == "btc").FirstOrDefault();

            DeepPool = new DeepDataPool3(match.Container.Get(qc));
            SetMaxId();
        }
Exemplo n.º 3
0
 public SpotArranger(Func <SpotOrder, bool, List <SpotOrder> > FindPossibleMatch,
                     SpotOrderContainer Container,
                     SpotModel model,
                     Action <SpotOrder, SpotOrder> MakeDeal, Func <SpotOrder, bool> Redo)
 {
     price     = new SpotPrice(FindPossibleMatch, Container, model, MakeDeal, Redo);
     priceOk   = new SpotPriceFok(FindPossibleMatch, Container, model, MakeDeal, Redo);
     marketFok = new SpotMarketFok(FindPossibleMatch, Container, model, MakeDeal, Redo);
     marketIoc = new SpotMarketIoc(FindPossibleMatch, Container, model, MakeDeal, Redo);
     mtp       = new SpotMIocThenPrice(FindPossibleMatch, Container, model, MakeDeal, Redo);
 }
Exemplo n.º 4
0
        public SpotMatch(SpotModel sm)
        {
            this.model = sm;
            Container  = new SpotOrderContainer((a) => {
                if (this.OnFinish != null)
                {
                    OnFinish(a);
                }
            });

            arranger = new SpotArranger(FindPossibleMatch, Container, model, MakeDeal, Redo);
        }
Exemplo n.º 5
0
 public SpotArrange(Func <SpotOrder, bool, List <SpotOrder> > FindPossibleMatch,
                    SpotOrderContainer Container,
                    SpotModel model,
                    Action <SpotOrder, SpotOrder> MakeDeal, Func <SpotOrder, bool> Redo)
 {
     this.matchLock         = new object();
     this.FindPossibleMatch = FindPossibleMatch;
     this.Container         = Container;
     this.model             = model;
     this.MakeDeal          = MakeDeal;
     this.Redo = Redo;
 }
Exemplo n.º 6
0
 public SpotOrderCreator(SpotModel sorder)
 {
     this.sm = sorder;
 }