use TTLCache for get_ticker_history
This commit is contained in:
parent
3126dcfcea
commit
8f817a3634
@ -4,6 +4,7 @@ from random import randint
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
import arrow
|
||||
from cachetools import cached, TTLCache
|
||||
|
||||
from freqtrade.exchange.bittrex import Bittrex
|
||||
from freqtrade.exchange.interface import Exchange
|
||||
@ -127,6 +128,7 @@ def get_ticker(pair: str) -> dict:
|
||||
return _API.get_ticker(pair)
|
||||
|
||||
|
||||
@cached(TTLCache(maxsize=100, ttl=30))
|
||||
def get_ticker_history(pair: str, tick_interval: Optional[int] = 5) -> List:
|
||||
return _API.get_ticker_history(pair, tick_interval)
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Bittrex(Exchange):
|
||||
_API = _Bittrex(
|
||||
api_key=_EXCHANGE_CONF['key'],
|
||||
api_secret=_EXCHANGE_CONF['secret'],
|
||||
calls_per_second=5,
|
||||
calls_per_second=3,
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -299,6 +299,7 @@ def main():
|
||||
time.sleep(1)
|
||||
elif new_state == State.RUNNING:
|
||||
_process()
|
||||
time.sleep(5)
|
||||
old_state = new_state
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
SQLAlchemy==1.1.14
|
||||
python-telegram-bot==8.1.1
|
||||
arrow==0.10.0
|
||||
cachetools==2.0.1
|
||||
requests==2.18.4
|
||||
urllib3==1.22
|
||||
wrapt==1.10.11
|
||||
|
Loading…
Reference in New Issue
Block a user