Pagination

If pagination is supported by specific method it will accept models.page.PageRequest() object and return list of items wrapped in models.page.Page() object.

models.page.Page() object contains information such as page number, size and total number of items. It also contains helper methods that you can use while working with pages.

Example of using pagination

 1 import datetime
 2 import pprint
 3
 4 from lime_trader.models.page import PageRequest
 5 from lime_trader import LimeClient
 6
 7 client = LimeClient.from_file(file_path="credentials.json")
 8
 9 accounts = client.account.get_balances()  # need to get account numbers first
10
11 account_number = accounts[0].account_number # get account number of first account in a list
12
13 trades = client.account.get_trades(account_number=account_number, date=datetime.date.today(),
14                                    page=PageRequest(page=1, size=20))
15 pprint.pprint(trades)
16 pprint.pprint(f"Total elements: {trades.total_elements}")
17 pprint.pprint(f"Has next page: {trades.has_next()}")
18 pprint.pprint(f"Data: {trades.data}")