grapper wip
This commit is contained in:
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\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class _Totals
|
||||
{
|
||||
@@ -26,18 +26,27 @@ class _Totals
|
||||
}
|
||||
}
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$odds['updated_at'] = now();
|
||||
|
||||
DB::table('odds_totals')->upsert(
|
||||
$odds,
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
|
||||
['event_id', 'bookmaker_id', 'total'],
|
||||
$res = OddsTotal::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
['over', 'under', 'difference', 'margin', 'flags', 'updated_at']
|
||||
|
||||
);
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = $odds['checked_at'];
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user