NOTICE: All information contained herein is, and remains
the property of TechnoCore.
The intellectual and technical concepts contained
herein are proprietary to TechnoCore and dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from TechnoCore.
ObjTextFHSettlement is a Python module for calculating the settlement amount for a hire purchase (HP) agreement. It retrieves contract details from the database and uses financial calculations to determine the outstanding balance, including interest adjustments.
numpy.ipmt to calculate interest portions of payments.trader database.__init__(self, db_connection: DatabaseConnection = 0, page=0)Initializes the ObjTextFHSettlement object.
DatabaseConnection object for database operations.compute_settle(self, contract)Performs the core settlement calculation for a single contract.
compute(self, param_1="", ...)Orchestrates the settlement calculation, either for a single contract or for all contracts requiring an update.
Process(self, param_1="", ...)The main entry point for calculating the settlement amount.
To calculate the settlement amount for a specific contract:
import ObjTextFHSettlement
# Initialize the object with a database connection
settlement_calculator = ObjTextFHSettlement.ObjProcessText(db_connection=db)
# Calculate the settlement for a contract
contract_id = "202-112563-01"
settlement_amount = settlement_calculator.Process(contract_id)
print(f"The settlement amount for contract {contract_id} is {settlement_amount}")
The four statements live in ObjTextFHSettlement.yaml
(database.queries), loaded with get_queries(name).format(...):
| Query | Purpose |
|---|---|
read_contract_header |
the HP transaction header a settlement is computed from |
read_standard_instalment |
the contract's standard instalment |
list_pending_settlements |
contracts awaiting a figure (Settle = -1) |
update_settlement |
writes the computed figure back |
Applied 2026-08-16. The contract id was concatenated in
(Sql += f" '{Contract}' ") and now goes through escape_sql(), and
update_settlement's (written, rows) is captured — it was
discarded, so a failed write in the complete sweep left the contract
at Settle = -1 with nothing said.
select datediff(LAST_DAY(NOW()),NOW())
select DAY(LAST_DAY(NOW()))
Both assigned their result to _. They are SELECTs of pure date
functions, so nothing downstream read them and removing them has no
side effect — it stops two round trips per contract, which in
complete mode is two per contract across the whole rolling set.