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

@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -13,14 +12,16 @@ class _2Way
foreach ($offer as $value) {
$odds['h2w'] = (float) $value->o1;
$odds['a2w'] = (float) $value->o3;
$odds['starttime'] = (string) $value['starttime'];
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
$odds['updated_at'] = now();
DB::table('odds_2ways')->upsert(
$odds,
DB::table('odds_2ways')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['h2w', 'a2w', 'margin', 'flags', 'updated_at']
);
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -16,10 +15,13 @@ class _2WayS1
}
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
$odds['updated_at'] = now();
DB::table('odds_2ways_s1')->upsert(
$odds,
DB::table('odds_2ways_s1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['h2w', 'a2w', 'margin', 'flags', 'updated_at']
);
}
}
@@ -2,9 +2,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _3Way
{
@@ -14,14 +13,18 @@ class _3Way
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
$odds['starttime'] = (string) $value['starttime'];
$odds['a3w'] = (float) 1.1;
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
$odds['updated_at'] = now();
DB::table('odds_3ways')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
$res = Odds3way::updateOrCreate(
['event_id' => $odds['event_id'], 'bookmaker_id' => $odds['bookmaker_id']],
$odds,
);
if ($res->wasChanged('h3w', 'd3w', 'h3w')) {
$res = Odds3way::updateOrCreate(
['event_id' => $odds['event_id'], 'bookmaker_id' => $odds['bookmaker_id']],
['oddchange_at' => now()],
);
}
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -17,10 +16,13 @@ class _3WayHt
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
$odds['updated_at'] = now();
DB::table('odds_3ways_ht')->upsert(
$odds,
DB::table('odds_3ways_ht')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['h3w', 'd3w', 'a3w', 'margin', 'flags', 'updated_at']
);
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -17,10 +16,13 @@ class _Dc
}
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dcx2']], 1);
$odds['updated_at'] = now();
DB::table('odds_dc')->upsert(
$odds,
DB::table('odds_dc')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['dc1x', 'dc12', 'dcx2', 'margin', 'flags', 'updated_at']
);
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -16,10 +15,13 @@ class _Dnb
}
$odds['margin'] = (float) Margin::calculate([$odds['dnb1'], $odds['dnb2']], 1);
$odds['updated_at'] = now();
DB::table('odds_dnb')->upsert(
$odds,
DB::table('odds_dnb')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['dnb1', 'dnb2', 'margin', 'flags', 'updated_at']
);
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -16,10 +15,13 @@ class _Ggng
}
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
$odds['updated_at'] = now();
DB::table('odds_ggng')->upsert(
$odds,
DB::table('odds_ggng')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['gg', 'ng', 'margin', 'flags', 'updated_at']
);
}
}
@@ -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;
@@ -25,12 +24,15 @@ class _Points
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['updated_at'] = now();
ActiveSpread::collect($odds, 'odds_points');
DB::table('odds_points')->upsert(
$odds,
DB::table('odds_points')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
], $odds);
['event_id', 'bookmaker_id', 'handicap'],
['home', 'away', 'difference', 'margin', 'flags', 'updated_at']
);
ActiveSpread::collect($odds, 'odds_points');
}
}
@@ -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;
@@ -25,12 +24,15 @@ class _PointsHt
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['updated_at'] = now();
ActiveSpread::collect($odds, 'odds_points_ht');
DB::table('odds_points_ht')->upsert(
$odds,
DB::table('odds_points_ht')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
], $odds);
['event_id', 'bookmaker_id', 'handicap'],
['home', 'away', 'difference', 'margin', 'flags', 'updated_at']
);
ActiveSpread::collect($odds, 'odds_points_ht');
}
}
@@ -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;
@@ -25,12 +24,15 @@ class _PointsQ1
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
$odds['updated_at'] = now();
ActiveSpread::collect($odds, 'odds_points_q1');
DB::table('odds_points_q1')->upsert(
$odds,
DB::table('odds_points_q1')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
'handicap' => $odds['handicap'],
], $odds);
['event_id', 'bookmaker_id', 'handicap'],
['home', 'away', 'difference', 'margin', 'flags', 'updated_at']
);
ActiveSpread::collect($odds, 'odds_points_q1');
}
}
@@ -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;
@@ -31,12 +30,15 @@ class _Totals
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
$odds['updated_at'] = now();
ActiveSpread::collect($odds, 'odds_totals');
DB::table('odds_totals')->upsert(
$odds,
DB::table('odds_totals')->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');
}
}
@@ -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 _TotalsHt
$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_ht');
DB::table('odds_totals_ht')->upsert(
$odds,
DB::table('odds_totals_ht')->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_ht');
}
}
@@ -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');
}
}
@@ -2,7 +2,6 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
@@ -16,10 +15,13 @@ class _Tq
}
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
$odds['updated_at'] = now();
DB::table('odds_tq')->upsert(
$odds,
DB::table('odds_tq')->updateOrInsert([
'event_id' => Nuh::$id,
'bookmaker_id' => Nuh::$bookmaker_id,
], $odds);
['event_id', 'bookmaker_id'],
['htq', 'atq', 'margin', 'flags', 'updated_at']
);
}
}