Beispiel #1
0
        // 15 자리
        public static string getNewTradeID(TradeInfo.TradeType tradeType,
                                            Financial_instrument.InstrumentType instType,
                                            DateTime tradeDate)
        {
            string id = "";

            // (1)
            id += "T";

            // 세부코드(13) : date (6) , fp_master_type (3) , trade order (4)

            // date (6)
            id += tradeDate.ToString("yyyyMMdd").Substring(2, 6);

            // type (3) 
            if (tradeType == TradeInfo.TradeType.KRX) { id += "100"; }
            else if (tradeType == TradeInfo.TradeType.Clearing) { id += "S01"; }
            else if (tradeType == TradeInfo.TradeType.OTC) { id += "S02"; }
            else if (tradeType == TradeInfo.TradeType.Dynamic_Hedge) { id += "302"; }
            else { id += "Z99"; }

            // order (4)

            int max = IDGenerator.getTradeSeq(tradeDate);

            id += getLetter((max + 1), 4);

            // 에러코드(1)
            id += "9";

            return id;

            
        }
        private void DLL_Interfacer(Financial_instrument financial_instrument)
        {
            // do interface
            //financial_instrument.LastValue_ = 0.9;


        }
Beispiel #3
0
        public void addFinancialMaster(Financial_instrument fi,DateTime BookingDate, string book_cd)
        {
            // product code 로 구분함.

            fi.bookingMaster(BookingDate,book_cd);

            //clsHITM_FP_GREEKRESULT_TB clstb = fi.build_emptyResult (BookingDate);
            fi.build_emptyResult(BookingDate);

            // if trading 이 clearing이면 그거 찾아서 하면대고.
            // 추가 또는 trading ? 이거면 
        }
Beispiel #4
0
 // single calculation -- 이거는 그냥 엎어치는 용 -- 전체 batch result를 update하지 않음.
 public void calculation(Financial_instrument fi)
 {
     try
     {
         //fi.loadDetail();
         fi.calculate(this.ReferenceDate_);
     }
     catch (Exception e)
     {
         //sb.AppendLine(e.Message);
         LogManager_.addLog(e.Message);
     }
 }
Beispiel #5
0
        // single calculation -- 이거는 그냥 엎어치는 용 -- 전체 batch result를 update하지 않음.
        public void calculation(Financial_instrument fi)
        {
            try
            {
                // 파라메터 아직 디폴트 ---------------------------------------------
                FP_Parameter fp_parameter = new FP_Parameter();
                fp_parameter.CalcDate_ = this.ReferenceDate_;
                fp_parameter.defaultLoad();
                // ------------------------------------------------------------------

                //fi.loadDetail();
                fi.calculate(this.ReferenceDate_, fp_parameter);
                //fi.calculate(this.ReferenceDate_);
            }
            catch (Exception e)
            {
                //sb.AppendLine(e.Message);
                LogManager_.addLog(e.Message);
            }
        }
        private double calculate_tradeQuantity(GreekPosition greekPosition, Financial_instrument financial_instrument)
        {
            // 100% 매치
            // 90% 언더헤지
            // 110% 오버헤지

            double greekPositionAmount = greekPosition.GreekPositionAmount_;
            double quantity = 0.0;
            double mathched_fi_greek = 0.0;

            List<Greek> fi_greeks = financial_instrument.greeks();

            foreach (Greek gp in fi_greeks)
            {
                if ( gp.UnderCode_ == greekPosition.Greek_.UnderCode_ &&
                     gp.type_ == greekPosition.Greek_.type_ )
                {
                    quantity = greekPositionAmount / mathched_fi_greek;
                    quantity = quantity * this.Setting_.HedgeRatio_;        
                }
                
            }
                 
            return quantity;

        }
Beispiel #7
0
        // 12 자리 ( KRCode 호환 )
        // #NEWINSTRUMENTID_ADDITEM
        public static string getNewInstrumentID(Financial_instrument.InstrumentType instrumentType,
                                                DateTime effectiveDate,
                                                Financial_instrument inst)
        {
            string id = "";
            
            // 국가(2)
            id += "KR";

            /*
             1 : 국채
             2 : 지방채
             3 : 특수채
             4 : 선물 및 옵션 ( 거래소 )
             5 : 수익증권
             6 : 사채권
             7 : 주권
             8 : 유가증권예탁증서
             A : 신주인수권              - 10
             B : 외국채권                - 11
             C : 스트립                  - 12

             D : DLS ( 지표 인데 바꿈 )  - 13
             E : ELS                     - 14
             F : 펀드 ( 지료 포함 )      - 15
             G : Forward                 - 16
             H : -------                 - 17
             I : -------                 - 18
             L : DEPOSIT_LOAN            - 19 
             M : MONEY CASH              - 20
             S : 스왑                    - 28
                - 
             * 
                
            */
            // 

            // 세부코드(7) 
            if (instrumentType == Financial_instrument.InstrumentType.Bond) 
            { 
                id += "100"; 

                // detail Code

                id += "ABCDEF";
            }
            else if (instrumentType == Financial_instrument.InstrumentType.Futurs) 
            { 
                // 거래소
                id += "4";

                // detail Code

                // detail type(1) , detail_type(1), year(1) , month(1) , monthOrder(3)

                id += "1"; // 선물 1 , 현물 콜옵션 2 , 등등
                //id += "01"; // 01 kospi200 , 02 ex 등등
                
                //  우선은 effective 나중엔 만기.
                
                string typeStr = "4";
                string yearStr = IDGenerator.yearConv(effectiveDate.Year); // eff year (1)
                string monthStr = IDGenerator.monthConv(effectiveDate.Month); // eff month (1)

                id += yearStr;  // year(1)
                id += monthStr; // month(1)

                string nextOrderStr = IDGenerator.nextMonthOrder(typeStr , yearStr , monthStr);

                id += nextOrderStr; // monthOrder(3)

            }
            else if (instrumentType == Financial_instrument.InstrumentType.Option)
            {
                // 거래소
                id += "4";

                // detail Code

                // detail type(1) , detail_type(1), year(1) , month(1) , monthOrder(3)

                id += "2"; // 선물 1 , 현물 콜옵션 2 , 등등
                //id += "01"; // 01 kospi200 , 02 ex 등등

                //  우선은 effective 나중엔 만기.

                string typeStr = "4";
                string yearStr = IDGenerator.yearConv(effectiveDate.Year); // eff year (1)
                string monthStr = IDGenerator.monthConv(effectiveDate.Month); // eff month (1)

                id += yearStr;  // year(1)
                id += monthStr; // month(1)

                string nextOrderStr = IDGenerator.nextMonthOrder(typeStr, yearStr, monthStr);

                id += nextOrderStr; // monthOrder(3)
            }
            else if (instrumentType == Financial_instrument.InstrumentType.DepositLoan)
            {
                id += "L";

                // detail Code

                id += "000001";
            }
            else if (instrumentType == Financial_instrument.InstrumentType.Forward)
            {
                id += "F";

                // detail Code

                id += "ABCDEF";
            }
            else if (instrumentType == Financial_instrument.InstrumentType.Stock) 
            { 
                id += "7";

                // detail Code

                id += "ABCDEF";
            }
            else if (instrumentType == Financial_instrument.InstrumentType.Index)
            {
                id += "7";

                // detail Code

                id += "ABCDEF";
            }
            // type(1) , detail type(1) , year(1) , effMonth(1) , 내부 월 거래/발행 순서(3) 
            else if (instrumentType == Financial_instrument.InstrumentType.Swap) 
            {
                id += "S"; //type(1)
                
                id += "1"; // vanilla - 1

                string yearStr = IDGenerator.yearConv(effectiveDate.Year); // eff year (1)
                string monthStr = IDGenerator.monthConv(effectiveDate.Month); // eff month (1)

                id += yearStr;
                id += monthStr;

                string nextOrderStr = IDGenerator.nextMonthOrder("S", yearStr, monthStr);

                id += nextOrderStr;

            }
            else if (instrumentType == Financial_instrument.InstrumentType.ELS)
            {
                id += "Z99";

                // detail Code

                id += "ABCDEF";

            }
            else if (instrumentType == Financial_instrument.InstrumentType.DLS)
            {
                id += "Z99";

                // detail Code

                id += "ABCDEF";

            }
            else if (instrumentType == Financial_instrument.InstrumentType.ABCP)
            {
                id += "Z99";

                // detail Code

                id += "ABCDEF";

            }
            else if (instrumentType == Financial_instrument.InstrumentType.Money_Cash)
            {
                // 3
                string currency = ((CurrencyCash)inst).Currency_;
                
                id += currency;

                //id += ((CurrencyCash)inst).DAO_.

                // detail Code
                //string typeStr = "M";
                //string yearStr = IDGenerator.yearConv(effectiveDate.Year); // eff year (1)
                //string monthStr = IDGenerator.monthConv(effectiveDate.Month); // eff month (1)

                //id += yearStr;  // year(1)
                //id += monthStr; // month(1)

                string nextOrderStr = IDGenerator.nextCurrencyOrder(currency);

                id += nextOrderStr; // monthOrder(3)


            }
            else if (instrumentType == Financial_instrument.InstrumentType.Unknown) 
            { 
                id += "Z99";

                // detail Code

                id += "ABCDEF";

            }
            else { id += "Z99"; }

            // 발행자(2)

            id += "78"; // 교보생명

            // 에러코드(1)
            id += "9";

            return id;
        }
Beispiel #8
0
        public bool isExist(Financial_instrument financial_instrument)
        {
            // 검사함 존재하는지.

            return true;
        }