Ejemplo n.º 1
0
        void AddUpDummyOptions(ArrayList elwRemains, ArrayList optionRemains)
        {
            DateTime maturity = Util.GetSystemOptionMaturity();

            foreach (ElwRemain er in elwRemains)
            {
                KospiOptionInfo koi = OptionUtil.GetKOI(er.Elw.Strike, er.Elw.CallPut, maturity);

                Boolean bContain = false;

                foreach (OptionRemain or in optionRemains)
                {
                    if (or.Koi.CallPut == koi.CallPut && or.Koi.Strike == koi.Strike)
                    {
                        bContain = true;
                        break;
                    }
                }

                if (!bContain)
                {
                    OptionRemain or = new OptionRemain();
                    or.Koi = koi;
                    or.Count = 0;

                    optionRemains.Add(or);
                }
            }
        }
Ejemplo n.º 2
0
        void PrintOutExposure_Raw(OptionRemain or, ArrayList elwRemains, ref String output)
        {
            long optionCount100k = ElwOptionUtil.ConvertOptionCountTo100k(or.Count);

            double strike = or.Koi.Strike;
            CallPutFlag cp = or.Koi.CallPut;

            long elwsCount100k = 0;

            ArrayList candidates = new ArrayList();
            candidates.Add(or.Koi.Code);

            foreach (ElwRemain er in elwRemains)
            {
                if (er.Elw.CallPut == cp && er.Elw.Strike == strike)
                {
                    elwsCount100k += ElwOptionUtil.ConvertElwCountTo100k(er.Elw, er.Count);
                    candidates.Add(er.Elw.Code);
                }
            }

            long diff100k = optionCount100k + elwsCount100k;

            if (diff100k == 0)
            {
                return;
            }

            output += String.Format("[{0} {1}]의 익스포저 Diff100k = {2}\r\n", or.Koi.CallPut, or.Koi.Strike, diff100k);

            foreach (String candidate in candidates)
            {
                output += String.Format("\t[{0}] = {1}\r\n", candidate, ElwOptionUtil.Convert100KToRealCount(candidate, diff100k));
            }
        }
Ejemplo n.º 3
0
        ArrayList GetOptionRemains()
        {
            ArrayList arr = new ArrayList();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells == null || row.Cells[0] == null)
                {
                    continue;
                }
                String code = Convert.ToString(row.Cells[0].Value);
                long count = Convert.ToInt64(row.Cells[1].Value);

                if (code.Length == 0)
                {
                    continue;
                }

                KospiOptionInfo koi = OptionUtil.GetKOI(code);

                if (koi == null)
                {
                    logger.Warn(String.Format("{0} is not option code", code));
                    continue;
                }

                OptionRemain or = new OptionRemain();
                or.Count = count;
                or.Koi = koi;

                arr.Add(or);
            }
            return arr;
        }