커뮤니티

옵션 날짜 수식

프로필 이미지
좌오비우오비
2019-11-19 09:58:11
134
글번호 133739
답변완료
아래처럼 옵션기간을 3가지로 구분하여 잘 사용하고 있습니다. 추가로 알고 싶은 수식이 있어 요청드립니다. 1)옵션만기일 기준으로 - N일의 하루치 결과를 예측하는 수식 N일을 입력하면 N일 하루치 결과를 시뮬레이션 input:옵션만기일 기준(3); 0 입력하면 옵션만기일 하루치 결과 1 입력하면 옵션만기 1일 전 하루치 결과 2 입력하면 옵션만기 2일 전 하루치 결과 3 입력하면 옵션만기 3일 전 하루치 결과 2)옵션만기일 하루전 기준으로 - N일까지의 결과를 예측하는 수식 N일을 입력하면 N일부터 옵션만기일 하루전까지 시뮬레이션 input:옵션만기일 하루전 기준(3); 1 입력하면 옵션만기 1일전 결과 2 입력하면 옵션만기 1일전,2일전 결과 3 입력하면 옵션만기 1일전,2일전,3일전 결과 항상 고맙습니다. ****************************************************************************** 2019년 11월 15일부터 11월 30일까지 (만기일 포함되지 않은 달 거래) 2019년 12월 1일부터 12월 11일까지 (만기일 포함된 달 거래) 2019년 12월 12일 1일 거래 (만기일 1일 거래) (만기일 포함되지 않은 달 거래) var : nday(0),week(0),month(0),Xdate(0),XMonth(0); month = int(date/100)-int(date/10000)*100; nday = date - int(date/100)*100; week = DayOfWeek(date); if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then { Xdate = sdate; XMonth = Month; } if sdate > Xdate and month == XMonth Then { } (만기일 포함된 달 거래) var : nday(0),week(0),Xdate(0),entree(false); nday = date - int(date/100)*100; week = DayOfWeek(date); if bdate > bdate[1]+30 Then entree = true; if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then { entree = false; } if entree == true Then { } (만기일 하루 거래) var : nday(0),week(0),Xdate(0); nday = date - int(date/100)*100; week = DayOfWeek(date); if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then Xdate = sdate; if sdate == Xdate then { }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-11-20 09:06:33

안녕하세요 예스스탁입니다. 1 input : 옵션만기일기준(1); Var : Year(0),Month(0),ndate1(0),ndate2(0); var : cnt(0),count1(0),count2(0),count3(0); var : entry(false),Xdate1(0),Xdate2(0),Xdate3(0); var : EX(0); Year = Floor(sDate / 10000)*10000; month = Floor(FracPortion(sdate/10000)*100)*100; ndate1 = year+month+1; if Month+100 <= 1200 Then ndate2 = year+(month+100)+1; Else ndate2 = (year+10000)+100+1; count1 = 0; count2 = 0; Condition1 = false; Condition2 = false; for cnt = 0 to 15 { if dayofweek(ndate1+cnt) == 4 Then { count1 = count1+1; if Condition1 == false and count1 == 2 Then { Condition1 = true; Xdate1 = ndate1+cnt; } } if dayofweek(ndate2+cnt) == 4 Then { count2 = count2+1; if Condition2 == false and count2 == 2 Then { Condition2 = true; Xdate2 = ndate2+cnt; } } } if sdate <= Xdate1 Then EX = Xdate1; Else Ex = Xdate2; if DateToJulian(sdate) == DateToJulian(EX)-옵션만기일기준 Then { } 2 input : 옵션만기일하루전기준(3); Var : Year(0),Month(0),ndate1(0),ndate2(0); var : cnt(0),count1(0),count2(0),count3(0); var : entry(false),Xdate1(0),Xdate2(0),Xdate3(0); var : EX(0); Year = Floor(sDate / 10000)*10000; month = Floor(FracPortion(sdate/10000)*100)*100; ndate1 = year+month+1; if Month+100 <= 1200 Then ndate2 = year+(month+100)+1; Else ndate2 = (year+10000)+100+1; count1 = 0; count2 = 0; Condition1 = false; Condition2 = false; for cnt = 0 to 15 { if dayofweek(ndate1+cnt) == 4 Then { count1 = count1+1; if Condition1 == false and count1 == 2 Then { Condition1 = true; Xdate1 = ndate1+cnt; } } if dayofweek(ndate2+cnt) == 4 Then { count2 = count2+1; if Condition2 == false and count2 == 2 Then { Condition2 = true; Xdate2 = ndate2+cnt; } } } if sdate <= Xdate1 Then EX = Xdate1; Else Ex = Xdate2; if DateToJulian(sdate) >= DateToJulian(EX)-옵션만기일하루전기준 and DateToJulian(sdate) <= DateToJulian(EX)-1 Then { } 즐거운 하루되세요 > 좌오비우오비 님이 쓴 글입니다. > 제목 : 옵션 날짜 수식 > 아래처럼 옵션기간을 3가지로 구분하여 잘 사용하고 있습니다. 추가로 알고 싶은 수식이 있어 요청드립니다. 1)옵션만기일 기준으로 - N일의 하루치 결과를 예측하는 수식 N일을 입력하면 N일 하루치 결과를 시뮬레이션 input:옵션만기일 기준(3); 0 입력하면 옵션만기일 하루치 결과 1 입력하면 옵션만기 1일 전 하루치 결과 2 입력하면 옵션만기 2일 전 하루치 결과 3 입력하면 옵션만기 3일 전 하루치 결과 2)옵션만기일 하루전 기준으로 - N일까지의 결과를 예측하는 수식 N일을 입력하면 N일부터 옵션만기일 하루전까지 시뮬레이션 input:옵션만기일 하루전 기준(3); 1 입력하면 옵션만기 1일전 결과 2 입력하면 옵션만기 1일전,2일전 결과 3 입력하면 옵션만기 1일전,2일전,3일전 결과 항상 고맙습니다. ****************************************************************************** 2019년 11월 15일부터 11월 30일까지 (만기일 포함되지 않은 달 거래) 2019년 12월 1일부터 12월 11일까지 (만기일 포함된 달 거래) 2019년 12월 12일 1일 거래 (만기일 1일 거래) (만기일 포함되지 않은 달 거래) var : nday(0),week(0),month(0),Xdate(0),XMonth(0); month = int(date/100)-int(date/10000)*100; nday = date - int(date/100)*100; week = DayOfWeek(date); if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then { Xdate = sdate; XMonth = Month; } if sdate > Xdate and month == XMonth Then { } (만기일 포함된 달 거래) var : nday(0),week(0),Xdate(0),entree(false); nday = date - int(date/100)*100; week = DayOfWeek(date); if bdate > bdate[1]+30 Then entree = true; if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then { entree = false; } if entree == true Then { } (만기일 하루 거래) var : nday(0),week(0),Xdate(0); nday = date - int(date/100)*100; week = DayOfWeek(date); if (nday >= 8 and nday <= 14 and week == 4) or (sdate == 20141008) or (sdate == 20190911) then Xdate = sdate; if sdate == Xdate then { }