|
2 | 2 | from ...storage.query import find_max, find_min, find_many_ascending_order |
3 | 3 | from ...ticketscraping import constants |
4 | 4 | from ..models.pick import Pick |
| 5 | +from .strategies import similarRank |
5 | 6 |
|
6 | 7 | # metric 1 |
7 | 8 |
|
@@ -68,15 +69,18 @@ def run_async_task(pick: Pick, scraping_id: str): |
68 | 69 | # If found the exact same seat based on(sec, row?, seat?), get the history price(s) of the seat. |
69 | 70 | same_seats = get_exact_same_seats(pick, scraping_id) |
70 | 71 |
|
71 | | - print(f"percent change: {percent_change*100}") |
72 | | - print(f"percentile: {percentile*100}") |
73 | | - print(f"same seats in chronological order") |
74 | | - print(f"new seat price: {pick.price}") |
75 | | - print(f"history seat prices:") |
76 | | - print(list(map(lambda seat: seat.get('price', -1), same_seats))) |
77 | | - |
78 | | - # TODO |
79 | 72 | # Alert the user based on alert conditions |
| 73 | + count, seats = similarRank.price_decrease_similar_rank( |
| 74 | + pick, scraping_id) |
| 75 | + if(count > 0): |
| 76 | + print(f"percent change: {percent_change*100}") |
| 77 | + print(f"percentile: {percentile*100}") |
| 78 | + print(f"same seats in chronological order") |
| 79 | + print(f"new seat - price: {pick.price} rank: {pick.quality} section: {pick.section} row: {pick.row}") |
| 80 | + print(f"history exact same seat prices:") |
| 81 | + print(list(map(lambda seat: seat.get('price', -1), same_seats))) |
| 82 | + print(f"strategy compared to history seat ({count}) prices:") |
| 83 | + print(list(map(lambda seat: f"sec: {seat.get('section')}; row: {seat.get('row')}; rank: {seat.get('quality')}; price: {seat.get('price')}", seats))) |
80 | 84 |
|
81 | 85 | except Exception as ex: |
82 | 86 | print(ex) |
|
0 commit comments