add commands to readme

and re-name commands
This commit is contained in:
hackerESQ
2024-09-06 22:26:54 -05:00
parent e9ec079ff9
commit e9fb0d0b6f
8 changed files with 76 additions and 6 deletions
+27
View File
@@ -80,6 +80,33 @@ docker compose up
Easy as that! 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 <replace with command you want to run>
```
## 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 ## 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: 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:
+1 -1
View File
@@ -12,7 +12,7 @@ class CaptureDailyChange extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'daily-change:capture'; protected $signature = 'capture:daily-change';
/** /**
* The console command description. * The console command description.
+1 -1
View File
@@ -13,7 +13,7 @@ class RefreshDividendData extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'dividend-data:refresh'; protected $signature = 'refresh:dividend-data';
/** /**
* The console command description. * The console command description.
+1 -1
View File
@@ -13,7 +13,7 @@ class RefreshMarketData extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'market-data:refresh protected $signature = 'refresh:market-data
{--force= : Ignore refresh delay}'; {--force= : Ignore refresh delay}';
/** /**
+1 -1
View File
@@ -13,7 +13,7 @@ class RefreshSplitData extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'split-data:refresh protected $signature = 'refresh:split-data
{--force= : Don\'t ask to confirm.}'; {--force= : Don\'t ask to confirm.}';
/** /**
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use App\Models\Holding;
use Illuminate\Console\Command;
class SyncDailyChange extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sync:daily-change';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Re-calculates daily snapshots of your portfolio\'s daily performance. Use discretion as this is a resource intensive command.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
//
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ class SyncHoldingData extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'holding-data:sync'; protected $signature = 'sync:holdings';
/** /**
* The console command description. * The console command description.
+1 -1
View File
@@ -30,7 +30,7 @@ class CaptureDailyChangeTest extends TestCase
public function test_daily_change_for_portfolios() public function test_daily_change_for_portfolios()
{ {
// Run the command // Run the command
Artisan::call('daily-change:capture'); Artisan::call('capture:daily-change');
// Assert the daily change was captured for the portfolio // Assert the daily change was captured for the portfolio
$this->assertDatabaseHas('daily_change', [ $this->assertDatabaseHas('daily_change', [