grapper wip

This commit is contained in:
salam committed 2026-01-18 14:35:30 +01:00
1 parent 562c65f331
commit 4184acdb8a
60 files changed
+28840 -398

No files matched your search

@@ -3,8 +3,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Models\OddsPoint;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _Points
{
@@ -20,18 +20,27 @@ class _Points
return;
}
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['updated_at'] = now();
DB::table('odds_points')->upsert(
$odds,
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
['event_id', 'bookmaker_id', 'handicap'],
$res = OddsPoint::where('event_id', $odds['event_id'])
->where('bookmaker_id', $odds['bookmaker_id'])
->where('handicap', $odds['handicap'])
->first();
['home', 'away', 'difference', 'margin', 'flags', 'updated_at']
);
if (! $res) {
OddsPoint::create($odds);
} else {
$res->home = $odds['home'];
$res->away = $odds['away'];
if ($res->isDirty()) {
$res->oddchange_at = now();
}
$res->checked_at = $odds['checked_at'];
$res->margin = $odds['margin'];
$res->save();
}
ActiveSpread::collect($odds, 'odds_points');
}