Make get_signals async. This should speed up create_trade calls by at least 10x. (#223)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import enum
|
||||
import logging
|
||||
from random import randint
|
||||
from threading import RLock
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
import arrow
|
||||
@@ -14,6 +15,7 @@ from freqtrade.exchange.bittrex import Bittrex
|
||||
from freqtrade.exchange.interface import Exchange
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
lock = RLock()
|
||||
|
||||
# Current selected exchange
|
||||
_API: Exchange = None
|
||||
@@ -138,7 +140,7 @@ def get_ticker(pair: str) -> dict:
|
||||
return _API.get_ticker(pair)
|
||||
|
||||
|
||||
@cached(TTLCache(maxsize=100, ttl=30))
|
||||
@cached(TTLCache(maxsize=100, ttl=30), lock=lock)
|
||||
def get_ticker_history(pair: str, tick_interval: Optional[int] = 5) -> List[Dict]:
|
||||
return _API.get_ticker_history(pair, tick_interval)
|
||||
|
||||
|
Reference in New Issue
Block a user