updated to comply with no analyze calls
moved to threads not proccesses Depends on setting requests.adapters.py default poolsize above concurrent requests. example, edit in adapters.py: DEFAULT_POOLSIZE = 200
This commit is contained in:
parent
da412fa270
commit
87a798b75c
@ -11,18 +11,17 @@ from typing import Any, Callable, Dict, List, Optional
|
|||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
import requests
|
import requests
|
||||||
import multiprocessing as mp
|
import multiprocessing.dummy as mp
|
||||||
from cachetools import TTLCache, cached
|
from cachetools import TTLCache, cached
|
||||||
|
|
||||||
from freqtrade import (DependencyException, OperationalException,
|
from freqtrade import (DependencyException, OperationalException,
|
||||||
TemporaryError, __version__, constants, persistence)
|
TemporaryError, __version__, constants, persistence)
|
||||||
from freqtrade.analyze import Analyze
|
|
||||||
from freqtrade.exchange import Exchange
|
from freqtrade.exchange import Exchange
|
||||||
from freqtrade.fiat_convert import CryptoToFiatConverter
|
from freqtrade.fiat_convert import CryptoToFiatConverter
|
||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.rpc import RPCMessageType
|
from freqtrade.rpc import RPCManager, RPCMessageType
|
||||||
from freqtrade.rpc import RPCManager
|
|
||||||
from freqtrade.state import State
|
from freqtrade.state import State
|
||||||
|
from freqtrade.strategy.resolver import IStrategy, StrategyResolver
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ class FreqtradeBot(object):
|
|||||||
|
|
||||||
# Init objects
|
# Init objects
|
||||||
self.config = config
|
self.config = config
|
||||||
self.analyze = Analyze(self.config)
|
self.strategy: IStrategy = StrategyResolver(self.config).strategy
|
||||||
self.fiat_converter = CryptoToFiatConverter()
|
self.fiat_converter = CryptoToFiatConverter()
|
||||||
self.rpc: RPCManager = RPCManager(self)
|
self.rpc: RPCManager = RPCManager(self)
|
||||||
self.persistence = None
|
self.persistence = None
|
||||||
@ -301,8 +300,8 @@ class FreqtradeBot(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
amount_reserve_percent = 1 - 0.05 # reserve 5% + stoploss
|
amount_reserve_percent = 1 - 0.05 # reserve 5% + stoploss
|
||||||
if self.analyze.get_stoploss() is not None:
|
if self.strategy.stoploss is not None:
|
||||||
amount_reserve_percent += self.analyze.get_stoploss()
|
amount_reserve_percent += self.strategy.stoploss
|
||||||
# it should not be more than 50%
|
# it should not be more than 50%
|
||||||
amount_reserve_percent = max(amount_reserve_percent, 0.5)
|
amount_reserve_percent = max(amount_reserve_percent, 0.5)
|
||||||
return min(min_stake_amounts)/amount_reserve_percent
|
return min(min_stake_amounts)/amount_reserve_percent
|
||||||
@ -316,7 +315,7 @@ class FreqtradeBot(object):
|
|||||||
:param output:
|
:param output:
|
||||||
:return: on output queue (pair, (buy, sell)) Str (tuple)
|
:return: on output queue (pair, (buy, sell)) Str (tuple)
|
||||||
'''
|
'''
|
||||||
gs = self.analyze.get_signal(self.exchange, _pair, interval)
|
gs = self.strategy.get_signal(self.exchange, _pair, interval)
|
||||||
p_gs=(_pair, gs)
|
p_gs=(_pair, gs)
|
||||||
output.put(p_gs)
|
output.put(p_gs)
|
||||||
|
|
||||||
@ -326,7 +325,7 @@ class FreqtradeBot(object):
|
|||||||
if one pair triggers the buy_signal a new trade record gets created
|
if one pair triggers the buy_signal a new trade record gets created
|
||||||
:return: True if a trade object has been created and persisted, False otherwise
|
:return: True if a trade object has been created and persisted, False otherwise
|
||||||
"""
|
"""
|
||||||
interval = self.analyze.get_ticker_interval()
|
interval = self.strategy.ticker_interval
|
||||||
stake_amount = self._get_trade_stake_amount()
|
stake_amount = self._get_trade_stake_amount()
|
||||||
|
|
||||||
if not stake_amount:
|
if not stake_amount:
|
||||||
@ -529,10 +528,10 @@ class FreqtradeBot(object):
|
|||||||
(buy, sell) = (False, False)
|
(buy, sell) = (False, False)
|
||||||
experimental = self.config.get('experimental', {})
|
experimental = self.config.get('experimental', {})
|
||||||
if experimental.get('use_sell_signal') or experimental.get('ignore_roi_if_buy_signal'):
|
if experimental.get('use_sell_signal') or experimental.get('ignore_roi_if_buy_signal'):
|
||||||
(buy, sell) = self.analyze.get_signal(self.exchange,
|
(buy, sell) = self.strategy.get_signal(self.exchange,
|
||||||
trade.pair, self.analyze.get_ticker_interval())
|
trade.pair, self.strategy.ticker_interval)
|
||||||
|
|
||||||
if self.analyze.should_sell(trade, current_rate, datetime.utcnow(), buy, sell):
|
if self.strategy.should_sell(trade, current_rate, datetime.utcnow(), buy, sell):
|
||||||
self.execute_sell(trade, current_rate)
|
self.execute_sell(trade, current_rate)
|
||||||
return True
|
return True
|
||||||
logger.info('Found no sell signals for whitelisted currencies. Trying again..')
|
logger.info('Found no sell signals for whitelisted currencies. Trying again..')
|
||||||
|
Loading…
Reference in New Issue
Block a user