From e9fb0d0b6f99b9c14029a2e09e5245231f2a8d66 Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Fri, 6 Sep 2024 22:26:54 -0500 Subject: [PATCH] add commands to readme and re-name commands --- README.md | 27 ++++++++++++ app/Console/Commands/CaptureDailyChange.php | 2 +- app/Console/Commands/RefreshDividendData.php | 2 +- app/Console/Commands/RefreshMarketData.php | 2 +- app/Console/Commands/RefreshSplitData.php | 2 +- app/Console/Commands/SyncDailyChange.php | 43 ++++++++++++++++++++ app/Console/Commands/SyncHoldingData.php | 2 +- tests/CaptureDailyChangeTest.php | 2 +- 8 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 app/Console/Commands/SyncDailyChange.php diff --git a/README.md b/README.md index a5726ad..eb7c189 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,33 @@ docker compose up Easy as that! +## Command line utilities + +Investbrain comes bundled with several helpful command line utilities to make managing your portfolios and holdings more efficient. Keep in mind these commands are extremely powerful and can make irreversable changes to your holdings. We only recommend backing up your portfolios before using these commands: + +| Command | Description | +| ------------- | ------------- | +| refresh:market-data | Refreshes market data with your configured market data provider. | +| refresh:dividend-data | Refreshes dividend data with your configured market data provider. Will also re-calculate your total dividends earned for each holding. | +| refresh:split-data | Refreshes splits data with your configured market data provider. Will also create new transactions to account for any splits. | +| capture:daily-change | Captures a snapshot of each portfolio's daily performance. | +| sync:daily-change | Re-calculates daily snapshots of your portfolio's daily performance. | +| sync:holdings | Re-calculates performance of holdings with related transactions (i.e. dividends, realized gains, etc). | + +To run these commands, you can use `docker exec` like this: + +```bash +docker exec -it investbrain-app php artisan +``` + +## Testing + +Investbrain has a complete PHPUnit test suite that creates an in-memory SQLite database and runs any queued jobs synchronously using Laravel's array driver. You can run the entire Investbrain test suite from within the Docker container by running: + +```bash +docker exec -it investbrain-app php artisan test +``` + ## Contributing We appreciate any contributions to Investbrain! Please open a pull request on our [Github repository](https://github.com/investbrainapp/investbrain). Here are some ideas for first time contributors: diff --git a/app/Console/Commands/CaptureDailyChange.php b/app/Console/Commands/CaptureDailyChange.php index 61173d1..a4cca40 100644 --- a/app/Console/Commands/CaptureDailyChange.php +++ b/app/Console/Commands/CaptureDailyChange.php @@ -12,7 +12,7 @@ class CaptureDailyChange extends Command * * @var string */ - protected $signature = 'daily-change:capture'; + protected $signature = 'capture:daily-change'; /** * The console command description. diff --git a/app/Console/Commands/RefreshDividendData.php b/app/Console/Commands/RefreshDividendData.php index 8356fad..07925d5 100644 --- a/app/Console/Commands/RefreshDividendData.php +++ b/app/Console/Commands/RefreshDividendData.php @@ -13,7 +13,7 @@ class RefreshDividendData extends Command * * @var string */ - protected $signature = 'dividend-data:refresh'; + protected $signature = 'refresh:dividend-data'; /** * The console command description. diff --git a/app/Console/Commands/RefreshMarketData.php b/app/Console/Commands/RefreshMarketData.php index 23383ee..16310f9 100644 --- a/app/Console/Commands/RefreshMarketData.php +++ b/app/Console/Commands/RefreshMarketData.php @@ -13,7 +13,7 @@ class RefreshMarketData extends Command * * @var string */ - protected $signature = 'market-data:refresh + protected $signature = 'refresh:market-data {--force= : Ignore refresh delay}'; /** diff --git a/app/Console/Commands/RefreshSplitData.php b/app/Console/Commands/RefreshSplitData.php index 6623d00..bc0ce2f 100644 --- a/app/Console/Commands/RefreshSplitData.php +++ b/app/Console/Commands/RefreshSplitData.php @@ -13,7 +13,7 @@ class RefreshSplitData extends Command * * @var string */ - protected $signature = 'split-data:refresh + protected $signature = 'refresh:split-data {--force= : Don\'t ask to confirm.}'; /** diff --git a/app/Console/Commands/SyncDailyChange.php b/app/Console/Commands/SyncDailyChange.php new file mode 100644 index 0000000..d140e6a --- /dev/null +++ b/app/Console/Commands/SyncDailyChange.php @@ -0,0 +1,43 @@ +assertDatabaseHas('daily_change', [