Skip to content

vietvudanh/vietlott-data

Repository files navigation

Vietlot data

Data crawling from https://vietlott.vn/, results for products:

Table of content

Predictions (just for testing, not a financial advice)

These are backtest results for the strategies I have tested (just the abstract method at the moment, you can't predict lotery lol)

random strategy

predicted: 20 / day (20 tickets perday or 200,000 vnd) predicted corrected:

date result predicted
8327 2022-04-14 [1, 5, 9, 34, 37, 45, 52] [52, 9, 1, 28, 5, 45]

raw details 6/55 last 10 days

date id result page process_time
2024-12-14 01126 [3, 10, 19, 20, 21, 24, 7] 0 2024-12-16 12:55:37.831668
2024-12-12 01125 [1, 9, 12, 18, 37, 44, 11] 0 2024-12-16 12:55:37.831810
2024-12-10 01124 [11, 15, 26, 45, 52, 55, 36] 0 2024-12-16 12:55:37.831894
2024-12-07 01123 [16, 17, 22, 24, 29, 37, 54] 0 2024-12-16 12:55:37.831974
2024-12-05 01122 [16, 21, 29, 41, 42, 47, 9] 0 2024-12-16 12:55:37.832054
2024-12-03 01121 [10, 19, 33, 39, 47, 54, 16] 0 2024-12-16 12:55:37.832134
2024-11-30 01120 [1, 20, 24, 26, 38, 41, 36] 0 2024-12-16 12:55:37.832210
2024-11-28 01119 [1, 16, 24, 28, 38, 53, 9] 0 2024-12-16 12:55:37.832288
2024-11-26 01118 [8, 11, 16, 32, 40, 43, 12] 1 2024-12-16 12:55:37.849219
2024-11-23 01117 [4, 12, 25, 39, 48, 51, 45] 1 2024-12-16 12:55:37.849292

stats 6/55 all time

result count % - result count % - result count %
1 156 1.98 21 138 1.75 41 164 2.08
2 132 1.67 22 163 2.07 42 141 1.79
3 155 1.97 23 157 1.99 43 158 2.0
4 125 1.59 24 143 1.81 44 149 1.89
5 144 1.83 25 134 1.7 45 139 1.76
6 124 1.57 26 133 1.69 46 153 1.94
7 124 1.57 27 131 1.66 47 143 1.81
8 151 1.92 28 127 1.61 48 150 1.9
9 159 2.02 29 148 1.88 49 149 1.89
10 135 1.71 30 121 1.54 50 142 1.8
11 148 1.88 31 149 1.89 51 161 2.04
12 156 1.98 32 151 1.92 52 149 1.89
13 135 1.71 33 146 1.85 53 150 1.9
14 138 1.75 34 158 2 54 139 1.76
15 133 1.69 35 148 1.88 55 143 1.81
16 130 1.65 36 135 1.71
17 131 1.66 37 127 1.61
18 145 1.84 38 136 1.73
19 141 1.79 39 133 1.69
20 156 1.98 40 155 1.97

stats 6/55 -15d

result count % - result count % - result count %
1 3 3.57 26 3 3.57 52 1 1.19
3 1 1.19 28 1 1.19 53 1 1.19
4 1 1.19 29 2 2.38 54 2 2.38
6 1 1.19 31 2 2.38 55 1 1.19
7 1 1.19 32 1 1.19
8 1 1.19 33 1 1.19
9 3 3.57 34 1 1.19
10 3 3.57 36 2 2.38
11 3 3.57 37 2 2.38
12 3 3.57 38 2 2.38
15 2 2.38 39 2 2.38
16 5 5.95 40 2 2.38
17 2 2.38 41 3 3.57
18 1 1.19 42 2 2.38
19 2 2.38 43 1 1.19
20 2 2.38 44 1 1.19
21 2 2.38 45 2 2.38
22 2 2.38 47 2 2.38
24 4 4.76 48 2 2.38
25 1 1.19 51 2 2.38

stats 6/55 -30d

result count % - result count % - result count %
1 3 3.57 26 3 3.57 52 1 1.19
3 1 1.19 28 1 1.19 53 1 1.19
4 1 1.19 29 2 2.38 54 2 2.38
6 1 1.19 31 2 2.38 55 1 1.19
7 1 1.19 32 1 1.19
8 1 1.19 33 1 1.19
9 3 3.57 34 1 1.19
10 3 3.57 36 2 2.38
11 3 3.57 37 2 2.38
12 3 3.57 38 2 2.38
15 2 2.38 39 2 2.38
16 5 5.95 40 2 2.38
17 2 2.38 41 3 3.57
18 1 1.19 42 2 2.38
19 2 2.38 43 1 1.19
20 2 2.38 44 1 1.19
21 2 2.38 45 2 2.38
22 2 2.38 47 2 2.38
24 4 4.76 48 2 2.38
25 1 1.19 51 2 2.38

stats 6/55 -60d

result count % - result count % - result count %
1 4 2.38 22 3 1.79 42 3 1.79
2 1 0.6 23 1 0.6 43 3 1.79
3 2 1.19 24 5 2.98 44 1 0.6
4 1 0.6 25 2 1.19 45 3 1.79
5 3 1.79 26 6 3.57 46 2 1.19
6 2 1.19 27 1 0.6 47 4 2.38
7 2 1.19 28 2 1.19 48 2 1.19
8 1 0.6 29 5 2.98 49 2 1.19
9 6 3.57 30 1 0.6 50 1 0.6
10 3 1.79 31 7 4.17 51 6 3.57
11 4 2.38 32 1 0.6 52 2 1.19
12 4 2.38 33 3 1.79 53 2 1.19
14 2 1.19 34 3 1.79 54 5 2.98
15 3 1.79 35 2 1.19 55 2 1.19
16 7 4.17 36 3 1.79
17 4 2.38 37 4 2.38
18 1 0.6 38 2 1.19
19 5 2.98 39 6 3.57
20 5 2.98 40 5 2.98
21 4 2.38 41 4 2.38

stats 6/55 -90d

result count % - result count % - result count %
1 5 1.93 21 5 1.93 41 9 3.47
2 3 1.16 22 6 2.32 42 5 1.93
3 6 2.32 23 1 0.39 43 6 2.32
4 3 1.16 24 6 2.32 44 3 1.16
5 4 1.54 25 5 1.93 45 3 1.16
6 4 1.54 26 8 3.09 46 4 1.54
7 3 1.16 27 2 0.77 47 4 1.54
8 2 0.77 28 2 0.77 48 4 1.54
9 8 3.09 29 8 3.09 49 3 1.16
10 4 1.54 30 1 0.39 50 4 1.54
11 8 3.09 31 9 3.47 51 8 3.09
12 5 1.93 32 3 1.16 52 4 1.54
13 1 0.39 33 4 1.54 53 4 1.54
14 4 1.54 34 5 1.93 54 5 1.93
15 5 1.93 35 3 1.16 55 3 1.16
16 7 2.7 36 3 1.16
17 7 2.7 37 5 1.93
18 5 1.93 38 4 1.54
19 6 2.32 39 8 3.09
20 5 1.93 40 7 2.7

How project works

Since there are many people asked, I write this section.

Schedule

The project is schedule automatically via Github Actions, run a script, fetch data and auto commit to Github. No server is required, I don't need to do anything. Details in workflow file

How crawling works

I just inspected network packages sent between browser and server to find out how data is fetched and replicated that in Python code.

Install

via pip

pip install -i https://test.pypi.org/simple/ vietlott-data==0.1.3

cli

project provides two cli

crawl

Usage: vietlott-crawl [OPTIONS] PRODUCT

  crawl a product with a given run date or from/to index page 

Options:
  --run-date TEXT
  --index_from INTEGER  page index from run since we crawl by pagination the
                        pages
  --index_to INTEGER    page index from run since we crawl by pagination the
                        pages
  --help                Show this message and exit.

Backfill missing data

Usage: vietlott-missing [OPTIONS] PRODUCT

  detect_missing_data and run if needed :param ctx: context :param product:
  product to run :param limit: number of pages to run :return:

Options:
  --limit INTEGER
  --help           Show this message and exit.