Skip to content

InterestRateProvider

QuantConnect.Data.InterestRateProvider

Bases: Object, IRiskFreeInterestRateModel

Fed US Primary Credit Rate at given date

DEFAULT_RISK_FREE_RATE

DEFAULT_RISK_FREE_RATE: float = 0.01

Default Risk Free Rate of 1%

from_csv_file

from_csv_file(
    file: str, first_interest_rate: Optional[float]
) -> Tuple[Dictionary[datetime, float], float]

Reads Fed primary credit rate file and returns a dictionary of historical rate changes

Parameters:

Name Type Description Default
file str

The csv file to be read

required
first_interest_rate Optional[float]

The first interest rate on file

required

Returns:

Type Description
Tuple[Dictionary[datetime, float], float]

Dictionary of historical credit rate change events.

get_interest_rate

get_interest_rate(date: Union[datetime, date]) -> float

Get interest rate by a given date

Parameters:

Name Type Description Default
date Union[datetime, date]

The date

required

Returns:

Type Description
float

Interest rate on the given date.

get_interest_rate_provider

get_interest_rate_provider() -> Dictionary[datetime, float]

Generate the daily historical US primary credit rate

This codeEntityType is protected.

try_parse

try_parse(
    csv_line: str,
    date: Optional[Union[datetime, date]],
    interest_rate: Optional[float],
) -> Tuple[bool, Union[datetime, date], float]

Parse the string into the interest rate date and value

Parameters:

Name Type Description Default
csv_line str

The csv line to be parsed

required
date Optional[Union[datetime, date]]

Parsed interest rate date

required
interest_rate Optional[float]

Parsed interest rate value

required