oddchange_at wip
This commit is contained in:
1 parent
4480ba7fee
commit
562c65f331
47 files changed
+295
-213
No files matched your search
@@ -23,6 +23,7 @@ use App\Models\CompetitionGroup;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Group;
|
||||
use App\Models\Supervisor;
|
||||
use App\Models\TxoddsMarket;
|
||||
@@ -197,12 +198,13 @@ class Odds
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$event_id = (int) $row['id'];
|
||||
$sport_id = (int) $row->group['spid'];
|
||||
|
||||
$event = [
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(),
|
||||
'sport_id' => (int) $row->group['spid'],
|
||||
'starttime' => $row->time,
|
||||
'sport_id' => $sport_id,
|
||||
'home_id' => (int) $row->hteam['id'],
|
||||
'away_id' => (int) $row->ateam['id'],
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
@@ -214,14 +216,14 @@ class Odds
|
||||
|
||||
$group = [
|
||||
'competition_group_id' => (string) $row->group['cgid'],
|
||||
'sport_id' => (int) $row->group['spid'],
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
'name' => (string) $row->group,
|
||||
];
|
||||
Group::updateOrCreate(['id' => (int) $row->group['id']], $group);
|
||||
|
||||
$compgroup = [
|
||||
'sport_id' => $event['sport_id'],
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => $event['country_id'],
|
||||
'name' => (string) $row->group['cname'],
|
||||
];
|
||||
@@ -230,7 +232,7 @@ class Odds
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->hteam,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
|
||||
@@ -242,7 +244,7 @@ class Odds
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->ateam,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
|
||||
@@ -256,14 +258,13 @@ class Odds
|
||||
|
||||
foreach ($row->bookmaker as $book) {
|
||||
|
||||
Nuh::$id = (int) $row['id'];
|
||||
|
||||
Nuh::$bookmaker_id = (int) $book['bid'];
|
||||
$bookmaker_id = (int) $book['bid'];
|
||||
|
||||
$odds = [];
|
||||
$odds['sport_id'] = (int) $event['sport_id'];
|
||||
$odds['event_id'] = $event_id;
|
||||
$odds['bookmaker_id'] = $bookmaker_id;
|
||||
$odds['sport_id'] = $sport_id;
|
||||
$odds['provider_id'] = Nuh::$options['provider_id'];
|
||||
$odds['nuh_check'] = 0;
|
||||
|
||||
foreach ($book->offer as $offer) {
|
||||
|
||||
@@ -280,62 +281,95 @@ class Odds
|
||||
case 'bmoid':
|
||||
$odds['bmoid'] = (string) $attributeValue;
|
||||
break;
|
||||
case 'flag':
|
||||
$odds['flag'] = (string) $attributeValue;
|
||||
case 'flags':
|
||||
$odds['flags'] = (string) $attributeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($bettypeid) {
|
||||
case 0:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
EventBookmaker::updateOrInsert([
|
||||
'event_id' => $event_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['starttime' => $attributeValue]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_3Way::grap($odds, $offer);
|
||||
break;
|
||||
case 1:
|
||||
_2Way::grap($odds, $offer);
|
||||
break;
|
||||
case 3:
|
||||
_Points::grap($odds, $offer);
|
||||
break;
|
||||
case 4:
|
||||
_Totals::grap($odds, $offer);
|
||||
break;
|
||||
// case 1:
|
||||
// foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
// switch ($attributeName) {
|
||||
// case 'starting_time':
|
||||
// EventBookmaker::updateOrInsert([
|
||||
// 'event_id' => Nuh::$id,
|
||||
// 'bookmaker_id' => Nuh::$bookmaker_id,
|
||||
// ], ['starttime' => $attributeValue]);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
case 131073:
|
||||
_2WayS1::grap($odds, $offer);
|
||||
break;
|
||||
// _2Way::grap($odds, $offer);
|
||||
// break;
|
||||
// case 3:
|
||||
// foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
// switch ($attributeName) {
|
||||
// case 'starting_time':
|
||||
// EventBookmaker::updateOrInsert([
|
||||
// 'event_id' => Nuh::$id,
|
||||
// 'bookmaker_id' => Nuh::$bookmaker_id,
|
||||
// ], ['starttime' => $attributeValue]);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
case 65536:
|
||||
_3WayHt::grap($odds, $offer);
|
||||
break;
|
||||
case 65540:
|
||||
_TotalsHt::grap($odds, $offer);
|
||||
break;
|
||||
case 65539:
|
||||
_PointsHt::grap($odds, $offer);
|
||||
break;
|
||||
// _Points::grap($odds, $offer);
|
||||
// break;
|
||||
// case 4:
|
||||
// _Totals::grap($odds, $offer);
|
||||
// break;
|
||||
|
||||
case 131075:
|
||||
_PointsQ1::grap($odds, $offer);
|
||||
break;
|
||||
case 131076:
|
||||
_TotalsQ1::grap($odds, $offer);
|
||||
break;
|
||||
// case 131073:
|
||||
// _2WayS1::grap($odds, $offer);
|
||||
// break;
|
||||
|
||||
case 5242880:
|
||||
_Dc::grap($odds, $offer);
|
||||
break;
|
||||
case 6291457:
|
||||
_Dnb::grap($odds, $offer);
|
||||
break;
|
||||
case 11534337:
|
||||
_Ggng::grap($odds, $offer);
|
||||
break;
|
||||
case 7340033:
|
||||
_Tq::grap($odds, $offer);
|
||||
break;
|
||||
// case 65536:
|
||||
// _3WayHt::grap($odds, $offer);
|
||||
// break;
|
||||
// case 65540:
|
||||
// _TotalsHt::grap($odds, $offer);
|
||||
// break;
|
||||
// case 65539:
|
||||
// _PointsHt::grap($odds, $offer);
|
||||
// break;
|
||||
|
||||
// case 131075:
|
||||
// _PointsQ1::grap($odds, $offer);
|
||||
// break;
|
||||
// case 131076:
|
||||
// _TotalsQ1::grap($odds, $offer);
|
||||
// break;
|
||||
|
||||
// case 5242880:
|
||||
// _Dc::grap($odds, $offer);
|
||||
// break;
|
||||
// case 6291457:
|
||||
// _Dnb::grap($odds, $offer);
|
||||
// break;
|
||||
// case 11534337:
|
||||
// _Ggng::grap($odds, $offer);
|
||||
// break;
|
||||
// case 7340033:
|
||||
// _Tq::grap($odds, $offer);
|
||||
// break;
|
||||
|
||||
default:
|
||||
Notice::note('ERROR Bettype ID not set: '.$bettypeid, 'r');
|
||||
Notice::note('switch bettype ID not found: '.$bettypeid, 'r');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user