rebalance.cash

Submodules

rebalance.cash.cash

class Cash(amount, currency='CAD')[source]

Bases: object

An instance of Cash holds an amount and a currency.

Attributes
currency_rates (forex_python.converter) : Used for currency conversion.
__init__(amount, currency='CAD')[source]

Initialization.

Parameters:
  • amount (float) – Amount of cash.
  • currency (str, optional) – Currency of cash. Defaults to “CAD”.
amount

Amount of cash.

Type:(float)
amount_in(currency)[source]

Converts amount of cash in specified currency.

Parameters:currency (str) – Currency in which to convert the amount of cash.
Returns:(float) – Amount of cash in specified currency.
currency

Currency of cash.

Type:(str)
currency_rates

Used by autodoc_mock_imports.

exchange_rate(currency)[source]

Obtain the exchange rate from cash’s own currency to specified currency.

Parameters:currency (str) – Currency.
Returns:(float) – exchange rate.

rebalance.cash.price

class Price(price, currency='CAD')[source]

Bases: object

An instance of Price holds a price and a currency.

__init__(price, currency='CAD')[source]

Initialization.

Parameters:
  • price (float) – Price.
  • currency (str, optional) – Currency of price. Defaults to “CAD”.
currency

Currency of price.

Type:(str)
price

Price (in own’s currency).

Type:(float)
price_in(currency)[source]

Converts price in specified currency.

Parameters:currency (str) – Currency in which to convert the price.
Returns:(float) – Price in specified currency.