add finance words to math.finance
parent
3821b417af
commit
e4efe6ec24
|
@ -32,3 +32,44 @@ HELP: momentum
|
|||
{ $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." } ;
|
||||
|
|
|
@ -26,3 +26,14 @@ PRIVATE>
|
|||
: momentum ( seq n -- newseq )
|
||||
[ 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
|
||||
|
|
Loading…
Reference in New Issue