oddchange_at wip

This commit is contained in:
salam committed 2026-01-18 10:40:19 +01:00
1 parent 4480ba7fee
commit 562c65f331
47 files changed
+295 -213

No files matched your search

@@ -3,7 +3,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -17,20 +16,29 @@ class _TotalsQ1
$odds['total'] = (float) $value->o3;
}
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
if ($odds['sport_id'] == 1) {
if ((float) $odds['total'] != 2.5) {
return;
}
} else {
if (fmod((float) $odds['total'], 1) != 0.5) {
return;
}
}
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['updated_at'] = now();
ActiveSpread::collect($odds, 'odds_totals_q1');
DB::table('odds_totals_q1')->upsert(
$odds,
DB::table('odds_totals_q1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'total' => $odds['total'],
], $odds);
['event_id', 'bookmaker_id', 'total'],
['over', 'under', 'difference', 'margin', 'flags', 'updated_at']
);
ActiveSpread::collect($odds, 'odds_totals_q1');
}
}