jakub-mrow / AMS-backend

0 stars 0 forks source link

Rebuild AccountBalance history #66

Closed dawids21 closed 11 months ago

dawids21 commented 12 months ago

Implement the mechanism of rebuilding the history of AccountBalance whenever any transaction, whose date is before last_save_date for an account, is added.

The process and the necessary steps are presented on the diagram:

  1. Get AccountHistory before the rebuild.
  2. Get all transactions after the moment of rebuild sorted by date
  3. Create Account and AccountBalance from history
  4. For each day until yesterday apply the transactions and save the Account and AccountBalance in history.
  5. Apply transactions from today.
  6. Calculate XIRR for account.
  7. Save Account and AccountBalance

Waiting for: