andyblight / share-tracking-1

Share tracking app with a Tcl/TK GUI and SQLite database.
MIT License
0 stars 0 forks source link

Update holdings from transactions #4

Open andyblight opened 2 years ago

andyblight commented 2 years ago

Implement functionality to update the holdings table from the transactions table.

andyblight commented 2 years ago

Planning next batches of work. 0h30

andyblight commented 2 years ago

Decided to implement update in a dialog box as it could take some time to do the various queries and write the records so a progress bar can be shown. It also gives the user the option to back out before any changes are made. 0h15

andyblight commented 2 years ago

Started implementing the get_quantities method on the TransactionsTable and realised that I need test data. Time to switch tasks to import CSV data. 0h20

andyblight commented 2 years ago

Commit d5a3e41ed36e2de59baf7c809499c08583c1acee Getting back to where I was after not uploading changes from other laptop. Select security dialog appears but needs lots of work. 2h00

andyblight commented 2 years ago

There are two existing queries: get_all_rows and get_quantities. get_all_rows is probably most useful. It would be useful to reduce the number of rows returned to just the securities that are currently being held. It would be easiest to have buy transactions as positive numbers and sell as negative. This might be best done in python code rather than SQL, so back to using get_all_rows.

Now to implement it.

andyblight commented 2 years ago

Implemented functions to do the work. Started on filtering all transactions down to active securities. Realised that some securities still have the value -1. Will need to fix that on #8.

andyblight commented 2 years ago

Commit c61f774ff0bfbe35ccf8765c8b6add9dbd6ee592 Holdings now filters the raw transactions correctly. The security -1 values are still a problem. 2h30

andyblight commented 2 years ago

Commit fb61ffc9dcc96ee3ea522e4acb3d241cd5eacbd4. Refactored some dialog box code to split out functionality into separate files. Added classes to name the elements of the rows for the holdings and transactions tables.

To do

3h30 9h00

andyblight commented 2 years ago

Commit f922c2a7c7a3917120170ef7e40207edacaf1444 Moved filtering of transactons to transactions table and simplified. 1h30 10h30

andyblight commented 2 years ago

Commit 8c606b967c4ced94212251c24ed8f2753c103a86 Merged all changes from home laptop that were not fixed. 3h00 13h30

andyblight commented 2 years ago

This is trickier than it first appears. Adding new holdings records to the empty holdings table is simple. Updating records is trickier. Are the holdings just a record of the current holdings? If so, the get_filtered_transactions do this. If not, what do they need to show?
I think I was intending to so the progress of each holding. This is not quite what I am actually implementing so needs a little thought.

andyblight commented 2 years ago

Commit 99e95fe9a83302ef7a516a72429d1cad4e303425 Writes holdings records and shows them in the view. Could close this as some records written but should really merge in changes. However, I need to more thinking first (see above).
2h00 15h30

andyblight commented 2 years ago

The original plan is still good.
Going to do the merge part of this next.

andyblight commented 1 year ago

Re-worked logic for updates. Looks like it should work. Database needs to be updated with the changes. 2h00 17h30

andyblight commented 1 year ago

Insert works. Replace logic is not right as too many records being created. 2h00 19h30