- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
public List<List<Selection>> CompareMarketsForSurebet(List<Market> markets)
{
if (markets.Count == 0) return null;
// We analyse markets where we have 2 or 3 outcomes, if i'm not mistaken
markets = markets.Where(x => x.Selections.Count > 1 && x.Selections.Count < 4).ToList();
if (markets.All(CheckForSurebet)) return null;
var selectionsCount = markets[0].Selections.Count;
var surebets = new List<List<Selection>>();
var p1 = markets.Select(x => x.Selections[0]).ToList();
var p2 = markets.Select(x => x.Selections[1]).ToList();
var p3 = new List<Selection>();
if (selectionsCount > 2) p3 = markets.Select(x => x.Selections[2]).ToList();
if (markets.All(x => x.Name == markets[0].Name))
{
var listOfOdds = new List<Selection>();
var clone = new List<Selection>();
foreach (var t1 in p1)
{
listOfOdds.Add(t1);
foreach (var t2 in p2)
{
listOfOdds.Add(t2);
if (selectionsCount > 2)
{
foreach (var t3 in p3)
{
listOfOdds.Add(t3);
if (SurebetFormule(listOfOdds.Select(x => x.K)))
{
clone = listOfOdds.ToList();
surebets.Add(clone);
}
listOfOdds.RemoveAt(listOfOdds.Count - 1);
}
listOfOdds.RemoveAt(listOfOdds.Count - 1);
}
else
{
if (SurebetFormule(listOfOdds.Select(x => x.K)))
{
clone = listOfOdds.ToList();
surebets.Add(clone);
}
listOfOdds.RemoveAt(listOfOdds.Count - 1);
}
}
listOfOdds.Clear();
}
}
return surebets;
}
Комментарии (0) RSS
Добавить комментарий