(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, cursorReceived: Str = None, cursorSent: Str = None, cursorIncrement: Int = None, maxEntriesPerRequest: Int = None)
| 7691 | return self.filter_by_since_limit(uniqueResults, since, limit, key) |
| 7692 | |
| 7693 | def fetch_paginated_call_cursor(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, cursorReceived: Str = None, cursorSent: Str = None, cursorIncrement: Int = None, maxEntriesPerRequest: Int = None): |
| 7694 | maxCalls = None |
| 7695 | maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10) |
| 7696 | maxRetries = None |
| 7697 | maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3) |
| 7698 | maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params) |
| 7699 | cursorValue = None |
| 7700 | i = 0 |
| 7701 | errors = 0 |
| 7702 | result = [] |
| 7703 | timeframe = self.safe_string(params, 'timeframe') |
| 7704 | params = self.omit(params, 'timeframe') # reading the timeframe from the method arguments to avoid changing the signature |
| 7705 | while(i < maxCalls): |
| 7706 | try: |
| 7707 | if cursorValue is not None: |
| 7708 | if cursorIncrement is not None: |
| 7709 | cursorValue = self.parse_to_int(cursorValue) + cursorIncrement |
| 7710 | params[cursorSent] = cursorValue |
| 7711 | response = None |
| 7712 | if method == 'fetchAccounts': |
| 7713 | response = getattr(self, method)(params) |
| 7714 | elif method == 'getLeverageTiersPaginated' or method == 'fetchPositions': |
| 7715 | response = getattr(self, method)(symbol, params) |
| 7716 | elif method == 'fetchOpenInterestHistory': |
| 7717 | response = getattr(self, method)(symbol, timeframe, since, maxEntriesPerRequest, params) |
| 7718 | else: |
| 7719 | response = getattr(self, method)(symbol, since, maxEntriesPerRequest, params) |
| 7720 | errors = 0 |
| 7721 | responseLength = len(response) |
| 7722 | if self.verbose: |
| 7723 | cursorString = '' if (cursorValue is None) else cursorValue |
| 7724 | iteration = (i + 1) |
| 7725 | cursorMessage = 'Cursor pagination call ' + str(iteration) + ' method ' + method + ' response length ' + str(responseLength) + ' cursor ' + cursorString |
| 7726 | self.log(cursorMessage) |
| 7727 | if responseLength == 0: |
| 7728 | break |
| 7729 | result = self.array_concat(result, response) |
| 7730 | last = self.safe_dict(response, responseLength - 1) |
| 7731 | # cursorValue = self.safe_value(last['info'], cursorReceived) |
| 7732 | cursorValue = None # search for the cursor |
| 7733 | for j in range(0, responseLength): |
| 7734 | index = responseLength - j - 1 |
| 7735 | entry = self.safe_dict(response, index) |
| 7736 | info = self.safe_dict(entry, 'info') |
| 7737 | cursor = self.safe_value(info, cursorReceived) |
| 7738 | if cursor is not None: |
| 7739 | cursorValue = cursor |
| 7740 | break |
| 7741 | if cursorValue is None: |
| 7742 | break |
| 7743 | lastTimestamp = self.safe_integer(last, 'timestamp') |
| 7744 | if lastTimestamp is not None and lastTimestamp < since: |
| 7745 | break |
| 7746 | except Exception as e: |
| 7747 | errors += 1 |
| 7748 | if errors > maxRetries: |
| 7749 | raise e |
| 7750 | i += 1 |
no test coverage detected