Ejemplo n.º 1
0
        public Sweeper_BondArb(
            BondPair pair,
            Account bondAccount)
        {
            try
            {
                this.ID = g_curID++;

                this._bStartWithSweeperMode = false;

                this.EnterCodeWithMarketType = pair.EnterCodeWithMarketType;
                this.PairCodeWithMarketType = pair.PairCodeWithMarketType;

                this.EnterPrice = pair.EnterPrice;
                this.PairPrice = pair.PairPrice;

                logger.Info("[Start BondArb Sweeper] #{0:n0}, '{1}' ({2:n0} -> {3:n0}) ({4:n0})",
                    this.ID,
                    BondUtil.GetCodeNoTail(this.EnterCodeWithMarketType),
                    this.EnterPrice,
                    this.PairPrice,
                    pair.Count);

                SweepUnitContext_Bond_Long contextLong =
                    new SweepUnitContext_Bond_Long(TradingDirection.Long, pair, bondAccount, this);

                _sweepUnitLong = new SweepUnitTemplate(contextLong, this, 5);
                _sweepUnitLong.CompleteCarefully();

                SweepUnitContext_Bond_Short contextShort =
                    new SweepUnitContext_Bond_Short(TradingDirection.Short, pair, bondAccount, this);

                _sweepUnitShort = new SweepUnitTemplate(contextShort, this, 5);
                _sweepUnitShort.CompleteCarefully();
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        void InitSweepUnit_FO(POrder o, Account accountFO)
        {
            SweepUnitContext_FO context = new SweepUnitContext_FO(
                                                                o.ReqCount,
                                                                o.Code,
                                                                o.ReqPrice,
                                                                o,
                                                                accountFO,
                                                                this);

            this.SweepUnit = new SweepUnitTemplate(context, this);
        }
Ejemplo n.º 3
0
        void SetShortUnit(Account account, RemainPositionDatum datum)
        {
            SweepUnitContext_Bond_Short contextShort =
                new SweepUnitContext_Bond_Short(TradingDirection.Short, datum, account, this);

            _sweepUnitShort = new SweepUnitTemplate(contextShort, this, 5);
            _sweepUnitShort.CompleteCarefully();
            _sweepUnitShort.StartWithRequestSweepOrdersState();
        }
Ejemplo n.º 4
0
 void SetLongUnitAsDone(Account account, RemainPositionDatum datum)
 {
     SweepUnitContext_Bond_Long_StartWithDone contextLong =
         new SweepUnitContext_Bond_Long_StartWithDone(datum, account, this);
     _sweepUnitLong = new SweepUnitTemplate(contextLong, this, 5);
     _sweepUnitLong.StartWithDone();
 }