mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-18 16:44:34 +00:00
script: Parse more than one page limit of offers.
Some checks failed
lint / build (3.12) (push) Has been cancelled
Some checks failed
lint / build (3.12) (push) Has been cancelled
This commit is contained in:
parent
15e7a6efda
commit
745d1460e5
2 changed files with 15 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue