Esempio n. 1
0
        void WriteDoneBody(KtbSpotDonePosition done, CsvFileWriter writer)
        {
            CsvRow row = new CsvRow();
            row.Add("" + done.ShortPosition.Long_2_Short_1);
            row.Add("" + done.ShortPosition.Count);
            row.Add(done.ShortPosition.Rate.ToString("n5"));
            row.Add("" + done.ShortPosition.Price);
            row.Add("" + done.ShortPosition.Notional);
            row.Add("" + done.LongPosition.TradingDate.ToString("yyyyMMdd"));
            row.Add("" + done.LongPosition.Price);

            writer.WriteRow(row);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }