private void GetLiveData() { var list = MainService.SboEngineObj.ProcessUpdateLiveData(); dataGridView1.DataSource = MainService.SboEngineObj.LiveMatchOddDatas; //Test Check da update if (list.Count() > 0) { foreach (var item in list) { MatchOddDTO oldOdd = MainService.SboEngineObj.LiveMatchOddDatas.FirstOrDefault(x => x.OddID == item.OddID); if (oldOdd != null) { string re = DateTime.Now.ToString() + "-- Tran: " + oldOdd.HomeTeamName + " : " + oldOdd.Odd + " -Update to : Home: " + oldOdd.HomeOdd.ToString() + " - Away: " + oldOdd.AwayOdd.ToString() + " \r"; re += "From : Home: " + item.HomeOdd.ToString() + " - Away: " + item.AwayOdd.ToString() + " \r"; re += "-------------\r"; richTextBox1.BeginInvoke( (Action)(() => { richTextBox1.AppendText(Environment.NewLine + re); })); } } } }
public bool IsValidPick(MatchOddDTO sboMatchOdd, eBetType betType) { if (sboMatchOdd.OddType == eOddType.HCP || sboMatchOdd.OddType == eOddType.HalfHCP) { if (sboMatchOdd.Odd.Equals(0)) { return(true); } if (sboMatchOdd.Odd > 0) { if (betType == eBetType.Home) { return(RealConfig.PickSboHdpBot); } return(RealConfig.PickSboHdpTop); } else //if (sboMatchOdd.Odd < 0) { if (betType == eBetType.Home) { return(RealConfig.PickSboHdpTop); } return(RealConfig.PickSboHdpBot); } } else { if (betType == eBetType.Home) { return(RealConfig.PickSboOver); } return(RealConfig.PickSboUnder); } }
public MatchOddDTO GetSboMatch(MatchOddDTO sboMatchCompare, bool isLive) { MatchOddDTO sboMatchSource; if (isLive) { lock (SboEngine.LockLive) { sboMatchSource = SboEngine.LiveMatchOddDatas.FirstOrDefault(m => (String.Equals(m.HomeTeamName, sboMatchCompare.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sboMatchCompare.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && m.Odd.Equals(sboMatchCompare.Odd) && m.OddType == sboMatchCompare.OddType); } } else { lock (SboEngine.LockNonLive) { sboMatchSource = SboEngine.NoneLiveMatchOddDatas.FirstOrDefault(m => (String.Equals(m.HomeTeamName, sboMatchCompare.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sboMatchCompare.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && m.Odd.Equals(sboMatchCompare.Odd) && m.OddType == sboMatchCompare.OddType); } } return(sboMatchSource); }
private void FireLogScan(MatchOddDTO matchOdd1, MatchOddDTO matchOdd2) { Task.Run(() => { if (OnLogScanEvent != null) { var msg = new LogScanMessage() { Time = DateTime.Now.ToString("HH:mm:ss.fff"), HomeTeamName = matchOdd1.HomeTeamName, AwayTeamName = matchOdd1.AwayTeamName, OddType = matchOdd1.OddType, FirstServerType = matchOdd1.ServerType, FirstHomeOdd = matchOdd1.HomeOdd, FirstAwayOdd = matchOdd1.AwayOdd, SecondServerType = matchOdd2.ServerType, SecondHomeOdd = matchOdd2.HomeOdd, SecondAwayOdd = matchOdd2.AwayOdd }; OnLogScanEvent(msg); } }); }
public MatchOddDTO GetSboMatch(MatchOddDTO sboMatchCompare, bool isLive) { MatchOddDTO sboMatchSource; if (isLive) { lock (SboEngine.LockLive) { sboMatchSource = SboEngine.LiveMatchOddDatas.FirstOrDefault(m => m.MatchID == sboMatchCompare.MatchID && m.Odd.Equals(sboMatchCompare.Odd) && m.OddType == sboMatchCompare.OddType); } } else { lock (SboEngine.LockNonLive) { sboMatchSource = SboEngine.NoneLiveMatchOddDatas.FirstOrDefault(m => m.MatchID == sboMatchCompare.MatchID && m.Odd.Equals(sboMatchCompare.Odd) && m.OddType == sboMatchCompare.OddType); } } return(sboMatchSource); }
private MatchOddDTO GetValidSboMatchOdd(MatchOddDTO sboMatchOdd, bool fromScan) { MatchOddDTO sboMatch; if (fromScan) { lock (SboEnScan.LockLive) { sboMatch = SboEnScan.LiveMatchOddDatas.FirstOrDefault(m => (String.Equals(m.HomeTeamName, sboMatchOdd.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sboMatchOdd.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && m.Odd.Equals(sboMatchOdd.Odd) && m.OddType == sboMatchOdd.OddType); } } else { lock (SboEn.LockLive) { sboMatch = SboEn.LiveMatchOddDatas.FirstOrDefault(m => (String.Equals(m.HomeTeamName, sboMatchOdd.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sboMatchOdd.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && m.Odd.Equals(sboMatchOdd.Odd) && m.OddType == sboMatchOdd.OddType); } } return(sboMatch); }
private bool BetAgainstIbetRequest(PrepareBetDTO oldIbetPrepare, MatchOddDTO ibetMatchOdd, eBetType ibetBetType, bool isLive, float sboMatchOdd, int ibetStake) { var againstIbetPrepare = CallPrepareBet(ibetMatchOdd, GetAgainstBetType(ibetBetType), isLive, sboMatchOdd); if (againstIbetPrepare.IsRunning) { //if (againstIbetPrepare.HasScore) //{ if (againstIbetPrepare.HomeScore == oldIbetPrepare.HomeScore && againstIbetPrepare.AwayScore == oldIbetPrepare.AwayScore) { if (CallConfirmBet(againstIbetPrepare, ibetStake, oldIbetPrepare.OddDef, isLive, true)) { LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(oldIbetPrepare.MatchOdd.ServerType, oldIbetPrepare.MatchOdd.MatchID, IbetBetPool, ibetStake * 2)); return(true); } } //} Logger.Info("BET MGUOC IBET FAIL....TY SO THAY DOI...."); } return(false); }
public void FireLogBet(MatchOddDTO match, eBetType betType, int stake, eBetStatusType betStatus, eServerScan serverScan) { var msg = new LogBetMessage() { Time = DateTime.Now.ToString("HH:mm:ss.fff"), HomeTeamName = match.HomeTeamName, AwayTeamName = match.AwayTeamName, OddType = match.OddType, ServerType = match.ServerType, OddValues = match.HomeOdd + "|" + match.AwayOdd, Odd = match.Odd, BetStake = stake, BetType = betType, Status = betStatus, EngineName = this.EngineName, TabCode = TabCode, ServerScan = serverScan }; Task.Run(() => { DataContainer.LogBetQueue.Enqueue(msg); DataContainer.LogBetResetEvent.Set(); }); }
private bool BetAgainstIbetRequest(PrepareBetDTO oldIbetPrepare, MatchOddDTO ibetMatchOddSource, eBetType ibetBetType, bool isLive, float sboMatchOdd, int ibetStake, bool hasGetAgain) { MatchOddDTO ibetMatchOdd; if (hasGetAgain) { Thread.Sleep(60000); lock (IbetEngine.LockLive) { ibetMatchOdd = IbetEngine.LiveMatchOddDatas.FirstOrDefault(l => l.MatchID == ibetMatchOddSource.MatchID && l.Odd.Equals(ibetMatchOddSource.Odd) && l.OddType == ibetMatchOddSource.OddType); } if (ibetMatchOdd == null) { return(false); } } else { ibetMatchOdd = ibetMatchOddSource; } var againstIbetPrepare = CallPrepareIbet(ibetMatchOdd, GetAgainstBetType(ibetBetType), isLive, sboMatchOdd); if (againstIbetPrepare.IsRunning) { //if (againstIbetPrepare.HasScore) //{ if (againstIbetPrepare.HomeScore == oldIbetPrepare.HomeScore && againstIbetPrepare.AwayScore == oldIbetPrepare.AwayScore) { string ibetConfirmMsg; if (CallConfirmBet(againstIbetPrepare, ibetStake, oldIbetPrepare.OddDef, out ibetConfirmMsg, isLive, true)) { LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(oldIbetPrepare.MatchOdd.ServerType, oldIbetPrepare.MatchOdd.MatchID, IbetBetPool, ibetStake * 2)); return(true); } } //} Logger.Info("BET MGUOC IBET FAIL....TY SO THAY DOI...."); } return(false); }
private PrepareBetDTO CallPrepareBet(MatchOddDTO matchOdd, eBetType betType, bool isLive, float oddDef) { switch (matchOdd.ServerType) { //case eServerType.Ibet: // return PiEngine.PrepareBet(matchOdd, betType, isLive, oddDef); case eServerType.Sbo: return(SboEngine.PrepareBet(matchOdd, betType, isLive, oddDef)); default: throw new Exception("CallPrepareBet => FAIL : Unknow matchOdd->eServerType param"); } }
private bool HasGoodMatchOdd(List <MatchOddDTO> matchOddSource, out MatchOddDTO matchOdd, out eBetType buyType) { matchOdd = null; buyType = eBetType.Unknown; var count = matchOddSource.Count; for (int i = 1; i <= count; i++) { var matchOddCheck = matchOddSource[count - i]; OddDTO ibetOdd; if (GetValidIbetMatchOdd(matchOddCheck, out ibetOdd) && matchOddCheck.AbsOdd >= GoalDefCheck) { float checkOddDef = 1; if (matchOddCheck.HomeOdd > 0 && matchOddCheck.AwayOdd > 0) { checkOddDef = (1 - matchOddCheck.HomeOdd) + (1 - matchOddCheck.AwayOdd); } else { checkOddDef = Math.Abs(matchOddCheck.HomeOdd + matchOddCheck.AwayOdd); } //so sanh nho hon hoac = 10 xu if (checkOddDef <= OddDevCheck) { buyType = matchOddCheck.Odd > 0 ? eBetType.Away : eBetType.Home; //so sanh keo tren thap nhat la 0.70 bool validHighOdd; if (buyType == eBetType.Home) { validHighOdd = Math.Abs(matchOddCheck.AwayOdd) >= 0.7; } else { validHighOdd = Math.Abs(matchOddCheck.HomeOdd) >= 0.7; } if (validHighOdd) { matchOdd = matchOddCheck; return(true); } } } } return(false); }
public void ProcessPrepareBet(MatchOddDTO ibetMatchOdd, eBetType ibetBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive) { try { if (MaxCountBet == 0 || CountBet <= MaxCountBet) { var taskPrepareBetIbet = Task.Run(() => CallPrepareBet(ibetMatchOdd, ibetBetType, isLive)); var taskPrepareBetSbo = Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive)); if (taskPrepareBetIbet.Result != null && taskPrepareBetSbo.Result != null && !taskPrepareBetIbet.Result.HasChangeOdd && !taskPrepareBetSbo.Result.HasChangeOdd) { if (LastBetTime.AddSeconds(TimeOffStakeOdds) <= DateTime.Now) { int ibetStake; int sboStake; if (CaculateStake(BetStakeType, taskPrepareBetIbet.Result.MatchOdd.MatchID, taskPrepareBetIbet.Result.MinBet, taskPrepareBetIbet.Result.MaxBet, taskPrepareBetSbo.Result.MatchOdd.MatchID, taskPrepareBetSbo.Result.MinBet, taskPrepareBetSbo.Result.MaxBet, out ibetStake, out sboStake)) { if (CallConfirmBet(taskPrepareBetIbet.Result, ibetStake)) { if (CallConfirmBet(taskPrepareBetSbo.Result, sboStake)) { Task.Run( () => UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType, taskPrepareBetSbo.Result.MatchOdd.MatchID, SboBetPool, sboStake)); Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); LastBetTime = DateTime.Now; CountBet++; } Task.Run( () => UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType, taskPrepareBetIbet.Result.MatchOdd.MatchID, IbetBetPool, ibetStake)); } } } } } } catch (Exception ex) { Logger.Error(ex); throw; } }
public void ProcessPrepareBet(MatchOddDTO ibetMatchOdd, eBetType ibetBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive) { Task.Run(() => { Logger.InfoFormat( "===============================GOOD COMPARE (Live: {0})===============================", isLive); Logger.InfoFormat( "Pick IBET: {0} - Home Name: {1} , Away Name: {2} , Leangue Name: {3} , Home Odd: {4}, Away Odd: {5}, Odd Type: {6}, Odd Value: {7}" , ibetBetType, ibetMatchOdd.HomeTeamName, ibetMatchOdd.AwayTeamName, ibetMatchOdd.LeagueName, ibetMatchOdd.HomeOdd, ibetMatchOdd.AwayOdd, ibetMatchOdd.OddType, ibetMatchOdd.Odd); Logger.InfoFormat( "Pick SBO: {0} - Home Name: {1} , Away Name: {2} , Leangue Name: {3} , Home Odd: {4}, Away Odd: {5}, Odd Type: {6}, Odd Value: {7}" , sboBetType, sboMatchOdd.HomeTeamName, sboMatchOdd.AwayTeamName, sboMatchOdd.LeagueName, sboMatchOdd.HomeOdd, sboMatchOdd.AwayOdd, sboMatchOdd.OddType, sboMatchOdd.Odd); }); if (CountTest <= 90000) { try { var taskPrepareBetIbet = Task.Run(() => CallPrepareBet(ibetMatchOdd, ibetBetType, isLive)); var taskPrepareBetSbo = Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive)); //Logger.InfoFormat("Home type {0}, Max bet {1}, Min bet {2}", // taskPrepareBetHome.Result.MatchOdd.ServerType, taskPrepareBetHome.Result.MaxBet, taskPrepareBetHome.Result.MinBet); //Logger.InfoFormat("Away type {0}, Away bet {1}, Away bet {2}", // taskPrepareBetAway.Result.MatchOdd.ServerType, taskPrepareBetAway.Result.MaxBet, taskPrepareBetAway.Result.MinBet); if (taskPrepareBetIbet.Result != null && taskPrepareBetSbo.Result != null && !taskPrepareBetIbet.Result.HasChangeOdd && !taskPrepareBetSbo.Result.HasChangeOdd) { Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); //if (LastBetTime.AddSeconds(20) <= DateTime.Now) //{ // Task.Run(() => CallConfirmBet(taskPrepareBetIbet.Result)); // Task.Run(() => CallConfirmBet(taskPrepareBetSbo.Result)); // Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); // LastBetTime = DateTime.Now; // CountTest++; //} } } catch (Exception ex) { Logger.Error(ex); throw; } } }
void ServerCallback_OnTransaction(DateTime time, TransactionDTO transaction, string oddIdCheck, float oddCheck) { try { if (Status == eServiceStatus.Started) { if ((transaction.IsLive && ScanType == eScanType.NonLive) || (!transaction.IsLive && ScanType == eScanType.Live)) { return; } if (!IsValidTime(transaction.IbetMatchOdd.TimeType, transaction.IbetMatchOdd.Minutes, transaction.IbetMatchOdd.OddType)) { return; } if ((transaction.IbetBetType == eBetType.Home && (Math.Abs(transaction.IbetMatchOdd.HomeOdd) < MinOddDefBet || Math.Abs(transaction.SboMatchOdd.AwayOdd) < MinOddDefBet)) || (transaction.IbetBetType == eBetType.Away && (Math.Abs(transaction.IbetMatchOdd.AwayOdd) < MinOddDefBet || Math.Abs(transaction.SboMatchOdd.HomeOdd) < MinOddDefBet))) { return; } MatchOddDTO sboMatchSource = GetSboMatch(transaction.SboMatchOdd, transaction.IsLive); if (sboMatchSource != null) { Task.Run(() => OnPingEvent(time, eServerType.Ibet)); sboMatchSource.HomeOdd = transaction.SboMatchOdd.HomeOdd; sboMatchSource.AwayOdd = transaction.SboMatchOdd.AwayOdd; ProcessPrepareBet(transaction.IbetMatchOdd, transaction.IbetBetType, sboMatchSource, transaction.SboBetType, transaction.IsLive, eServerScan.Server); } } } catch (Exception ex) { Logger.Error(ProcessorName, ex); } }
private PrepareBetDTO CallPrepareBet(MatchOddDTO matchOdd, eBetType betType, bool isLive) { switch (matchOdd.ServerType) { case eServerType.Ibet: return(IbetEngine.PrepareBet(matchOdd, betType, isLive)); break; case eServerType.Sbo: return(SboEngine.PrepareBet(matchOdd, betType, isLive)); break; default: throw new Exception("CallPrepareBet => FAIL : Unknow matchOdd->eServerType param"); break; } }
private void FireLogScan(MatchOddDTO ibetMatchOddDto, MatchOddDTO sboMatchOddDto) { var msg = new LogScanMessage() { ProcessorName = this.ProcessorName, Time = DateTime.Now.ToString("HH:mm:ss.fff"), HomeTeamName = ibetMatchOddDto.HomeTeamName, AwayTeamName = ibetMatchOddDto.AwayTeamName, OddType = ibetMatchOddDto.OddType, Odd = ibetMatchOddDto.Odd, FirstOddValues = ibetMatchOddDto.HomeOdd + " | " + ibetMatchOddDto.AwayOdd, SecondOddValues = sboMatchOddDto.HomeOdd + " | " + sboMatchOddDto.AwayOdd }; Task.Run(() => { DataContainer.LogScanQueue.Enqueue(msg); DataContainer.LogScanResetEvent.Set(); }); }
//// compare from sbo (dataUpdated) to IBET (targetSource) public void CompareOdd(List <MatchOddDTO> dataUpdated, List <MatchOddDTO> targetSource, bool isLive) { foreach (var data in dataUpdated) { if (!DataContainer.LeaguesDenyKeywords.Any(data.LeagueName.ToUpper().Contains) && (!DataContainer.MatchsDenyKeywords.Any(data.HomeTeamName.ToUpper().Contains) || !DataContainer.MatchsDenyKeywords.Any(data.AwayTeamName.ToUpper().Contains))) { MatchOddDTO matchTarget = targetSource.FirstOrDefault(m => (String.Equals(m.HomeTeamName, data.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, data.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && !DataContainer.LeaguesDenyKeywords.Any(m.LeagueName.ToUpper().Contains) && m.Odd == data.Odd && m.OddType == data.OddType); if (matchTarget != null) { if (!IsMaxStake(data.MatchID, SboBetPool, SboMaxStakeMatch) && !IsMaxStake(matchTarget.MatchID, IbetBetPool, IbetMaxStakeMatch)) { bool isValid1 = IsValidOddPair(data.HomeOdd, matchTarget.AwayOdd, CompareValueDifferent); if (isValid1) { //FireLogScan(data, matchTarget); ProcessPrepareBet(matchTarget, eBetType.Away, data, eBetType.Home, isLive); FireLogScan(data, matchTarget); break; } bool isValid2 = IsValidOddPair(data.AwayOdd, matchTarget.HomeOdd, CompareValueDifferent); if (isValid2) { ProcessPrepareBet(matchTarget, eBetType.Home, data, eBetType.Away, isLive); FireLogScan(data, matchTarget); break; } } } } } }
private bool GetValidIbetMatchOdd(MatchOddDTO sboMatchOdd, out OddDTO oddObj) { bool isValid = false; oddObj = null; var ibetMatch = IbetEn.LiveMatchOddBag.FirstOrDefault(m => !m.IsDeleted && (String.Equals(m.HomeTeamName, sboMatchOdd.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sboMatchOdd.AwayTeamName, StringComparison.CurrentCultureIgnoreCase))); if (ibetMatch != null) { var odd = ibetMatch.Odds.FirstOrDefault(o => !o.IsDeleted && o.OddType == sboMatchOdd.OddType && o.Odd.Equals(sboMatchOdd.Odd)); if (odd != null) { oddObj = odd; isValid = true; } } return(isValid); }
public bool ProcessPrepareBet(MatchPiDTO piMatchOdd, OddDTO piOdd, eBetType piBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive, eServerScan serverScan = eServerScan.Local) { if (isProcess) { return(false); } string oddCheck = sboMatchOdd.OddID + sboMatchOdd.HomeOdd + sboMatchOdd.AwayOdd + piOdd.HomeOdd + piOdd.AwayOdd; if (oddCheck.Equals(OddCheck)) { return(false); } OddCheck = oddCheck; try { isProcess = true; sboMatchOdd.OldOdd = sboBetType == eBetType.Home ? sboMatchOdd.HomeOdd : sboMatchOdd.AwayOdd; var prepareBetSbo = CallPrepareBet(sboMatchOdd, sboBetType, isLive, piOdd.PiOdd); if (prepareBetSbo == null) { return(false); } bool betAny; float piOddValue = piBetType == eBetType.Home ? piOdd.HomeOdd : piOdd.AwayOdd; bool isGood = IsGoodOddPair(piOddValue, prepareBetSbo.NewOdd, CompareValueDifferent, out betAny); if (isGood) { int piStake; int sboStake; if (CaculateStake(BetStakeType, piMatchOdd.MatchID, 150, (int)piOdd.max.Value, prepareBetSbo.MatchOdd.MatchID, prepareBetSbo.MinBet, prepareBetSbo.MaxBet, out piStake, out sboStake)) { var piConfirmBet = PiEngine.ConfirmBet(piStake, piMatchOdd, piOdd, piBetType); if (piConfirmBet) { if (SboEngine.ConfirmBet(sboStake, piOdd.PiOdd, isLive, serverScan, piMatchOdd.HomeTeamName, piMatchOdd.AwayTeamName)) { Task.Run( () => { UpdateBetPool( prepareBetSbo.MatchOdd.ServerType, prepareBetSbo.MatchOdd.MatchID, SboBetPool, sboStake); UpdateBetPool( eServerType.Pina, piMatchOdd.MatchID, PiBetPool, piStake); }); Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); CountBet++; LastBetTime = DateTime.Now; return(true); } else { if (BetAgainstIbet) { Logger.Info(ProcessorName + " DAT NGUOC PINA<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); var betTypeAgaint = GetAgainstBetType(piBetType); if (!PiEngine.TryConfirmBet(piStake, piMatchOdd, piOdd, betTypeAgaint)) { Thread.Sleep(15000); Logger.Info("CALL LAN 2 BET MGUOC PINA<<<<<<<<<<<<<<<<"); if (PiEngine.TryConfirmBet(piStake, piMatchOdd, piOdd, betTypeAgaint)) { isProcess = false; return(true); } else { Logger.Info("CALL LAN 3 BET MGUOC LAI PINA<<<<<<<<<<<<<<<<"); prepareBetSbo = CallPrepareBet(sboMatchOdd, sboBetType, isLive, piOdd.PiOdd); if (prepareBetSbo == null) { Logger.Fatal("CALL LAN 3 Prepare Sbo fail!!!!!"); Thread.Sleep(25000); if (PiEngine.TryConfirmBet(piStake, piMatchOdd, piOdd, betTypeAgaint)) { isProcess = false; return(true); } } else { if (!SboEngine.ConfirmBet(sboStake, piOdd.PiOdd, isLive, serverScan, piMatchOdd.HomeTeamName, piMatchOdd.AwayTeamName)) { Thread.Sleep(25000); if (PiEngine.TryConfirmBet(piStake, piMatchOdd, piOdd, betTypeAgaint)) { isProcess = false; return(true); } else { prepareBetSbo = CallPrepareBet(sboMatchOdd, sboBetType, isLive, piOdd.PiOdd); if (prepareBetSbo == null) { Logger.Fatal("CALL LAN 4 Prepare Sbo fail!!!!!"); Thread.Sleep(25000); PiEngine.TryConfirmBet(piStake, piMatchOdd, piOdd, betTypeAgaint); } else { SboEngine.ConfirmBet(sboStake, piOdd.PiOdd, isLive, serverScan, piMatchOdd.HomeTeamName, piMatchOdd.AwayTeamName); } } } else { isProcess = false; return(true); } } } } else { isProcess = false; return(true); } Logger.Info("BET MGUOC IBET FAIL...DAT NGUOC THAT BAI..."); } } LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(eServerType.Pina, piMatchOdd.MatchID, PiBetPool, piStake)); return(true); } FireLogScan(piMatchOdd, piOdd, sboMatchOdd, serverScan); } } else { FireLogScan(piMatchOdd, piOdd, sboMatchOdd, serverScan); } return(false); } catch (Exception ex) { Logger.Error(ProcessorName, ex); return(false); } finally { isProcess = false; } }
//private bool HasGoodMatchOdd(List<MatchOddDTO> matchOddSource, out MatchOddDTO matchOdd, out eBetType buyType, out eServerType serverBuy, out OddDTO ibetOdd) //{ // buyType = eBetType.Unknown; // serverBuy = eServerType.Unknown; // matchOdd = null; // ibetOdd = null; // if (!BuySbo & matchOddSource.Any()) // { // var sboMatchOdd = matchOddSource.First(); // var ibetMatch = IbetEn.LiveMatchOddBag.FirstOrDefault(m => // !m.IsDeleted && // (String.Equals(m.HomeTeamName, sboMatchOdd.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) // || // String.Equals(m.AwayTeamName, sboMatchOdd.AwayTeamName, StringComparison.CurrentCultureIgnoreCase))); // if (ibetMatch != null) // { // foreach (var oddDto in ibetMatch.Odds) // { // } // } // } // var count = matchOddSource.Count; // for (int i = 1; i <= count; i++) // { // var matchOddCheck = matchOddSource[count - i]; // if (matchOddCheck.AbsOdd >= GoalDefCheck) // { // float checkOddDef = 1; // if (matchOddCheck.HomeOdd > 0 && matchOddCheck.AwayOdd > 0) // { // checkOddDef = (1 - matchOddCheck.HomeOdd) + (1 - matchOddCheck.AwayOdd); // } // else // { // checkOddDef = Math.Abs(matchOddCheck.HomeOdd + matchOddCheck.AwayOdd); // } // //so sanh nho hon hoac = 10 xu // if (checkOddDef <= OddDevCheck) // { // buyType = matchOddCheck.Odd > 0 ? eBetType.Away : eBetType.Home; // if (!PickUnder) // { // buyType = buyType == eBetType.Home ? eBetType.Away : eBetType.Home; // } // //so sanh keo tren thap nhat la 0.70 // bool validHighOdd; // if (buyType == eBetType.Home) // { // validHighOdd = Math.Abs(matchOddCheck.AwayOdd) > 0.75; // } // else // { // validHighOdd = Math.Abs(matchOddCheck.AwayOdd) > 0.75; // } // if (validHighOdd) // { // serverBuy = eServerType.Sbo; // return true; // } // } // } // } // return false; //} private bool HasGoodMatchOdd(List <MatchOddDTO> matchOddSource, out MatchOddDTO matchOdd, out eBetType buyType, out eServerType serverBuy, out OddDTO ibetOdd) { matchOdd = null; buyType = eBetType.Unknown; serverBuy = eServerType.Unknown; ibetOdd = null; var count = matchOddSource.Count; for (int i = 1; i <= count; i++) { var matchOddCheck = matchOddSource[count - i]; if (GetValidIbetMatchOdd(matchOddCheck, out ibetOdd) && matchOddCheck.AbsOdd >= GoalDefCheck) { float checkOddDef = 1; if (matchOddCheck.HomeOdd > 0 && matchOddCheck.AwayOdd > 0) { checkOddDef = (1 - matchOddCheck.HomeOdd) + (1 - matchOddCheck.AwayOdd); } else { checkOddDef = Math.Abs(matchOddCheck.HomeOdd + matchOddCheck.AwayOdd); } //so sanh nho hon hoac = 10 xu if (checkOddDef <= OddDevCheck) { buyType = matchOddCheck.Odd > 0 ? eBetType.Away : eBetType.Home; if (!PickUnder) { buyType = buyType == eBetType.Home ? eBetType.Away : eBetType.Home; } //so sanh keo tren thap nhat la 0.70 bool validHighOdd; float ibetOddCheck = 0f; float sboOddCheck = 0f; if (buyType == eBetType.Home) { validHighOdd = Math.Abs(matchOddCheck.AwayOdd) > 0.75; ibetOddCheck = ibetOdd.HomeOdd; sboOddCheck = matchOddCheck.HomeOdd; } else { validHighOdd = Math.Abs(matchOddCheck.AwayOdd) > 0.75; ibetOddCheck = ibetOdd.AwayOdd; sboOddCheck = matchOddCheck.AwayOdd; } if (validHighOdd) { if (ibetOddCheck > sboOddCheck) { serverBuy = eServerType.Ibet; } else { serverBuy = eServerType.Sbo; } matchOdd = matchOddCheck; return(true); } } } } return(false); }
public bool ProcessPrepareBet(MatchOddDTO ibetMatchOdd, eBetType ibetBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive) { var taskPrepareBetIbet = Task.Run(() => CallPrepareBet(ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd)); var taskPrepareBetSbo = Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive, ibetMatchOdd.Odd)); if (taskPrepareBetIbet.Result.IsSuccess && taskPrepareBetSbo.Result != null) { if (taskPrepareBetIbet.Result.IsRunning) { bool isGood = IsValidOddPair(taskPrepareBetIbet.Result.NewOdd, taskPrepareBetSbo.Result.NewOdd, CompareValueDifferent); if (isGood) { int ibetStake; int sboStake; if (CaculateStake(BetStakeType, taskPrepareBetIbet.Result.MatchOdd.MatchID, taskPrepareBetIbet.Result.MinBet, taskPrepareBetIbet.Result.MaxBet, taskPrepareBetSbo.Result.MatchOdd.MatchID, taskPrepareBetSbo.Result.MinBet, taskPrepareBetSbo.Result.MaxBet, out ibetStake, out sboStake)) { if (CallConfirmBet(taskPrepareBetIbet.Result, ibetStake, sboMatchOdd.Odd)) { LastBetIbetSuccess = DateTime.Now; if (CallConfirmBet(taskPrepareBetSbo.Result, sboStake, ibetMatchOdd.Odd, isLive)) { Task.Run( () => { UpdateBetPool( taskPrepareBetSbo.Result.MatchOdd.ServerType, taskPrepareBetSbo.Result.MatchOdd.MatchID, SboBetPool, sboStake); UpdateBetPool( taskPrepareBetIbet.Result.MatchOdd.ServerType, taskPrepareBetIbet.Result.MatchOdd.MatchID, IbetBetPool, ibetStake); }); Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); CountBet++; LastBetTime = DateTime.Now; return(true); } else { Logger.Info(ProcessorName + " DAT NGUOC IBET<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); if (BetAgainstIbet) { int waitTime = WaitingTimeRebetIbet - (DateTime.Now - LastBetIbetSuccess).Seconds; if (waitTime > 0) { Thread.Sleep(WaitingTimeRebetIbet); } if (!BetAgainstIbetRequest(taskPrepareBetIbet.Result, ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd, ibetStake)) { Logger.Info("CALL LAN 2 BET MGUOC IBET<<<<<<<<<<<<<<<<"); if (BetAgainstIbetRequest(taskPrepareBetIbet.Result, ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd, ibetStake)) { return(true); } } else { return(true); } //var againstIbetPrepare = CallPrepareBet(ibetMatchOdd, GetAgainstBetType(ibetBetType), isLive, sboMatchOdd.Odd); //if (againstIbetPrepare.IsRunning) //{ // //if (againstIbetPrepare.HasScore) // //{ // if (againstIbetPrepare.HomeScore == taskPrepareBetIbet.Result.HomeScore // && againstIbetPrepare.AwayScore == taskPrepareBetIbet.Result.AwayScore) // { // if (CallConfirmBet(againstIbetPrepare, ibetStake, isLive, true)) // { // LastBetTime = DateTime.Now; // Task.Run( // () => // UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType, // taskPrepareBetIbet.Result.MatchOdd.MatchID, IbetBetPool, // ibetStake * 2)); // return true; // } // } // //} // Logger.Info("BET MGUOC IBET FAIL....TY SO THAY DOI...."); //} Logger.Info("BET MGUOC IBET FAIL....KEO HUY...."); } } LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType, taskPrepareBetIbet.Result.MatchOdd.MatchID, IbetBetPool, ibetStake)); return(true); } else { FireLogScan(ibetMatchOdd, sboMatchOdd); } } } else { FireLogScan(ibetMatchOdd, sboMatchOdd); } } else { FireLogScan(ibetMatchOdd, sboMatchOdd); } } return(false); }
//// compare from sbo (dataUpdated) to IBET (targetSource) public void CompareOdd(List <MatchOddDTO> dataUpdated, List <MatchOddDTO> targetSource, bool isLive, bool isIbetRaise = false) { foreach (var data in dataUpdated) { if (!DataContainer.LeaguesDenyKeywords.Any(data.LeagueName.ToUpper().Contains) && (!DataContainer.MatchsDenyKeywords.Any(data.HomeTeamName.ToUpper().Contains) || !DataContainer.MatchsDenyKeywords.Any(data.AwayTeamName.ToUpper().Contains))) { MatchOddDTO ibetMatchTarget = targetSource.FirstOrDefault(m => (String.Equals(m.HomeTeamName, data.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, data.AwayTeamName, StringComparison.CurrentCultureIgnoreCase)) && !DataContainer.LeaguesDenyKeywords.Any(m.LeagueName.ToUpper().Contains) && m.Odd.Equals(data.Odd) && m.OddType == data.OddType); if (ibetMatchTarget != null) { if (!IsMaxStake(ibetMatchTarget.MatchID, IbetBetPool, IbetMaxStakeMatch) && IsValidTime(ibetMatchTarget.TimeType, ibetMatchTarget.Minutes)) { bool isValid1 = IsValidOddPair(data.HomeOdd, ibetMatchTarget.AwayOdd, CompareValueDifferent); if (isValid1) { //Logger.InfoFormat("{3} Sbo {0}, Home Odd {1}, Away Odd {2}", // data.HomeTeamName + " | " + data.AwayTeamName+" ODD: "+data.Odd, // data.HomeOdd, data.AwayOdd, ProcessorName); MatchOddDTO sboMatchSource = !isIbetRaise?GetSboMatch(data, isLive) : data; if (sboMatchSource != null && !IsMaxStake(sboMatchSource.MatchID, SboBetPool, SboMaxStakeMatch)) { sboMatchSource.HomeOdd = data.HomeOdd; sboMatchSource.AwayOdd = data.AwayOdd; if (ProcessPrepareBet(ibetMatchTarget, eBetType.Away, sboMatchSource, eBetType.Home, isLive)) { return; } } } bool isValid2 = IsValidOddPair(data.AwayOdd, ibetMatchTarget.HomeOdd, CompareValueDifferent); if (isValid2) { //Logger.InfoFormat("{3} Sbo {0}, Home Odd {1}, Away Odd {2}", // data.HomeTeamName + " | " + data.AwayTeamName + " ODD: " + data.Odd, // data.HomeOdd, data.AwayOdd, ProcessorName); MatchOddDTO sboMatchSource = !isIbetRaise?GetSboMatch(data, isLive) : data; if (sboMatchSource != null && !IsMaxStake(sboMatchSource.MatchID, SboBetPool, SboMaxStakeMatch)) { sboMatchSource.HomeOdd = data.HomeOdd; sboMatchSource.AwayOdd = data.AwayOdd; //Logger.Debug(ProcessorName + ">>> CALL PROCESSS BET"); if (ProcessPrepareBet(ibetMatchTarget, eBetType.Home, sboMatchSource, eBetType.Away, isLive)) { return; } } } } } } } }
public PrepareBetIbet(MatchOddDTO matchOdd) : base(matchOdd) { }
public bool ProcessPrepareBet(MatchOddDTO ibetMatchOdd, eBetType ibetBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive, eServerScan serverScan = eServerScan.Local, bool callSecond = false, string bpMatch = "", PrepareBetDTO sboPrepareBet = null) { if (isProcess && !callSecond) // || LastProcessPrepare.AddMilliseconds(200) > DateTime.Now { return(false); } try { isProcess = true; PrepareBetDTO ibetPrepareBet; if (!callSecond) { sboMatchOdd.OldOdd = sboBetType == eBetType.Home ? sboMatchOdd.HomeOdd : sboMatchOdd.AwayOdd; var taskPrepareBetSbo = Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive, ibetMatchOdd.Odd)); ibetPrepareBet = CallPrepareBet(ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd); if (!ibetPrepareBet.IsSuccess || taskPrepareBetSbo.Result == null) { return(false); } sboPrepareBet = taskPrepareBetSbo.Result; } else { Logger.Warn("BAT DAU PREPARE LAN 2"); ibetPrepareBet = CallPrepareIbetAgain(ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd, bpMatch); if (!ibetPrepareBet.IsSuccess) { return(false); } } //sboMatchOdd.OldOdd = sboBetType == eBetType.Home ? sboMatchOdd.HomeOdd : sboMatchOdd.AwayOdd; //var taskPrepareBetSbo = // Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive, ibetMatchOdd.Odd)); //PrepareBetDTO ibetPrepareBet = CallPrepareBet(ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd); //if (!ibetPrepareBet.IsSuccess || taskPrepareBetSbo.Result == null) //{ // return false; //} //PrepareBetDTO sboPrepareBet = taskPrepareBetSbo.Result; if (ibetPrepareBet.IsRunning) { bool isGood = IsGoodOddPair(ibetPrepareBet.NewOdd, sboPrepareBet.NewOdd, CompareValueDifferent); if (isGood) { int ibetStake; int sboStake; if (CaculateStake(BetStakeType, ibetPrepareBet.MatchOdd.MatchID, ibetPrepareBet.MinBet, ibetPrepareBet.MaxBet, sboPrepareBet.MatchOdd.MatchID, sboPrepareBet.MinBet, sboPrepareBet.MaxBet, out ibetStake, out sboStake)) { string ibetConfirmMsg; if (CallConfirmBet(ibetPrepareBet, ibetStake, sboMatchOdd.Odd, out ibetConfirmMsg, isLive, false, serverScan, callSecond)) { LastBetIbetSuccess = DateTime.Now; if (CallConfirmBet(sboPrepareBet, sboStake, ibetMatchOdd.Odd, out ibetConfirmMsg, isLive, false, serverScan)) { Task.Run( () => { UpdateBetPool( sboPrepareBet.MatchOdd.ServerType, sboPrepareBet.MatchOdd.MatchID, SboBetPool, sboStake); UpdateBetPool( ibetPrepareBet.MatchOdd.ServerType, ibetPrepareBet.MatchOdd.MatchID, IbetBetPool, ibetStake); }); Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); CountBet++; LastBetTime = DateTime.Now; return(true); } else { if (BetAgainstIbet) { Logger.Info(ProcessorName + " DAT NGUOC IBET<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); if (!BetAgainstIbetRequest(ibetPrepareBet, ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd, ibetStake, false)) { Thread.Sleep(3000); Logger.Info("CALL LAN 2 BET MGUOC IBET<<<<<<<<<<<<<<<<"); if (BetAgainstIbetRequest(ibetPrepareBet, ibetMatchOdd, ibetBetType, isLive, sboMatchOdd.Odd, ibetStake, true)) { isProcess = false; return(true); } else { Logger.Info("DAT NGUOC THAT BAI, KHOI DONG LAI IBET!!!"); IbetEngine.BetAgainstTransactions.Add(new BetAgainstTransaction() { BetType = GetAgainstBetType(ibetBetType), IsLive = isLive, MatchOdd = ibetMatchOdd, OddCompare = sboMatchOdd.Odd, Stake = ibetStake, HomeScore = ibetPrepareBet.HomeScore, AwayScore = ibetPrepareBet.AwayScore }); Task.Run(() => { Logger.Info("CALL KHOI DONG LAI IBET!!!"); IbetEngine.UpdateException(IbetEngine, eExceptionType.LoginFail); }); } } else { isProcess = false; return(true); } Logger.Info("BET MGUOC IBET FAIL...DAT NGUOC THAT BAI..."); } } LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(ibetPrepareBet.MatchOdd.ServerType, ibetPrepareBet.MatchOdd.MatchID, IbetBetPool, ibetStake)); return(true); } else { if (!string.IsNullOrEmpty(ibetConfirmMsg)) { string bpValue = GetBpMatchIbet(ibetConfirmMsg); Logger.Info("GOI COMPARE LAI LAN 2, bp_match: " + bpValue); return(ProcessPrepareBet(ibetMatchOdd, ibetBetType, sboMatchOdd, sboBetType, isLive, serverScan, true, bpValue, sboPrepareBet)); } } FireLogScan(ibetMatchOdd, sboMatchOdd, serverScan); } } else { FireLogScan(ibetMatchOdd, sboMatchOdd, serverScan); } } else { FireLogScan(ibetMatchOdd, sboMatchOdd, serverScan); } return(false); } catch (Exception ex) { Logger.Error(ProcessorName, ex); return(false); } finally { //LastProcessPrepare = DateTime.Now; isProcess = false; } }
private PrepareBetDTO CallPrepareIbetAgain(MatchOddDTO matchOdd, eBetType betType, bool isLive, float oddDef, string bpMatch) { return(IbetEngine.PrepareBet(matchOdd, betType, isLive, oddDef, bpMatch)); }
public BetInfoQueue(MatchOddDTO matchOdd, eBetType betType, bool isLive) { MatchOdd = matchOdd; BetType = betType; IsLive = isLive; }
//// compare from sbo (dataUpdated) to Pi (targetSource) public void CompareOdd(List <MatchOddDTO> dataUpdated, List <MatchPiDTO> targetSource, bool isLive) { try { foreach (var sbo in dataUpdated) { if (!DataContainer.LeaguesDenyKeywords.Any(sbo.LeagueName.ToUpper().Contains) && (!DataContainer.MatchsDenyKeywords.Any(sbo.HomeTeamName.ToUpper().Contains) || !DataContainer.MatchsDenyKeywords.Any(sbo.AwayTeamName.ToUpper().Contains))) { MatchPiDTO piMatchTarget = targetSource.FirstOrDefault(m => (String.Equals(m.HomeTeamName, sbo.HomeTeamName, StringComparison.CurrentCultureIgnoreCase) || String.Equals(m.AwayTeamName, sbo.AwayTeamName, StringComparison.CurrentCultureIgnoreCase))); if (piMatchTarget != null) { OddDTO piOdd = piMatchTarget.Odds.FirstOrDefault(o => o.PiOdd.Equals(sbo.Odd) && o.OddType.Equals(sbo.OddType)); if (piOdd != null) { bool isValid1 = IsValidOddPair(sbo.HomeOdd, piOdd.AwayOdd, CompareValueDifferent) && IsValidPick(sbo, eBetType.Home); if (isValid1) { MatchOddDTO sboMatchSource = GetSboMatch(sbo, isLive); if (sboMatchSource != null) { // if (data.HomeOdd.Equals(sboMatchSource.OldOdd) && data.HomeOdd != sboMatchSource.NewUpdateOdd) // { // continue; // } sboMatchSource.HomeOdd = sbo.HomeOdd; sboMatchSource.AwayOdd = sbo.AwayOdd; ProcessPrepareBet(piMatchTarget, piOdd, eBetType.Away, sboMatchSource, eBetType.Home, isLive); return; } } bool isValid2 = IsValidOddPair(sbo.AwayOdd, piOdd.HomeOdd, CompareValueDifferent) && IsValidPick(sbo, eBetType.Away); if (isValid2) { MatchOddDTO sboMatchSource = GetSboMatch(sbo, isLive); if (sboMatchSource != null) { // if (data.AwayOdd == sboMatchSource.OldOdd && data.AwayOdd != sboMatchSource.NewUpdateOdd) // { // continue; // } sboMatchSource.HomeOdd = sbo.HomeOdd; sboMatchSource.AwayOdd = sbo.AwayOdd; ProcessPrepareBet(piMatchTarget, piOdd, eBetType.Home, sboMatchSource, eBetType.Away, isLive); return; } } } } } } } catch (Exception ex) { Logger.Fatal(ProcessorName, ex); } }
private PrepareBetDTO CallPrepareIbet(MatchOddDTO matchOdd, eBetType betType, bool isLive, float oddDef) { return(IbetEngine.PrepareBet(matchOdd, betType, isLive, oddDef, true)); }
public PrepareBetDTO(MatchOddDTO matchOdd) { MatchOdd = matchOdd; }
public bool ProcessPrepareBet(MatchPiDTO piMatch, OddDTO piOdd, eBetType piBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive, eServerScan serverScan = eServerScan.Local) { if (isProcess) { return(false); } try { isProcess = true; sboMatchOdd.OldOdd = sboBetType == eBetType.Home ? sboMatchOdd.HomeOdd : sboMatchOdd.AwayOdd; var prepareBetPina = Task.Run(() => PiEngine.PrepareBet(piMatch, piOdd, piBetType, piOdd.Odd)); var prepareBetSbo = CallPrepareBet(sboMatchOdd, sboBetType, isLive, piOdd.PiOdd); if (prepareBetSbo == null || prepareBetPina.Result == null) { FireLogScan(piMatch, piOdd, sboMatchOdd, serverScan); return(false); } float piOddValue = piBetType == eBetType.Home ? piOdd.HomeOdd : piOdd.AwayOdd; bool isGood = IsGoodOddPair(piOddValue, prepareBetSbo.NewOdd, CompareValueDifferent); if (isGood) { float firstOdd = piOdd.Odd; int piStake; int sboStake; if (CaculateStake(BetStakeType, piMatch.MatchID, 150, (int)((PendingTicket)prepareBetPina.Result.PendingTicket).TicketItem.MaxRiskAmount, prepareBetSbo.MatchOdd.MatchID, prepareBetSbo.MinBet, prepareBetSbo.MaxBet, out piStake, out sboStake)) { var piConfirmBet = PiEngine.ConfirmBet((PendingTicket)prepareBetPina.Result.PendingTicket, piStake, piMatch, piOdd, piBetType, eBetStatusType.Success); if (piConfirmBet) { if (SboEngine.ConfirmBet(sboStake, piOdd.PiOdd, isLive, serverScan, piMatch.HomeTeamName, piMatch.AwayTeamName)) { Task.Run( () => { UpdateBetPool( prepareBetSbo.MatchOdd.ServerType, prepareBetSbo.MatchOdd.MatchID, SboBetPool, sboStake); UpdateBetPool( eServerType.Pina, piMatch.MatchID, PiBetPool, piStake); }); Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); CountBet++; LastBetTime = DateTime.Now; return(true); } else { if (BetAgainstIbet) { var betTypeAgaint = GetAgainstBetType(piBetType); for (int i = 0; i < SboEngine.Rebet; i++) { var prepare = PiEngine.PrepareBet(piMatch, piOdd, betTypeAgaint, firstOdd); if (prepare != null) { var ok = PiEngine.ConfirmBet((PendingTicket)prepare.PendingTicket, piStake, piMatch, piOdd, betTypeAgaint, eBetStatusType.BetAgainstIbet, true); if (ok) { LastBetTime = DateTime.Now; Task.Run(() => UpdateBetPool(eServerType.Pina, piMatch.MatchID, PiBetPool, piStake)); return(true); } } Thread.Sleep(1000); lock (PiEngine.LockLive) { var newPiMatch = PiEngine._matchs.FirstOrDefault(p => p.MatchID == piMatch.MatchID); if (newPiMatch != null) { var newPiOdd = newPiMatch.Odds.FirstOrDefault(p => p.Odd == firstOdd && p.OddType == piOdd.OddType); if (newPiOdd != null) { prepare = PiEngine.PrepareBet(newPiMatch, newPiOdd, betTypeAgaint, firstOdd); if (prepare != null) { var ok = PiEngine.ConfirmBet((PendingTicket)prepare.PendingTicket, piStake, newPiMatch, newPiOdd, betTypeAgaint, eBetStatusType.BetAgainstIbet, true); if (ok) { LastBetTime = DateTime.Now; Task.Run(() => UpdateBetPool(eServerType.Pina, piMatch.MatchID, PiBetPool, piStake)); return(true); } } } } } Thread.Sleep(1000); } Thread.Sleep(60000); for (int i = 0; i < SboEngine.Rebet * 2; i++) { var prepare = PiEngine.PrepareBet(piMatch, piOdd, betTypeAgaint, firstOdd); if (prepare != null) { var ok = PiEngine.ConfirmBet((PendingTicket)prepare.PendingTicket, piStake, piMatch, piOdd, betTypeAgaint, eBetStatusType.BetAgainstIbet, true); if (ok) { LastBetTime = DateTime.Now; Task.Run(() => UpdateBetPool(eServerType.Pina, piMatch.MatchID, PiBetPool, piStake)); return(true); } } Thread.Sleep(10000); lock (PiEngine.LockLive) { var newPiMatch = PiEngine._matchs.FirstOrDefault(p => p.MatchID == piMatch.MatchID); if (newPiMatch != null) { var newPiOdd = newPiMatch.Odds.FirstOrDefault(p => p.Odd == firstOdd && p.OddType == piOdd.OddType); if (newPiOdd != null) { prepare = PiEngine.PrepareBet(newPiMatch, newPiOdd, betTypeAgaint, firstOdd); if (prepare != null) { var ok = PiEngine.ConfirmBet((PendingTicket)prepare.PendingTicket, piStake, newPiMatch, newPiOdd, betTypeAgaint, eBetStatusType.BetAgainstIbet, true); if (ok) { LastBetTime = DateTime.Now; Task.Run(() => UpdateBetPool(eServerType.Pina, piMatch.MatchID, PiBetPool, piStake)); return(true); } } } } } Thread.Sleep(1000); } Logger.Info("BET MGUOC IBET FAIL...DAT NGUOC THAT BAI..."); } } LastBetTime = DateTime.Now; Task.Run( () => UpdateBetPool(eServerType.Pina, piMatch.MatchID, PiBetPool, piStake)); return(true); } FireLogScan(piMatch, piOdd, sboMatchOdd, serverScan); } } else { FireLogScan(piMatch, piOdd, sboMatchOdd, serverScan); } return(false); } catch (Exception ex) { Logger.Error(ProcessorName, ex); return(false); } finally { isProcess = false; } }