mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Merge pull request #1417 from mishaker/last_candle_close
Adding "copy" as a parameter to klines. default to True
This commit is contained in:
commit
30fe06aa55
|
@ -158,9 +158,9 @@ class Exchange(object):
|
|||
"""exchange ccxt id"""
|
||||
return self._api.id
|
||||
|
||||
def klines(self, pair: str) -> DataFrame:
|
||||
def klines(self, pair: str, copy=True) -> DataFrame:
|
||||
if pair in self._klines:
|
||||
return self._klines[pair].copy()
|
||||
return self._klines[pair].copy() if copy else self._klines[pair]
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
|
@ -814,6 +814,13 @@ def test_refresh_tickers(mocker, default_conf, caplog) -> None:
|
|||
assert isinstance(exchange.klines(pair), DataFrame)
|
||||
assert len(exchange.klines(pair)) > 0
|
||||
|
||||
# klines function should return a different object on each call
|
||||
# if copy is "True"
|
||||
assert exchange.klines(pair) is not exchange.klines(pair)
|
||||
assert exchange.klines(pair) is not exchange.klines(pair, copy=True)
|
||||
assert exchange.klines(pair, copy=True) is not exchange.klines(pair, copy=True)
|
||||
assert exchange.klines(pair, copy=False) is exchange.klines(pair, copy=False)
|
||||
|
||||
# test caching
|
||||
exchange.refresh_tickers(['IOTA/ETH', 'XRP/ETH'], '5m')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user