|
@@ -1276,9 +1276,7 @@ def pay_bond_interest():
|
|
|
sec_per_year = 3600 * 24 * 365
|
|
|
interests = execute('''
|
|
|
SELECT
|
|
|
- SUM(amount * (POWER(1 + coupon,
|
|
|
- (MIN(CAST(? AS FLOAT), maturity_dt) - last_interest_pay_dt) / ?) - 1)
|
|
|
- ) AS interest_since_last_pay,
|
|
|
+ SUM(amount * coupon * (MIN(CAST(? AS FLOAT), maturity_dt) - last_interest_pay_dt) / ?) AS interest_since_last_pay,
|
|
|
o.user_id AS to_user_id,
|
|
|
bonds.issuer_id AS from_user_id
|
|
|
FROM bonds
|
|
@@ -1323,9 +1321,7 @@ def pay_loan_interest():
|
|
|
sec_per_year = 3600 * 24 * 365
|
|
|
interests = execute('''
|
|
|
SELECT
|
|
|
- SUM(amount * (POWER(1 + interest_rate,
|
|
|
- (CAST(? AS FLOAT) - last_interest_pay_dt) / ?) - 1)
|
|
|
- ) AS interest_since_last_pay,
|
|
|
+ SUM(amount * interest_rate * (CAST(? AS FLOAT) - last_interest_pay_dt) / ?) AS interest_since_last_pay,
|
|
|
user_id
|
|
|
FROM loans
|
|
|
WHERE ? - last_interest_pay_dt > ?
|