script: Parse more than one page limit of offers.
Some checks failed
lint / build (3.12) (push) Has been cancelled

This commit is contained in:
tecnovert 2024-10-30 09:18:47 +02:00
parent 15e7a6efda
commit 745d1460e5
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 15 additions and 2 deletions

View file

@ -452,6 +452,7 @@ def main():
coin_from_data = coins_map[bid_template['coin_from']]
coin_to_data = coins_map[bid_template['coin_to']]
page_limit: int = 25
offers_options = {
'active': 'active',
'include_sent': False,
@ -460,9 +461,21 @@ def main():
'with_extra_info': True,
'sort_by': 'rate',
'sort_dir': 'asc',
'offset': 0,
'limit': page_limit,
}
received_offers = read_json_api('offers', offers_options)
received_offers = []
for i in range(1000000): # for i in itertools.count()
page_offers = read_json_api('offers', offers_options)
if len(page_offers) < 1:
break
received_offers += page_offers
offers_options['offset'] = offers_options['offset'] + page_limit
if i > 100:
print(f'Warning: Broke offers loop at: {i}')
break
if args.debug:
print('Received Offers', received_offers)

View file

@ -633,7 +633,7 @@ class Test(unittest.TestCase):
'name': 'offer should fail',
'coin_from': 'Particl',
'coin_to': 'XMR',
'amount': 20,
'amount': 200,
'minrate': 0.05,
'ratetweakpercent': 50000000,
'amount_variable': True,