public SweepUnitContext_Bond_Short( TradingDirection ls, RemainPositionDatum datum, Account bondAccount, ISweeper sweeper) { this.ID = SweepUnitIDManager.NextID++; this.LongShort = ls; Trace.Assert(this.LongShort == TradingDirection.Short); // -15 this.CurSignedTargetCount = datum.CurTargetCount * (-1); this.EnterCode = datum.EnterCodeWithMarketType; this.PairCode = datum.PairCodeWithMarketType; this._initSweepPrice = datum.PairPrice; this.BondAccount = bondAccount; this._enterMarketType = BondUtil.GetMarketType(datum.EnterCodeWithMarketType); this._pairMarketType = BondUtil.GetMarketType(datum.PairCodeWithMarketType); this._sweeper = sweeper; this.RealOrdersShort = new List<POrder>(); }
public SweepUnitContext_Bond_Long_StartWithDone( RemainPositionDatum datum, Account bondAccount, ISweeper sweeper) { this.ID = SweepUnitIDManager.NextID++; this.LongShort = TradingDirection.Long; this.InitSignedGoalCount = datum.CurTargetCount; this.CurSignedTargetCount = datum.CurTargetCount; this.EnterCode = datum.EnterCodeWithMarketType; this._initEnterPrice = datum.EnterPrice; this.BondAccount = bondAccount; this._enterMarketType = BondUtil.GetMarketType(this.EnterCode); this._sweeper = sweeper; this._signedContractedCount = datum.CurTargetCount; this._signedBookValue = (long)(datum.EnterPrice * datum.CurTargetCount); }
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(); }
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(); }
public void SetAsSweeperMode(Account account, RemainPositionDatum datum) { if (this._bStartWithSweeperMode) { SetLongUnitAsDone(account, datum); SetShortUnit(account, datum); this.EnterCodeWithMarketType = datum.EnterCodeWithMarketType; this.PairCodeWithMarketType = datum.PairCodeWithMarketType; this.EnterPrice = datum.EnterPrice; this.PairPrice = datum.PairPrice; } else { Trace.Assert(false); } }
public RemainPositionDatum GetRemainBondArbPositionDatum() { RemainPositionDatum remainDatum = new RemainPositionDatum(); remainDatum.EnterCodeWithMarketType = this.EnterCodeWithMarketType; remainDatum.PairCodeWithMarketType = this.PairCodeWithMarketType; remainDatum.EnterPrice = this.EnterPrice; remainDatum.PairPrice = this.PairPrice; remainDatum.CurTargetCount = this._sweepUnitLong.GetSignedContractedCount() + this._sweepUnitShort.GetSignedContractedCount(); return remainDatum; }