add finance words to math.finance

db4
Doug Coleman 2008-12-06 23:05:02 -06:00
parent 3821b417af
commit e4efe6ec24
2 changed files with 52 additions and 0 deletions

View File

@ -32,3 +32,44 @@ HELP: momentum
{ $list "MOM[t] = SEQ[t] - SEQ[t-n]" } { $list "MOM[t] = SEQ[t] - SEQ[t-n]" }
} ; } ;
HELP: biweekly
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of two week periods in a year." } ;
HELP: daily-360
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of days in a 360-day year." } ;
HELP: daily-365
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of days in a 365-day year." } ;
HELP: monthly
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of months in a year." } ;
HELP: semimonthly
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of half-months in a year. Note that biweekly has two more periods than semimonthly." } ;
HELP: weekly
{ $values
{ "x" number }
{ "y" number }
}
{ $description "Divides a number by the number of weeks in a year." } ;

View File

@ -26,3 +26,14 @@ PRIVATE>
: momentum ( seq n -- newseq ) : momentum ( seq n -- newseq )
[ tail-slice ] 2keep [ dup length ] dip - head-slice v- ; [ tail-slice ] 2keep [ dup length ] dip - head-slice v- ;
: monthly ( x -- y ) 12 / ; inline
: semimonthly ( x -- y ) 24 / ; inline
: biweekly ( x -- y ) 26 / ; inline
: weekly ( x -- y ) 52 / ; inline
: daily-360 ( x -- y ) 360 / ; inline
: daily-365 ( x -- y ) 365 / ; inline