3개월 주기인 선물 만기일이 포함된 달만
거래하는 날짜 수식을 3가지 부탁드립니다.
1. 만기달 만기일만 거래
2. 만기달 만기 주만 거래(만기일 제외)
3. 만기달 첫날부터 만기일 전까지 거래
항상 고맙습니다.
답변 1
예스스탁
예스스탁 답변
2020-06-11 10:38:08
안녕하세요
예스스탁입니다.
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),EXM(0);
Year = Floor(sDate / 10000)*10000;
month = Floor(FracPortion(sdate/10000)*100);
ndate1 = year+(month*100)+1;
if Month+1 <= 12 Then
ndate2 = year+((month*100)+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 EX == 20141009 Then
EX = 20141008;
If EX == 20190912 Then
EX = 20190911;
EXM = Floor(FracPortion(EX/10000)*100);
#1. 만기달 만기일만 거래
if month%3 == 0 and sdate == EX Then
#2. 만기달 만기 주만 거래(만기일 제외)
if month%3 == 0 and Month == EXM and
DateToJulian(sdate) >= DateToJulian(EX)-4 and sdate < EX Then
#2. 만기달 첫날부터 만기일 전까지 거래
if month%3 == 0 and Month == EXM and sdate < EX Then
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 문의
> 3개월 주기인 선물 만기일이 포함된 달만
거래하는 날짜 수식을 3가지 부탁드립니다.
1. 만기달 만기일만 거래
2. 만기달 만기 주만 거래(만기일 제외)
3. 만기달 첫날부터 만기일 전까지 거래
항상 고맙습니다.