MCPcopy Create free account
hub / github.com/ccxt/ccxt / remove_repeated_elements_from_array

Method remove_repeated_elements_from_array

python/ccxt/base/exchange.py:7795–7807  ·  view source on GitHub ↗
(self, input, fallbackToTimestamp: bool = True)

Source from the content-addressed store, hash-verified

7793 return result
7794
7795 def remove_repeated_elements_from_array(self, input, fallbackToTimestamp: bool = True):
7796 uniqueDic = {}
7797 uniqueResult = []
7798 for i in range(0, len(input)):
7799 entry = input[i]
7800 uniqValue = self.safe_string_n(entry, ['id', 'timestamp', 0]) if fallbackToTimestamp else self.safe_string(entry, 'id')
7801 if uniqValue is not None and not (uniqValue in uniqueDic):
7802 uniqueDic[uniqValue] = 1
7803 uniqueResult.append(entry)
7804 valuesLength = len(uniqueResult)
7805 if valuesLength > 0:
7806 return uniqueResult
7807 return input
7808
7809 def remove_repeated_trades_from_array(self, input):
7810 uniqueResult = {}

Calls 4

safe_string_nMethod · 0.95
safe_stringMethod · 0.95
rangeFunction · 0.50
appendMethod · 0.45

Tested by 1