KtbSpotPosition GetLongRemainPos(KtbSpotPosition longPos, KtbSpotDonePosition done) { long remainCount = longPos.Count - done.LongPosition.Count; Trace.Assert(remainCount >= 0); KtbSpotPosition ret = new KtbSpotPosition(longPos); ret.ChangeCountAndNotional(remainCount); return ret; }
KtbSpotPosition GetShortRemainPos(KtbSpotPosition shortPos, KtbSpotDonePosition done) { long remainCount = shortPos.Count - done.ShortPosition.Count; Trace.Assert(remainCount >= 0); KtbSpotPosition ret = new KtbSpotPosition(shortPos); ret.ChangeCountAndNotional(remainCount); return ret; }
KtbSpotDonePosition GetDonePos(KtbSpotPosition longPos, KtbSpotPosition shortPos) { KtbSpotDonePosition done = new KtbSpotDonePosition(); long count = Math.Min(longPos.Count, shortPos.Count); KtbSpotPosition doneLongPos = new KtbSpotPosition(longPos); doneLongPos.ChangeCountAndNotional(count); done.LongPosition = doneLongPos; KtbSpotPosition doneShortPos = new KtbSpotPosition(shortPos); doneShortPos.ChangeCountAndNotional(count); done.ShortPosition = doneShortPos; return done; }