示例#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());
            }
        }
示例#2
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();
        }