Series
Module provides type-safe classes for capturing user-defined advance, payment, and charge series input.
Series
dataclass
Abstract base class for financial series (advances, payments, charges).
Defines common properties and a method to convert the series into a pandas DataFrame
of dated cash flow data. Inherited by SeriesAdvance, SeriesPayment, and SeriesCharge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of
|
int
|
Total number of cash flows in the series. Must be >= 1. Defaults to 1. |
1
|
frequency
|
Frequency
|
Frequency of recurring cash flows (e.g., |
MONTHLY
|
label
|
str
|
Descriptive label for cash flows (e.g., "Loan advance"). Defaults to an empty string. |
''
|
amount
|
Optional[float]
|
Cash flow value. If |
None
|
mode
|
Mode
|
Mode of cash flows ( |
ADVANCE
|
post_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Start date for postings. Converted to a UTC |
None
|
value_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Start date for value/settlement, on or after |
None
|
weighting
|
float
|
Weighting for unknown values. Must be positive. Defaults to 1.0. |
1.0
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
|
Notes
- Dates are normalized to midnight UTC.
value_date_fromis only allowed forSeriesAdvanceand is set topost_date_fromifNonewhen required.
Source code in curo/series.py
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 42 43 44 45 46 47 48 49 50 51 52 53 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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 144 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 179 180 181 182 183 184 185 186 187 188 189 | |
to_cash_flows(start_date)
Converts the series into a pandas DataFrame containing dated cash flow data.
Generates a sequence of cash flows based on the series' properties, including posting and value dates, amounts, and other attributes. Dates are normalized to midnight UTC, and the frequency determines the interval between cash flows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
Union[Timestamp, datetime, date]
|
The reference start date for the series, normalized to midnight UTC. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A pandas DataFrame with columns: |
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
DataFrame
|
|
Notes
- Dates are adjusted to preserve the day of the month from the start date, capped at the last day of the month if necessary.
- The frequency determines the interval between cash flows (e.g., weekly, monthly).
- For
SeriesChargeandSeriesPayment,value_datematchespost_datein the output DataFrame, ensuring consistent sorting by either column. - The
amountcolumn is set to0.0for unknown values (self.amount is None), withis_known=False. Theamountplaceholder is intended to be overridden by the solver.
Source code in curo/series.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 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 144 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 179 180 181 182 183 184 185 186 187 188 189 | |
SeriesAdvance
dataclass
Bases: Series
Represents a series of one or more advances paid out by a lender, such as loans or a lessor's net investment in a lease.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of
|
int
|
Total number of advances in the series. Defaults to 1. |
1
|
frequency
|
Frequency
|
Frequency of recurring advances (e.g., |
MONTHLY
|
label
|
str
|
Singular label for each cash flow (e.g., "Loan advance") for use in amortisation schedules or proofs. Defaults to an empty string. |
''
|
amount
|
Optional[float]
|
Value of the advances. If |
None
|
post_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Posting or drawdown date of the first advance. Subsequent
dates follow the series' |
None
|
value_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Value or settlement date of the first advance, on or after
|
None
|
mode
|
Mode
|
Mode of advances ( |
ADVANCE
|
weighting
|
float
|
Weighting of unknown advance values relative to other unknown series. Must be positive. Defaults to 1.0. |
1.0
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
Inherited from |
Source code in curo/series.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
SeriesPayment
dataclass
Bases: Series
Represents a series of one or more payments received by a lender, such as loan repayments or lease rentals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of
|
int
|
Total number of payments in the series. Defaults to 1. |
1
|
frequency
|
Frequency
|
Frequency of recurring payments (e.g., |
MONTHLY
|
label
|
str
|
Singular label for each cash flow (e.g., "Rental") for use in amortisation schedules or proofs. Defaults to an empty string. |
''
|
amount
|
Optional[float]
|
Value of the payments. If |
None
|
post_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Due date of the first payment. Subsequent dates follow the
series' |
None
|
mode
|
Mode
|
Mode of payments ( |
ADVANCE
|
weighting
|
float
|
Weighting of unknown payment values relative to other unknown series. Must be positive. Defaults to 1.0. |
1.0
|
is_interest_capitalised
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
|
Source code in curo/series.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
SeriesCharge
dataclass
Bases: Series
A series of one or more charges or fees received by a lender, such as arrangement fees. These non-financing cash flows are excluded from unknown advance or payment calculations but may be included in computations like Annual Percentage Rates (APRs).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of
|
int
|
Total number of charges in the series. Defaults to 1. |
1
|
frequency
|
Frequency
|
Frequency of recurring charges (e.g., |
MONTHLY
|
label
|
str
|
Singular label for each cash flow (e.g., "Arrangement fee") for use in amortisation schedules or proofs. Defaults to an empty string. |
''
|
amount
|
float
|
Value of the charges (required). |
None
|
post_date_from
|
Optional[Union[Timestamp, datetime, date]]
|
Due date of the first charge. Subsequent dates follow the
series' |
None
|
mode
|
Mode
|
Mode of charges ( |
ADVANCE
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
|
Source code in curo/series.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |