grapper wip
This commit is contained in:
1 parent
562c65f331
commit
4184acdb8a
60 files changed
+28840
-398
No files matched your search
@@ -3,6 +3,8 @@
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\PrinzipalHandicap;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
|
||||
class Basketball
|
||||
{
|
||||
@@ -45,35 +47,37 @@ class Basketball
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'B_OUN':
|
||||
$n_totals[$name] = $value;
|
||||
$n_totals[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_1QOU':
|
||||
$n_totals_qt[$name] = $value;
|
||||
$n_totals_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_H':
|
||||
$n_points[$name] = $value;
|
||||
$n_points[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_1QH':
|
||||
$n_points_qt[$name] = $value;
|
||||
$n_points_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'B_OUHND':
|
||||
$c_totals[$name] = $value;
|
||||
$c_totals[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_OUHND1P':
|
||||
$c_totals_qt[$name] = $value;
|
||||
$c_totals_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_12HND':
|
||||
$c_points[$name] = $value;
|
||||
$c_points[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_12HND1P':
|
||||
$c_points_qt[$name] = $value;
|
||||
$c_points_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dd($n_totals);
|
||||
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'B_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
@@ -101,5 +105,32 @@ class Basketball
|
||||
if ($n_points_qt) {
|
||||
PrinzipalHandicap::filter($_spreads['point_qt'], 'B_1QH@', $n_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
dd($n_totals);
|
||||
|
||||
if (\count($n_totals) == 2) {
|
||||
|
||||
$_total['margin'] = (float) Margin::calculate($n_totals, 1);
|
||||
|
||||
$_total = array_merge($_total, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $event['id'])
|
||||
->where('bookmaker_id', $event['bookmaker_id'])
|
||||
->where('total', $event['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($_total);
|
||||
} else {
|
||||
$res->over = number_format($_total['over'], 2);
|
||||
$res->under = number_format($_total['under'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_total['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\PrinzipalHandicap;
|
||||
|
||||
class Icehockey
|
||||
{
|
||||
public static function get(&$event, &$_spreads, $match)
|
||||
@@ -14,22 +16,22 @@ class Icehockey
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'IH_1X2_1':
|
||||
$event['h3w'] = (float) $value;
|
||||
$event['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_X':
|
||||
$event['d3w'] = (float) $value;
|
||||
$event['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_2':
|
||||
$event['a3w'] = (float) $value;
|
||||
$event['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'IH_12_1':
|
||||
case 'IH_12OTAP_1':
|
||||
$event['h2w'] = (float) $value;
|
||||
$event['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_12_2':
|
||||
case 'IH_12OTAP_2':
|
||||
$event['a2w'] = (float) $value;
|
||||
$event['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -59,18 +61,18 @@ class Icehockey
|
||||
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
Filter::prinz($_spreads['total'], 'IH_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'IH_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
Filter::prinz($_spreads['point'], 'IH_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'IH_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
Filter::prinz($_spreads['total'], 'IH_TF@', $n_totals, ['over', 'under', 'total']);
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'IH_TF@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
Filter::prinz($_spreads['point'], 'IH_HR1@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'IH_HR1@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,52 +23,54 @@ class Soccer
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'S_1X2_1':
|
||||
$_3way['h3w'] = (float) $value;
|
||||
$_3way['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_X':
|
||||
$_3way['d3w'] = (float) $value;
|
||||
$_3way['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_2':
|
||||
$_3way['a3w'] = (float) $value;
|
||||
$_3way['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_OU@2.5_O':
|
||||
$_total['over'] = (float) $value;
|
||||
$_total['over'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_OU@2.5_U':
|
||||
$_total['under'] = (float) $value;
|
||||
$_total['under'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_GGNG_Y':
|
||||
$_ggng['gg'] = (float) $value;
|
||||
$_ggng['gg'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_GGNG_N':
|
||||
$_ggng['ng'] = (float) $value;
|
||||
$_ggng['ng'] = number_format($value, 2);
|
||||
break;
|
||||
// case 'S_DNB_1':
|
||||
// break;
|
||||
// case 'S_DNB_2':
|
||||
// break;
|
||||
case 'S_DC_12':
|
||||
$_dc['dc12'] = (float) $value;
|
||||
$_dc['dc12'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_1X':
|
||||
$_dc['dc1x'] = (float) $value;
|
||||
$_dc['dc1x'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_X2':
|
||||
$_dc['dcx2'] = (float) $value;
|
||||
$_dc['dcx2'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_12QUALIFY_1':
|
||||
$_tq['htq'] = (float) $value;
|
||||
$_tq['htq'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_12QUALIFY_2':
|
||||
$_tq['atq'] = (float) $value;
|
||||
$_tq['atq'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event['id'];
|
||||
$base['bookmaker_id'] = $event['bookmaker_id'];
|
||||
$base['sport_id'] = $event['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event['event_id'];
|
||||
@@ -78,60 +80,121 @@ class Soccer
|
||||
if (\count($_3way) == 3) {
|
||||
|
||||
$_3way['margin'] = (float) Margin::calculate($_3way, 1);
|
||||
$_3way['starttime'] = $event['starttime'];
|
||||
|
||||
Odds3way::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => $event['bookmaker_id'],
|
||||
], $base + $_3way);
|
||||
$_3way = array_merge($_3way, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($_3way);
|
||||
} else {
|
||||
$res->h3w = number_format($_3way['h3w'], 2);
|
||||
$res->a3w = number_format($_3way['d3w'], 2);
|
||||
$res->d3w = number_format($_3way['a3w'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->flag = 1;
|
||||
$res->margin = $_3way['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
// OU
|
||||
if (\count($_total) == 2) {
|
||||
|
||||
$_total['margin'] = (float) Margin::calculate($_total, 1);
|
||||
$_total['total'] = 2.5;
|
||||
$_total['starttime'] = $event['starttime'];
|
||||
$_total['active_spread'] = 1;
|
||||
|
||||
OddsTotal::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => $event['bookmaker_id'],
|
||||
], $base + $_total);
|
||||
$_total = array_merge($_total, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $event['id'])
|
||||
->where('bookmaker_id', $event['bookmaker_id'])
|
||||
->where('total', $event['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($_total);
|
||||
} else {
|
||||
$res->over = number_format($_total['over'], 2);
|
||||
$res->under = number_format($_total['under'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_total['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
// GG NG
|
||||
if (\count($_ggng) == 2) {
|
||||
|
||||
$_ggng['margin'] = (float) Margin::calculate($_ggng, 1);
|
||||
$_ggng['starttime'] = $event['starttime'];
|
||||
|
||||
OddsGgng::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => $event['bookmaker_id'],
|
||||
], $base + $_ggng);
|
||||
$_ggng = array_merge($_ggng, $base);
|
||||
|
||||
$res = OddsGgng::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($_ggng);
|
||||
} else {
|
||||
$res->gg = number_format($_ggng['gg'], 2);
|
||||
$res->ng = number_format($_ggng['ng'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_ggng['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
|
||||
// DC
|
||||
if (\count($_dc) == 3) {
|
||||
|
||||
$_dc['margin'] = (float) Margin::calculate($_dc, 1);
|
||||
$_dc['starttime'] = $event['starttime'];
|
||||
|
||||
OddsDc::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => $event['bookmaker_id'],
|
||||
], $base + $_dc);
|
||||
$_dc = array_merge($_dc, $base);
|
||||
|
||||
$res = OddsDc::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($_dc);
|
||||
} else {
|
||||
$res->dc1x = number_format($_dc['dc1x'], 2);
|
||||
$res->dc12 = number_format($_dc['dc12'], 2);
|
||||
$res->dcx2 = number_format($_dc['dcx2'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_dc['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
|
||||
// TQ
|
||||
if (\count($_tq) == 2) {
|
||||
|
||||
$_tq['margin'] = (float) Margin::calculate($_tq, 1);
|
||||
$_tq['starttime'] = $event['starttime'];
|
||||
|
||||
OddsTq::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => $event['bookmaker_id'],
|
||||
], $base + $_tq);
|
||||
$_tq = array_merge($_dc, $base);
|
||||
|
||||
$res = OddsTq::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($_dc);
|
||||
} else {
|
||||
$res->htq = number_format($_tq['htq'], 2);
|
||||
$res->atq = number_format($_tq['atq'], 2);
|
||||
if ($res->isDirty()) {
|
||||
$res->oddchange_at = now();
|
||||
}
|
||||
$res->checked_at = now();
|
||||
$res->margin = $_tq['margin'];
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\PrinzipalHandicap;
|
||||
|
||||
class Tennis
|
||||
{
|
||||
public static function get(&$event, &$_spreads, $match)
|
||||
@@ -14,17 +16,17 @@ class Tennis
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'T_12_1':
|
||||
$event['h2w'] = (float) $value;
|
||||
$event['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_12_2':
|
||||
$event['a2w'] = (float) $value;
|
||||
$event['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'T_121P_1':
|
||||
$_spreads['mlset1']['h2w'] = (float) $value;
|
||||
$_spreads['mlset1']['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_121P_2':
|
||||
$_spreads['mlset1']['a2w'] = (float) $value;
|
||||
$_spreads['mlset1']['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,18 +56,18 @@ class Tennis
|
||||
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
Filter::prinz($_spreads['total'], 'T_OUG@', $c_totals, ['over', 'under', 'total']);
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'T_OUG@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
Filter::prinz($_spreads['point'], 'T_HNDGAMES@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'T_HNDGAMES@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
Filter::prinz($_spreads['total'], 'T_OUG@', $n_totals, ['over', 'under', 'total']);
|
||||
PrinzipalHandicap::filter($_spreads['total'], 'T_OUG@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
Filter::prinz($_spreads['point'], 'T_GH@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
PrinzipalHandicap::filter($_spreads['point'], 'T_GH@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user