아래는 옵션 만기일 기준으로 날짜를 리턴하는 수식입니다.
선물 만기일(3개월) 기준 수식을 부탁드립니다.
항상 고맙습니다.
***********************************************************************************
input : 리메인(0);
Var : Year(0),Month(0),ndate1(0),ndate2(0);
var : cnt(0),count1(0),count2(0);
var : XD1(0),XD2(0),Xdate(0),remain(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;
for cnt = 0 to 15
{
if dayofweek(ndate1+cnt) == 4 Then
{
count1 = count1+1;
if count1 == 2 Then
{
XD1 = ndate1+cnt;
}
}
if dayofweek(ndate2+cnt) == 4 Then
{
count2 = count2+1;
if count2 == 2 Then
{
XD2 = nDate2+cnt;
}
}
}
if sDate <= XD1 Then
{
Xdate = XD1;
}
Else
{
Xdate = XD2;
}
if Xdate > 0 Then
{
remain = DateToJulian(Xdate)-DateToJulian(sDate);
}
if remain == 리메인 then
{
}
답변 1
예스스탁
예스스탁 답변
2020-12-14 11:57:52
안녕하세요
예스스탁입니다.
input : 리메인(0);
Var : Year(0),Month(0);
var : ndate1(0),ndate2(0),ndate3(0),ndate4(0),ndate5(0);
var : cnt(0),count1(0),count2(0),count3(0),count4(0),count5(0);
var : XD1(0),XD2(0),XD3(0),XD4(0),XD5(0);
var : Xdate(0),remain(0);
Year = Floor(sDate / 10000)*10000;
month = Floor(FracPortion(sdate/10000)*100)*100;
ndate1 = year+300+1;
ndate2 = year+600+1;
ndate3 = year+900+1;
ndate4 = year+1200+1;
ndate5 = (year+10000)+300+1;
count1 = 0;
count2 = 0;
count3 = 0;
count4 = 0;
count5 = 0;
for cnt = 0 to 15
{
if dayofweek(ndate1+cnt) == 4 Then
{
count1 = count1+1;
if count1 == 2 Then
{
XD1 = ndate1+cnt;
}
}
if dayofweek(ndate2+cnt) == 4 Then
{
count2 = count2+1;
if count2 == 2 Then
{
XD2 = nDate2+cnt;
}
}
if dayofweek(ndate3+cnt) == 4 Then
{
count3 = count3+1;
if count3 == 2 Then
{
XD3 = nDate3+cnt;
}
}
if dayofweek(ndate4+cnt) == 4 Then
{
count4 = count4+1;
if count4 == 2 Then
{
XD4 = nDate4+cnt;
}
}
if dayofweek(ndate5+cnt) == 4 Then
{
count5 = count5+1;
if count5 == 2 Then
{
XD5 = nDate5+cnt;
}
}
}
if sDate <= XD1 Then
{
Xdate = XD1;
}
else if sDate > XD1 and sDate <= XD2 Then
{
Xdate = XD2;
}
else if sDate > XD2 and sDate <= XD3 Then
{
Xdate = XD3;
}
else if sDate > XD3 and sDate <= XD4 Then
{
Xdate = XD4;
}
Else
{
Xdate = XD5;
}
if Xdate > 0 Then
{
remain = DateToJulian(Xdate)-DateToJulian(sDate);
}
즐거운 하루되세요
> 좌오비우오비 님이 쓴 글입니다.
> 제목 : 문의
> 아래는 옵션 만기일 기준으로 날짜를 리턴하는 수식입니다.
선물 만기일(3개월) 기준 수식을 부탁드립니다.
항상 고맙습니다.
***********************************************************************************
input : 리메인(0);
Var : Year(0),Month(0),ndate1(0),ndate2(0);
var : cnt(0),count1(0),count2(0);
var : XD1(0),XD2(0),Xdate(0),remain(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;
for cnt = 0 to 15
{
if dayofweek(ndate1+cnt) == 4 Then
{
count1 = count1+1;
if count1 == 2 Then
{
XD1 = ndate1+cnt;
}
}
if dayofweek(ndate2+cnt) == 4 Then
{
count2 = count2+1;
if count2 == 2 Then
{
XD2 = nDate2+cnt;
}
}
}
if sDate <= XD1 Then
{
Xdate = XD1;
}
Else
{
Xdate = XD2;
}
if Xdate > 0 Then
{
remain = DateToJulian(Xdate)-DateToJulian(sDate);
}
if remain == 리메인 then
{
}