use TTLCache for get_ticker_history

This commit is contained in:
gcarq 2017-11-11 15:29:31 +01:00
parent 3126dcfcea
commit 8f817a3634
5 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -299,6 +299,7 @@ def main():
time.sleep(1)
elif new_state == State.RUNNING:
_process()
time.sleep(5)
old_state = new_state

View File

@ -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

View File

@ -34,6 +34,7 @@ setup(name='freqtrade',
'jsonschema',
'TA-Lib',
'tabulate',
'cachetools',
],
dependency_links=[
"git+https://github.com/ericsomdahl/python-bittrex.git@0.2.0#egg=python-bittrex"