add force option for dividends and splits
This commit is contained in:
@@ -13,7 +13,8 @@ class RefreshDividendData extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'refresh:dividend-data';
|
protected $signature = 'refresh:dividend-data
|
||||||
|
{--force : Refresh all holdings}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@@ -39,9 +40,13 @@ class RefreshDividendData extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$holdings = Holding::where('quantity', '>', 0)->distinct()->get(['symbol']);
|
$holdings = Holding::distinct();
|
||||||
|
|
||||||
foreach ($holdings as $holding) {
|
if (!($this->option('force') ?? false)) {
|
||||||
|
$holdings->where('quantity', '>', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($holdings->get(['symbol']) as $holding) {
|
||||||
$this->line('Refreshing ' . $holding->symbol);
|
$this->line('Refreshing ' . $holding->symbol);
|
||||||
|
|
||||||
Dividend::refreshDividendData($holding->symbol);
|
Dividend::refreshDividendData($holding->symbol);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class RefreshSplitData extends Command
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'refresh:split-data
|
protected $signature = 'refresh:split-data
|
||||||
{--force= : Don\'t ask to confirm.}';
|
{--force : Refresh all holdings}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@@ -40,9 +40,13 @@ class RefreshSplitData extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$holdings = Holding::where('quantity', '>', 0)->distinct()->get(['symbol']);
|
$holdings = Holding::distinct();
|
||||||
|
|
||||||
foreach ($holdings as $holding) {
|
if (!($this->option('force') ?? false)) {
|
||||||
|
$holdings->where('quantity', '>', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($holdings->get(['symbol']) as $holding) {
|
||||||
$this->line('Refreshing ' . $holding->symbol);
|
$this->line('Refreshing ' . $holding->symbol);
|
||||||
|
|
||||||
Split::refreshSplitData($holding->symbol);
|
Split::refreshSplitData($holding->symbol);
|
||||||
|
|||||||
Reference in New Issue
Block a user