Enums
Module defining enums for financial calculations and cash flow modeling in the library.
Frequency
Bases: Enum
Enum defining the compounding period between cash flows.
Attributes:
| Name | Type | Description |
|---|---|---|
WEEKLY |
Weekly compounding period. |
|
FORTNIGHTLY |
Biweekly (every two weeks) compounding period. |
|
MONTHLY |
Monthly compounding period. |
|
QUARTERLY |
Quarterly (every three months) compounding period. |
|
HALF_YEARLY |
Semi-annual (every six months) compounding period. |
|
YEARLY |
Annual compounding period. |
Source code in curo/enums.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
pandas_freq
property
Maps the frequency to a pandas frequency alias for time series operations.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Pandas frequency alias (e.g., "W" for WEEKLY, "ME" for MONTHLY). |
Mode
Bases: Enum
Enum specifying whether a cash flow occurs at the start or end of a compounding period.
Attributes:
| Name | Type | Description |
|---|---|---|
ADVANCE |
Cash flows due at the beginning of the compounding period. |
|
ARREAR |
Cash flows due at the end of the compounding period. |
Source code in curo/enums.py
43 44 45 46 47 48 49 50 51 52 | |
DayCountTimePeriod
Bases: Enum
Enum defining the time interval for day count factor calculations in financial computations.
Attributes:
| Name | Type | Description |
|---|---|---|
DAY |
Daily interval. |
|
WEEK |
Weekly interval. |
|
FORTNIGHT |
Biweekly (every two weeks) interval. |
|
MONTH |
Monthly interval. |
|
QUARTER |
Quarterly (every three months) interval. |
|
HALF_YEAR |
Semi-annual (every six months) interval. |
|
YEAR |
Annual interval. |
Source code in curo/enums.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
periods_in_year
property
Maps the time period to the number of such periods in a year for financial calculations.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Number of periods in a year (e.g., 365 for DAY, 12 for MONTH). |
DayCountOrigin
Bases: Enum
Enum used internally to define the start date for calculating day counts in financial time periods.
Attributes:
| Name | Type | Description |
|---|---|---|
DRAWDOWN |
The initial drawdown post date, used in APR and XIRR calculations. |
|
NEIGHBOUR |
A neighboring cash flow date, used for compounding periods in solving unknown values or effective interest rates. |
Source code in curo/enums.py
93 94 95 96 97 98 99 100 101 102 103 104 | |
CashFlowColumn
Bases: Enum
Enum defining the mandatory column names for pandas DataFrames used in cash flow calculations within the Calculator class.
These columns are required in all cash flow profiles, whether created internally (e.g., via Calculator._build_profile) or provided as bespoke profiles by users. They represent the core attributes of cash flows used in methods like solve_rate, solve_value, and build_schedule.
Attributes:
| Name | Type | Description |
|---|---|---|
POST_DATE |
str
|
The posting date of the cash flow (datetime64[ns, UTC]). Typically when the cash flow is recorded or effective. |
VALUE_DATE |
str
|
The value date of the cash flow (datetime64[ns, UTC]). Represents when the cash flow impacts the balance, must be on or after POST_DATE. |
AMOUNT |
str
|
The cash flow amount (float64). Negative for advances, positive for payments and charges. Unknown amounts use 0.0 as a placeholder with IS_KNOWN=False. |
IS_KNOWN |
str
|
Indicates if the AMOUNT is known (bool). True for user-provided or calculated amounts, False for unknowns to be solved (e.g., in solve_value). |
WEIGHTING |
str
|
The weighting factor for the cash flow (float64). Must be > 0, used to scale amounts in solve_value calculations. |
LABEL |
str
|
A descriptive label for the cash flow (object). E.g., 'Loan', 'Instalment'. |
MODE |
str
|
The cash flow mode (object). Either 'advance' or 'arrear', defining timing relative to periods. |
IS_INTEREST_CAPITALISED |
str
|
Indicates if the payment includes interest capitalization (object). True/False for payments, None for advances/charges. |
IS_CHARGE |
str
|
Indicates if the cash flow is a charge (bool). True for charges, False for advances/payments. |
Source code in curo/enums.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
CashFlowColumnExtras
Bases: Enum
Enum defining supplemental column names added to pandas DataFrames in result outputs generated by the Calculator class, such as Amortization or APR proof schedules.
These columns are not part of input cash flow profiles but are added during processing by methods like build_schedule. The specific columns included depend on the schedule type: Amortization (capital, interest, capital_balance) or APR proof (discount_log, amount_discounted, discounted_balance). The 'factor' column is required in input profiles for build_schedule, typically added via _assign_factors.
Attributes:
| Name | Type | Description |
|---|---|---|
AMOUNT_DISCOUNTED |
str
|
The discounted cash flow amount (float64) in APR proof schedules, rounded to 6 decimal places. |
CAPITAL |
str
|
The capital portion of a payment (float64) in Amortization schedules, calculated as amount - interest. |
CAPITAL_BALANCE |
str
|
The running capital balance (float64) in Amortization schedules, netting to zero at the end. |
DISCOUNT_LOG |
str
|
A string representation of the discount factor (object) in APR proof schedules, derived from factor.to_folded_string(). |
DISCOUNTED_BALANCE |
str
|
The cumulative sum of amount_discounted (float64) in APR proof schedules, netting to zero, rounded to 6 decimal places. |
FACTOR |
str
|
The day count factor (object) for cash flows, containing DayCountFactor objects. Required in input profiles for build_schedule. |
INTEREST |
str
|
The interest portion of a payment (float64) in Amortization schedules, negative for capitalized payments. |
Source code in curo/enums.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
SortColumn
Bases: Enum
Enum used internally to define the date sort order of pandas DataFrame cashflow entries.
Source code in curo/enums.py
180 181 182 183 184 185 | |
ValidationMode
Bases: Enum
Enum used internally to define the validation mode when solving for an unknown value or interest rate.
Attributes:
| Name | Type | Description |
|---|---|---|
SOLVE_VALUE |
Allows undefined advance OR payment values |
|
SOLVE_RATE |
Requires all values to be known |
Source code in curo/enums.py
187 188 189 190 191 192 193 194 195 196 197 | |