Merge branch 'develop' into test_coverage
This commit is contained in:
@@ -5,43 +5,25 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
import arrow
|
||||
from datetime import datetime
|
||||
from typing import Dict, Optional, List
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import arrow
|
||||
import requests
|
||||
from requests.adapters import TimeoutSauce
|
||||
from cachetools import cached, TTLCache
|
||||
|
||||
from freqtrade import __version__, exchange, persistence, rpc, DependencyException, \
|
||||
OperationalException
|
||||
from freqtrade.analyze import get_signal, SignalType
|
||||
from freqtrade.misc import State, get_state, update_state, parse_args, throttle, \
|
||||
load_config
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade import (DependencyException, OperationalException, __version__,
|
||||
exchange, persistence, rpc)
|
||||
from freqtrade.analyze import SignalType, get_signal
|
||||
from freqtrade.fiat_convert import CryptoToFiatConverter
|
||||
from freqtrade.misc import (State, get_state, load_config, parse_args,
|
||||
throttle, update_state)
|
||||
from freqtrade.persistence import Trade
|
||||
|
||||
logger = logging.getLogger('freqtrade')
|
||||
|
||||
_CONF = {}
|
||||
|
||||
DEFAULT_TIMEOUT = 120
|
||||
|
||||
|
||||
# Set requests default timeout (fix for #127)
|
||||
class DefaultTimeout(TimeoutSauce):
|
||||
def __init__(self, *args, **kwargs):
|
||||
connect = kwargs.get('connect', DEFAULT_TIMEOUT)
|
||||
read = kwargs.get('read', connect)
|
||||
if connect is None:
|
||||
connect = DEFAULT_TIMEOUT
|
||||
if read is None:
|
||||
read = connect
|
||||
super(DefaultTimeout, self).__init__(connect=connect, read=read)
|
||||
|
||||
|
||||
requests.adapters.TimeoutSauce = DefaultTimeout
|
||||
|
||||
|
||||
def refresh_whitelist(whitelist: List[str]) -> List[str]:
|
||||
"""
|
||||
@@ -245,11 +227,11 @@ def execute_sell(trade: Trade, limit: float) -> None:
|
||||
profit_trade = trade.calc_profit(rate=limit)
|
||||
|
||||
message = '*{exchange}:* Selling [{pair}]({pair_url}) with limit `{limit:.8f}`'.format(
|
||||
exchange=trade.exchange,
|
||||
pair=trade.pair.replace('_', '/'),
|
||||
pair_url=exchange.get_pair_detail_url(trade.pair),
|
||||
limit=limit
|
||||
)
|
||||
exchange=trade.exchange,
|
||||
pair=trade.pair.replace('_', '/'),
|
||||
pair_url=exchange.get_pair_detail_url(trade.pair),
|
||||
limit=limit
|
||||
)
|
||||
|
||||
# For regular case, when the configuration exists
|
||||
if 'stake_currency' in _CONF and 'fiat_display_currency' in _CONF:
|
||||
@@ -261,12 +243,12 @@ def execute_sell(trade: Trade, limit: float) -> None:
|
||||
)
|
||||
message += '` ({gain}: {profit_percent:.2f}%, {profit_coin:.8f} {coin}`' \
|
||||
'` / {profit_fiat:.3f} {fiat})`'.format(
|
||||
gain="profit" if fmt_exp_profit > 0 else "loss",
|
||||
profit_percent=fmt_exp_profit,
|
||||
profit_coin=profit_trade,
|
||||
coin=_CONF['stake_currency'],
|
||||
profit_fiat=profit_fiat,
|
||||
fiat=_CONF['fiat_display_currency'],
|
||||
gain="profit" if fmt_exp_profit > 0 else "loss",
|
||||
profit_percent=fmt_exp_profit,
|
||||
profit_coin=profit_trade,
|
||||
coin=_CONF['stake_currency'],
|
||||
profit_fiat=profit_fiat,
|
||||
fiat=_CONF['fiat_display_currency'],
|
||||
)
|
||||
# Because telegram._forcesell does not have the configuration
|
||||
# Ignore the FIAT value and does not show the stake_currency as well
|
||||
|
Reference in New Issue
Block a user