Merge branch 'feat/short' into max-amount

This commit is contained in:
Sam Germain
2022-02-04 04:42:38 -06:00
10 changed files with 187 additions and 40 deletions

View File

@@ -333,8 +333,12 @@ class Backtesting:
df_analyzed.loc[:, col] = 0 if not tag_col else None
# Update dataprovider cache
self.dataprovider._set_cached_df(pair, self.timeframe, df_analyzed, CandleType.SPOT)
# TODO-lev: Candle-type should be conditional, either "spot" or futures
self.dataprovider._set_cached_df(
pair,
self.timeframe,
df_analyzed,
self.config['candle_type_def']
)
df_analyzed = df_analyzed.drop(df_analyzed.head(1).index)
@@ -499,7 +503,7 @@ class Backtesting:
sell_candle_time: datetime = sell_row[DATE_IDX].to_pydatetime()
if self.trading_mode == TradingMode.FUTURES:
# TODO-lev: Other fees / liquidation price?
# TODO-lev: liquidation price?
trade.funding_fees = self.exchange.calculate_funding_fees(
self.futures_data[trade.pair],
amount=trade.amount,