Merge branch 'develop' into split_btanalysis_load_trades
This commit is contained in:
@@ -31,7 +31,7 @@ from typing import Any, Dict, List
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from freqtrade.arguments import Arguments, TimeRange
|
||||
from freqtrade.arguments import Arguments
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import (extract_trades_of_period,
|
||||
load_backtest_data, load_trades_from_db)
|
||||
@@ -43,38 +43,6 @@ from freqtrade.state import RunMode
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_tickers_data(strategy, exchange, pairs: List[str], timerange: TimeRange,
|
||||
datadir: Path, refresh_pairs: bool, live: bool):
|
||||
"""
|
||||
Get tickers data for each pairs on live or local, option defined in args
|
||||
:return: dictionary of tickers. output format: {'pair': tickersdata}
|
||||
"""
|
||||
|
||||
ticker_interval = strategy.ticker_interval
|
||||
|
||||
tickers = history.load_data(
|
||||
datadir=datadir,
|
||||
pairs=pairs,
|
||||
ticker_interval=ticker_interval,
|
||||
refresh_pairs=refresh_pairs,
|
||||
timerange=timerange,
|
||||
exchange=exchange,
|
||||
live=live,
|
||||
)
|
||||
|
||||
# No ticker found, impossible to download, len mismatch
|
||||
for pair, data in tickers.copy().items():
|
||||
logger.debug("checking tickers data of pair: %s", pair)
|
||||
logger.debug("data.empty: %s", data.empty)
|
||||
logger.debug("len(data): %s", len(data))
|
||||
if data.empty:
|
||||
del tickers[pair]
|
||||
logger.info(
|
||||
'An issue occured while retreiving data of %s pair, please retry '
|
||||
'using -l option for live or --refresh-pairs-cached', pair)
|
||||
return tickers
|
||||
|
||||
|
||||
def generate_dataframe(strategy, tickers, pair) -> pd.DataFrame:
|
||||
"""
|
||||
Get tickers then Populate strategy indicators and signals, then return the full dataframe
|
||||
@@ -100,8 +68,7 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
||||
-Generate plot files
|
||||
:return: None
|
||||
"""
|
||||
exchange_name = config.get('exchange', {}).get('name').title()
|
||||
exchange = ExchangeResolver(exchange_name, config).exchange
|
||||
exchange = ExchangeResolver(config.get('exchange', {}).get('name'), config).exchange
|
||||
|
||||
strategy = StrategyResolver(config).strategy
|
||||
if "pairs" in config:
|
||||
@@ -113,10 +80,16 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
||||
timerange = Arguments.parse_timerange(config["timerange"])
|
||||
ticker_interval = strategy.ticker_interval
|
||||
|
||||
tickers = get_tickers_data(strategy, exchange, pairs, timerange,
|
||||
datadir=Path(str(config.get("datadir"))),
|
||||
refresh_pairs=config.get('refresh_pairs', False),
|
||||
live=config.get("live", False))
|
||||
tickers = history.load_data(
|
||||
datadir=Path(str(config.get("datadir"))),
|
||||
pairs=pairs,
|
||||
ticker_interval=config['ticker_interval'],
|
||||
refresh_pairs=config.get('refresh_pairs', False),
|
||||
timerange=timerange,
|
||||
exchange=exchange,
|
||||
live=config.get("live", False),
|
||||
)
|
||||
|
||||
pair_counter = 0
|
||||
for pair, data in tickers.items():
|
||||
pair_counter += 1
|
||||
|
@@ -65,14 +65,14 @@ class FtRestClient():
|
||||
def start(self):
|
||||
"""
|
||||
Start the bot if it's in stopped state.
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._post("start")
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Stop the bot. Use start to restart
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._post("stop")
|
||||
|
||||
@@ -80,77 +80,77 @@ class FtRestClient():
|
||||
"""
|
||||
Stop buying (but handle sells gracefully).
|
||||
use reload_conf to reset
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._post("stopbuy")
|
||||
|
||||
def reload_conf(self):
|
||||
"""
|
||||
Reload configuration
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._post("reload_conf")
|
||||
|
||||
def balance(self):
|
||||
"""
|
||||
Get the account balance
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("balance")
|
||||
|
||||
def count(self):
|
||||
"""
|
||||
Returns the amount of open trades
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("count")
|
||||
|
||||
def daily(self, days=None):
|
||||
"""
|
||||
Returns the amount of open trades
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("daily", params={"timescale": days} if days else None)
|
||||
|
||||
def edge(self):
|
||||
"""
|
||||
Returns information about edge
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("edge")
|
||||
|
||||
def profit(self):
|
||||
"""
|
||||
Returns the profit summary
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("profit")
|
||||
|
||||
def performance(self):
|
||||
"""
|
||||
Returns the performance of the different coins
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("performance")
|
||||
|
||||
def status(self):
|
||||
"""
|
||||
Get the status of open trades
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("status")
|
||||
|
||||
def version(self):
|
||||
"""
|
||||
Returns the version of the bot
|
||||
:returns: json object containing the version
|
||||
:return: json object containing the version
|
||||
"""
|
||||
return self._get("version")
|
||||
|
||||
def whitelist(self):
|
||||
"""
|
||||
Show the current whitelist
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
return self._get("whitelist")
|
||||
|
||||
@@ -158,7 +158,7 @@ class FtRestClient():
|
||||
"""
|
||||
Show the current blacklist
|
||||
:param add: List of coins to add (example: "BNB/BTC")
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
if not args:
|
||||
return self._get("blacklist")
|
||||
@@ -170,7 +170,7 @@ class FtRestClient():
|
||||
Buy an asset
|
||||
:param pair: Pair to buy (ETH/BTC)
|
||||
:param price: Optional - price to buy
|
||||
:returns: json object of the trade
|
||||
:return: json object of the trade
|
||||
"""
|
||||
data = {"pair": pair,
|
||||
"price": price
|
||||
@@ -181,7 +181,7 @@ class FtRestClient():
|
||||
"""
|
||||
Force-sell a trade
|
||||
:param tradeid: Id of the trade (can be received via status command)
|
||||
:returns: json object
|
||||
:return: json object
|
||||
"""
|
||||
|
||||
return self._post("forcesell", data={"tradeid": tradeid})
|
||||
|
Reference in New Issue
Block a user