-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathchecker.py
163 lines (107 loc) · 4.69 KB
/
checker.py
1
2
3
4
5
6
7
8
9
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
from strats.custom_strats import MartingaleStrat, AntiMartingaleStrat, DAlembertStrat, ParoliStrat, one_3_2_6Strat,AntiDAlembertStrat,FibonacciStrat,DAlembertStopLossCooldownStrat
from stratchecker.stratchecker import Strat_checker
import logging
from rich import print
import pickle
import os
logging.basicConfig(format='%(message)s', level=logging.INFO, datefmt='%m/%d/%Y %I:%M:%S')
start_balance=1000
base_bet=0.1
max_bet=10
multiplier=2
max_bets=1000
runs_per_strat=5
def read_results(results_filename):
#read file
with open(results_filename) as f:
file_content = f.readlines()
#remove timestamp and newline
results = [float(x.split(",")[1].replace("\n","")) for x in file_content]
#invert list
results.reverse()
return results
def save_slices(slices):
with open('slices.pickle', 'wb') as f:
pickle.dump(slices, f, pickle.HIGHEST_PROTOCOL)
def load_slices():
with open('slices.pickle', 'rb') as f:
return pickle.load(f)
def main():
slices = []
strats = []
results = read_results("results.txt")
#check if slices.pickle exists
#if it does load it
#if it does not create it
if os.path.isfile('slices.pickle'):
slices = load_slices()
if slices[0][1] - slices[0][0] == max_bets and len(slices) == runs_per_strat:
print("slices are correct")
else:
slices = Strat_checker.slice_results(count=runs_per_strat,max_bets=max_bets,results_length=len(results))
# slices = Strat_checker.slice_results_with_overlap(count=runs_per_strat,max_bets=max_bets,results_length=len(results),overlap_percent=0.2)
save_slices(slices)
print("slices are incorrect, new slices created")
strats.append(MartingaleStrat("Martingale",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets ))
strats.append(AntiMartingaleStrat("AntiMartingale",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets ))
strats.append(DAlembertStrat(description="DAlembertStrat",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets,
))
strats.append(AntiDAlembertStrat("AntiDAlembertStrat",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets ))
strats.append(DAlembertStopLossCooldownStrat(description="DAlembertStopLossCooldownStrat",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets,
max_lose_streak = 5,
stop_loss_cooldown = 10
))
strats.append(FibonacciStrat("FibonacciStrat",
start_balance=start_balance,
base_bet=base_bet,
max_bet=5,
multiplier=multiplier,
max_bets=max_bets ))
strats.append(ParoliStrat("Paroli",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets ))
strats.append(one_3_2_6Strat("one_3_2_6",
start_balance=start_balance,
base_bet=base_bet,
max_bet=max_bet,
multiplier=multiplier,
max_bets=max_bets ))
strat_runners = []
for strat in strats:
strat_runners.append(Strat_checker(strat, results, slices=slices))
for strat_runner in strat_runners:
strat_runner.run(count=runs_per_strat,plot_graph=True)
for strat_runner in strat_runners:
strat_runner.report_as_string()
for strat_runner in strat_runners:
print(strat_runner.report())
if __name__ == "__main__":
main()