Code Monkey home page Code Monkey logo

perl-finance-yieldcurve's Introduction

NAME

Finance::YieldCurve - provides methods for interpolation on interest rates or dividends

SYNOPSIS

use Finance::YieldCurve;

my $rates = Finance::YieldCurve->new(
 data => {
  1  => 0.014,
  7  => 0.011,
  14 => 0.012,
 },
 asset => 'USD',
);
# For dividends, we return the closest value with no interpolation
my $dividend_rate = $rates->find_closest_to(7 * 24 * 60 * 60);
# For interest rates, we interpolate linearly between the points
my $interest_rate = $rates->interpolate(7 * 24 * 60 * 60);

DESCRIPTION

Handles interpolation methods for different types of yield curve.

Instantiate with a set of data points, then use either the "find_closest_to" or "interpolate" methods to find the appropriate value for a given time (measured in years).

ATTRIBUTES

data

The data points, as a hashref of days => value.

asset

String representing the currency, stock or index, for example USD.

METHODS

interpolate

Get the interpolated rate for this yield curve over the given time period (fractional years).

Example:

my $rate = $curve->interpolate(7 * 24 * 60 * 60);

find_closest_to

Returns the closest point to the request value.

Example:

my $rate = $curve->find_closest_to(7 * 24 * 60 * 60);

day_count

Returns the day count for our asset.

This is an integer value, and will either be 365 or 360.

perl-finance-yieldcurve's People

Contributors

tom-binary avatar jy-deriv avatar zakame avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.