Merge branch 'develop' into plot-trades

This commit is contained in:
hroff-1902
2020-03-15 13:31:00 +03:00
committed by GitHub
6 changed files with 16 additions and 8 deletions

View File

@@ -129,11 +129,16 @@ def load_trades_from_db(db_url: str) -> pd.DataFrame:
return trades
def load_trades(source: str, db_url: str, exportfilename: str, skip_trades: bool) -> pd.DataFrame:
def load_trades(source: str, db_url: str, exportfilename: Path, skip_trades: bool) -> pd.DataFrame:
"""
Based on configuration option "trade_source":
* loads data from DB (using `db_url`)
* loads data from backtestfile (using `exportfilename`)
:param source: "DB" or "file" - specify source to load from
:param db_url: sqlalchemy formatted url to a database
:param exportfilename: Json file generated by backtesting
:param skip_trades: Skip using trades, only return backtesting data columns
:return: DataFrame containing trades
"""
if skip_trades:
df = pd.DataFrame(columns=BT_DATA_COLUMNS)
@@ -142,7 +147,7 @@ def load_trades(source: str, db_url: str, exportfilename: str, skip_trades: bool
if source == "DB":
return load_trades_from_db(db_url)
elif source == "file":
return load_backtest_data(Path(exportfilename))
return load_backtest_data(exportfilename)
def extract_trades_of_period(dataframe: pd.DataFrame, trades: pd.DataFrame) -> pd.DataFrame: