feat:configurable time of day to capture daily changes

This commit is contained in:
hackerESQ
2024-10-25 15:41:07 -05:00
parent 194ad4a532
commit 0434bc6961
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ class Portfolio extends Model
$holdings->each(function($holding) use (&$total_performance, $dividends) {
$period = CarbonPeriod::create($holding->first_transaction_date, now())->filter('isWeekday');
$period = CarbonPeriod::create($holding->first_transaction_date, now()->isBefore(Carbon::parse(config('daily_change_time_of_day'))) ? now()->subDay() : now())->filter('isWeekday');
$holding->setRelation('dividends', $dividends->where('symbol', $holding->symbol));
+3 -1
View File
@@ -13,5 +13,7 @@ return [
'fake' => App\Interfaces\MarketData\FakeMarketData::class,
],
'self_hosted' => env('SELF_HOSTED', true)
'self_hosted' => env('SELF_HOSTED', true),
'daily_change_time_of_day' => env('DAILY_CHANGE_TIME', '23:00')
];
+1 -1
View File
@@ -14,7 +14,7 @@ Schedule::command(RefreshMarketData::class)->everyMinute()->weekdays();
*
* This scheduled job records daily changes to your portfolios every weekday
*/
Schedule::command(CaptureDailyChange::class)->dailyAt('23:00')->weekdays();
Schedule::command(CaptureDailyChange::class)->dailyAt(config('daily_change_time_of_day'))->weekdays();
/**
*