public void AddPOrderAsCC_WithChangeSign(POrder o)
        {
            CodeCount cc = new CodeCount();
            cc.Code = o.Code;
            cc.Count = o.GetSignedContractedCount() * (-1);

            _ccs.Add(cc);
        }
        // 총 exposure를 구한다.
        public CodeCount GetExposureCC100k()
        {
            long exposure100k = 0;
            foreach (CodeCount cc in _ccs)
            {
                long tmp = ElwOptionUtil.ConvertRealToCount100k(cc.Code, cc.Count);
                exposure100k += tmp;
            }
            CodeCount ccRet = new CodeCount();
            ccRet.Code = KOI.Code;
            ccRet.Count = exposure100k;

            return ccRet;
        }
        public void Add(CodeCount cc)
        {
            String key = ElwOptionUtil.GetKOIKey(cc.Code);

            if (!_dicCall.ContainsKey(key) && !_dicPut.ContainsKey(key))
            {
                logger.Warn(String.Format("EOPD._dic.key({0}) does not exist", key));
                return;
            }

            if (_dicCall.ContainsKey(key))
            {
                SameStrikeInstrument ssi = _dicCall[key];
                ssi.AddCC(cc);
            }
            else
            {
                SameStrikeInstrument ssi = _dicPut[key];
                ssi.AddCC(cc);
            }
        }
        ArrayList GetOptions()
        {
            ArrayList arr = new ArrayList();
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.IsNewRow) continue;

                CodeCount cc = new CodeCount();
                cc.Code = row.Cells[0].Value as String;
                cc.Count = Convert.ToInt64(Util.RemoveComma(row.Cells[1].Value.ToString()));

                arr.Add(cc);
            }

            foreach (DataGridViewRow row in dataGridView4.Rows)
            {
                if (row.IsNewRow) continue;

                String code = row.Cells[0].Value as String;

                if (code.StartsWith("J"))
                {
                    continue;
                }

                CodeCount cc = new CodeCount();

                cc.Code = code;
                cc.Count = Convert.ToInt64(Util.RemoveComma(row.Cells[1].Value.ToString()));

                arr.Add(cc);
            }

            return arr;
        }
        void FillElwRemains(String packet)
        {
            StringPacket sp = new StringPacket(packet + ":", ":");
            String key = sp.Decode();

            if (key.CompareTo("종목번호") == 0)
            {
                long index = sp.DecodeLong();
                String code = sp.Decode();

                CodeCount cc = new CodeCount();
                cc.Code = code;

                _elwRemains.Add(index, cc);
            }
            else if (key.CompareTo("금일보유수량") == 0)
            {
                long index = sp.DecodeLong();
                long count = sp.DecodeLong();
                _elwRemains[index].Count = count;
            }
        }
 public void AddCC(CodeCount cc)
 {
     _ccs.Add(cc);
 }
        void AddUpJournalingPosition(List<POrder> options, List<POrder> elws)
        {
            String fileName = String.Format("{0}_{1}.txt", _optionAccount.AccountName, _elwAccount.AccountName);
            FileStream fs = null;
            StreamReader sr = null;

            try
            {
                fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
                sr = new StreamReader(fs);

                while (!sr.EndOfStream)
                {
                    String line = sr.ReadLine();

                    String code = line.Substring(0, line.IndexOf(",")).Trim();
                    long count = Convert.ToInt64(Util.RemoveComma(line.Substring(line.IndexOf(",") + 1).Trim()));

                    CodeCount cc = new CodeCount();
                    cc.Code = code;
                    cc.Count = count;

                    _dic.Add(cc);
                }
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }

                if (fs != null)
                {
                    fs.Close();
                }
            }
        }