Be explicit in what is used, db or trades
This commit is contained in:
parent
8758218b09
commit
3e61ada34a
@ -515,3 +515,10 @@ class Arguments(object):
|
||||
default=750,
|
||||
type=int,
|
||||
)
|
||||
parser.add_argument(
|
||||
'--trade-source',
|
||||
help='Specify the source for trades (Can be DB or file (backtest file)) Default: %(default)s',
|
||||
dest='trade_source',
|
||||
default="file",
|
||||
choices=["DB", "file"]
|
||||
)
|
||||
|
@ -358,7 +358,8 @@ class Configuration(object):
|
||||
|
||||
self._args_to_config(config, argname='plot_limit',
|
||||
logstring='Limiting plot to: {}')
|
||||
|
||||
self._args_to_config(config, argname='trade_source',
|
||||
logstring='Using trades from: {}')
|
||||
return config
|
||||
|
||||
def _validate_config_schema(self, conf: Dict[str, Any]) -> Dict[str, Any]:
|
||||
|
@ -33,10 +33,10 @@ import pandas as pd
|
||||
|
||||
from freqtrade.arguments import Arguments, TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import load_trades, extract_trades_of_period
|
||||
from freqtrade.data.btanalysis import (extract_trades_of_period,
|
||||
load_backtest_data, load_trades_from_db)
|
||||
from freqtrade.optimize import setup_configuration
|
||||
from freqtrade.plot.plotting import (generate_graph,
|
||||
generate_plot_file)
|
||||
from freqtrade.plot.plotting import generate_graph, generate_plot_file
|
||||
from freqtrade.resolvers import ExchangeResolver, StrategyResolver
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
@ -124,10 +124,12 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
||||
tickers = {}
|
||||
tickers[pair] = data
|
||||
dataframe = generate_dataframe(strategy, tickers, pair)
|
||||
trades = None
|
||||
if config["trade_source"] == "DB":
|
||||
trades = load_trades_from_db(config["db_url"])
|
||||
elif config["trade_source"] == "file":
|
||||
trades = load_backtest_data(Path(config["exportfilename"]))
|
||||
|
||||
trades = load_trades(exportfilename=config["exportfilename"],
|
||||
db_url=config["db_url"],
|
||||
)
|
||||
trades = trades.loc[trades['pair'] == pair]
|
||||
trades = extract_trades_of_period(dataframe, trades)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user