Fix typos discovered by codespell
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# File used in CI to ensure pre-commit dependencies are kept uptodate.
|
# File used in CI to ensure pre-commit dependencies are kept up-to-date.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ freqtrade backtesting-analysis -c <config.json> --analysis-groups 0 1 2 3 4 5
|
|||||||
```
|
```
|
||||||
|
|
||||||
This command will read from the last backtesting results. The `--analysis-groups` option is
|
This command will read from the last backtesting results. The `--analysis-groups` option is
|
||||||
used to specify the various tabular outputs showing the profit fo each group or trade,
|
used to specify the various tabular outputs showing the profit of each group or trade,
|
||||||
ranging from the simplest (0) to the most detailed per pair, per buy and per sell tag (4):
|
ranging from the simplest (0) to the most detailed per pair, per buy and per sell tag (4):
|
||||||
|
|
||||||
* 0: overall winrate and profit summary by enter_tag
|
* 0: overall winrate and profit summary by enter_tag
|
||||||
|
|||||||
+1
-1
@@ -587,7 +587,7 @@ These precision values are based on current exchange limits (as described in the
|
|||||||
|
|
||||||
## Improved backtest accuracy
|
## Improved backtest accuracy
|
||||||
|
|
||||||
One big limitation of backtesting is it's inability to know how prices moved intra-candle (was high before close, or viceversa?).
|
One big limitation of backtesting is it's inability to know how prices moved intra-candle (was high before close, or vice-versa?).
|
||||||
So assuming you run backtesting with a 1h timeframe, there will be 4 prices for that candle (Open, High, Low, Close).
|
So assuming you run backtesting with a 1h timeframe, there will be 4 prices for that candle (Open, High, Low, Close).
|
||||||
|
|
||||||
While backtesting does take some assumptions (read above) about this - this can never be perfect, and will always be biased in one way or the other.
|
While backtesting does take some assumptions (read above) about this - this can never be perfect, and will always be biased in one way or the other.
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Supported Markets
|
## Supported Markets
|
||||||
|
|
||||||
Freqtrade supports spot trading, as well as (isolated) futures trading for some selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an uptodate list of supported exchanges.
|
Freqtrade supports spot trading, as well as (isolated) futures trading for some selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an up-to-date list of supported exchanges.
|
||||||
|
|
||||||
### Can my bot open short positions?
|
### Can my bot open short positions?
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ In spot markets, you can in some cases use leveraged spot tokens, which reflect
|
|||||||
|
|
||||||
### Can my bot trade options or futures?
|
### Can my bot trade options or futures?
|
||||||
|
|
||||||
Futures trading is supported for selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an uptodate list of supported exchanges.
|
Futures trading is supported for selected exchanges. Please refer to the [documentation start page](index.md#supported-futures-exchanges-experimental) for an up-to-date list of supported exchanges.
|
||||||
|
|
||||||
## Beginner Tips & Tricks
|
## Beginner Tips & Tricks
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ Mandatory parameters are marked as **Required** and have to be set in one of the
|
|||||||
| | **Data split parameters within the `freqai.data_split_parameters` sub dictionary**
|
| | **Data split parameters within the `freqai.data_split_parameters` sub dictionary**
|
||||||
| `data_split_parameters` | Include any additional parameters available from scikit-learn `test_train_split()`, which are shown [here](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) (external website). <br> **Datatype:** Dictionary.
|
| `data_split_parameters` | Include any additional parameters available from scikit-learn `test_train_split()`, which are shown [here](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) (external website). <br> **Datatype:** Dictionary.
|
||||||
| `test_size` | The fraction of data that should be used for testing instead of training. <br> **Datatype:** Positive float < 1.
|
| `test_size` | The fraction of data that should be used for testing instead of training. <br> **Datatype:** Positive float < 1.
|
||||||
| `shuffle` | Shuffle the training data points during training. Typically, to not remove the chronological order of data in time-series forecasting, this is set to `False`. <br> **Datatype:** Boolean. <br> Defaut: `False`.
|
| `shuffle` | Shuffle the training data points during training. Typically, to not remove the chronological order of data in time-series forecasting, this is set to `False`. <br> **Datatype:** Boolean. <br> Default: `False`.
|
||||||
|
|
||||||
### Model training parameters
|
### Model training parameters
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -454,7 +454,7 @@ To properly configure your reverse proxy (securely), please consult it's documen
|
|||||||
- **Caddy**: Caddy v2 supports websockets out of the box, see the [documentation](https://caddyserver.com/docs/v2-upgrade#proxy)
|
- **Caddy**: Caddy v2 supports websockets out of the box, see the [documentation](https://caddyserver.com/docs/v2-upgrade#proxy)
|
||||||
|
|
||||||
!!! Tip "SSL certificates"
|
!!! Tip "SSL certificates"
|
||||||
You can use tools like certbot to setup ssl certificates to access your bot's UI through encrypted connection by using any fo the above reverse proxies.
|
You can use tools like certbot to setup ssl certificates to access your bot's UI through encrypted connection by using any of the above reverse proxies.
|
||||||
While this will protect your data in transit, we do not recommend to run the freqtrade API outside of your private network (VPN, SSH tunnel).
|
While this will protect your data in transit, we do not recommend to run the freqtrade API outside of your private network (VPN, SSH tunnel).
|
||||||
|
|
||||||
### OpenAPI interface
|
### OpenAPI interface
|
||||||
|
|||||||
+1
-1
@@ -240,7 +240,7 @@ When using leverage, the same principle is applied - with stoploss defining the
|
|||||||
|
|
||||||
Therefore, a stoploss of 10% on a 10x trade would trigger on a 1% price move.
|
Therefore, a stoploss of 10% on a 10x trade would trigger on a 1% price move.
|
||||||
If your stake amount (own capital) was 100$ - this trade would be 1000$ at 10x (after leverage).
|
If your stake amount (own capital) was 100$ - this trade would be 1000$ at 10x (after leverage).
|
||||||
If price moves 1% - you've lost 10$ of your own capital - therfore stoploss will trigger in this case.
|
If price moves 1% - you've lost 10$ of your own capital - therefore stoploss will trigger in this case.
|
||||||
|
|
||||||
Make sure to be aware of this, and avoid using too tight stoploss (at 10x leverage, 10% risk may be too little to allow the trade to "breath" a little).
|
Make sure to be aware of this, and avoid using too tight stoploss (at 10x leverage, 10% risk may be too little to allow the trade to "breath" a little).
|
||||||
|
|
||||||
|
|||||||
@@ -326,4 +326,4 @@ for val in self.buy_ema_short.range:
|
|||||||
dataframe = pd.concat(frames, axis=1)
|
dataframe = pd.concat(frames, axis=1)
|
||||||
```
|
```
|
||||||
|
|
||||||
Freqtrade does however also counter this by running `dataframe.copy()` on the dataframe right after the `populate_indicators()` method - so performance implications of this should be low to non-existant.
|
Freqtrade does however also counter this by running `dataframe.copy()` on the dataframe right after the `populate_indicators()` method - so performance implications of this should be low to non-existent.
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ The orderbook structure is aligned with the order structure from [ccxt](https://
|
|||||||
Therefore, using `ob['bids'][0][0]` as demonstrated above will result in using the best bid price. `ob['bids'][0][1]` would look at the amount at this orderbook position.
|
Therefore, using `ob['bids'][0][0]` as demonstrated above will result in using the best bid price. `ob['bids'][0][1]` would look at the amount at this orderbook position.
|
||||||
|
|
||||||
!!! Warning "Warning about backtesting"
|
!!! Warning "Warning about backtesting"
|
||||||
The order book is not part of the historic data which means backtesting and hyperopt will not work correctly if this method is used, as the method will return uptodate values.
|
The order book is not part of the historic data which means backtesting and hyperopt will not work correctly if this method is used, as the method will return up-to-date values.
|
||||||
|
|
||||||
### *ticker(pair)*
|
### *ticker(pair)*
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ An `Order` object will always be tied to it's corresponding [`Trade`](#trade-obj
|
|||||||
### Order - Available attributes
|
### Order - Available attributes
|
||||||
|
|
||||||
an Order object is typically attached to a trade.
|
an Order object is typically attached to a trade.
|
||||||
Most properties here can be None as they are dependant on the exchange response.
|
Most properties here can be None as they are dependent on the exchange response.
|
||||||
|
|
||||||
| Attribute | DataType | Description |
|
| Attribute | DataType | Description |
|
||||||
|------------|-------------|-------------|
|
|------------|-------------|-------------|
|
||||||
@@ -141,7 +141,7 @@ Most properties here can be None as they are dependant on the exchange response.
|
|||||||
`amount` | float | Amount in base currency
|
`amount` | float | Amount in base currency
|
||||||
`filled` | float | Filled amount (in base currency)
|
`filled` | float | Filled amount (in base currency)
|
||||||
`remaining` | float | Remaining amount
|
`remaining` | float | Remaining amount
|
||||||
`cost` | float | Cost of the order - usually average * filled (*Exchange dependant on futures, may contain the cost with or without leverage and may be in contracts.*)
|
`cost` | float | Cost of the order - usually average * filled (*Exchange dependent on futures, may contain the cost with or without leverage and may be in contracts.*)
|
||||||
`stake_amount` | float | Stake amount used for this order. *Added in 2023.7.*
|
`stake_amount` | float | Stake amount used for this order. *Added in 2023.7.*
|
||||||
`order_date` | datetime | Order creation date **use `order_date_utc` instead**
|
`order_date` | datetime | Order creation date **use `order_date_utc` instead**
|
||||||
`order_date_utc` | datetime | Order creation date (in UTC)
|
`order_date_utc` | datetime | Order creation date (in UTC)
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ class Configuration:
|
|||||||
|
|
||||||
if self.args.get('show_sensitive'):
|
if self.args.get('show_sensitive'):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Sensitive information will be shown in the upcomming output. "
|
"Sensitive information will be shown in the upcoming output. "
|
||||||
"Please make sure to never share this output without redacting "
|
"Please make sure to never share this output without redacting "
|
||||||
"the information yourself.")
|
"the information yourself.")
|
||||||
|
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ class DataProvider:
|
|||||||
Send custom RPC Notifications from your bot.
|
Send custom RPC Notifications from your bot.
|
||||||
Will not send any bot in modes other than Dry-run or Live.
|
Will not send any bot in modes other than Dry-run or Live.
|
||||||
:param message: Message to be sent. Must be below 4096.
|
:param message: Message to be sent. Must be below 4096.
|
||||||
:param always_send: If False, will send the message only once per candle, and surpress
|
:param always_send: If False, will send the message only once per candle, and suppress
|
||||||
identical messages.
|
identical messages.
|
||||||
Careful as this can end up spaming your chat.
|
Careful as this can end up spaming your chat.
|
||||||
Defaults to False
|
Defaults to False
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ class Exchange:
|
|||||||
|
|
||||||
def price_get_one_pip(self, pair: str, price: float) -> float:
|
def price_get_one_pip(self, pair: str, price: float) -> float:
|
||||||
"""
|
"""
|
||||||
Get's the "1 pip" value for this pair.
|
Gets the "1 pip" value for this pair.
|
||||||
Used in PriceFilter to calculate the 1pip movements.
|
Used in PriceFilter to calculate the 1pip movements.
|
||||||
"""
|
"""
|
||||||
precision = self.markets[pair]['precision']['price']
|
precision = self.markets[pair]['precision']['price']
|
||||||
@@ -2007,7 +2007,7 @@ class Exchange:
|
|||||||
range(since_ms, until_ms or dt_ts(), one_call)]
|
range(since_ms, until_ms or dt_ts(), one_call)]
|
||||||
|
|
||||||
data: List = []
|
data: List = []
|
||||||
# Chunk requests into batches of 100 to avoid overwelming ccxt Throttling
|
# Chunk requests into batches of 100 to avoid overwhelming ccxt Throttling
|
||||||
for input_coro in chunks(input_coroutines, 100):
|
for input_coro in chunks(input_coroutines, 100):
|
||||||
|
|
||||||
results = await asyncio.gather(*input_coro, return_exceptions=True)
|
results = await asyncio.gather(*input_coro, return_exceptions=True)
|
||||||
@@ -2124,7 +2124,7 @@ class Exchange:
|
|||||||
Only used in the dataprovider.refresh() method.
|
Only used in the dataprovider.refresh() method.
|
||||||
:param pair_list: List of 2 element tuples containing pair, interval to refresh
|
:param pair_list: List of 2 element tuples containing pair, interval to refresh
|
||||||
:param since_ms: time since when to download, in milliseconds
|
:param since_ms: time since when to download, in milliseconds
|
||||||
:param cache: Assign result to _klines. Usefull for one-off downloads like for pairlists
|
:param cache: Assign result to _klines. Useful for one-off downloads like for pairlists
|
||||||
:param drop_incomplete: Control candle dropping.
|
:param drop_incomplete: Control candle dropping.
|
||||||
Specifying None defaults to _ohlcv_partial_candle
|
Specifying None defaults to _ohlcv_partial_candle
|
||||||
:return: Dict of [{(pair, timeframe): Dataframe}]
|
:return: Dict of [{(pair, timeframe): Dataframe}]
|
||||||
@@ -2135,7 +2135,7 @@ class Exchange:
|
|||||||
input_coroutines, cached_pairs = self._build_ohlcv_dl_jobs(pair_list, since_ms, cache)
|
input_coroutines, cached_pairs = self._build_ohlcv_dl_jobs(pair_list, since_ms, cache)
|
||||||
|
|
||||||
results_df = {}
|
results_df = {}
|
||||||
# Chunk requests into batches of 100 to avoid overwelming ccxt Throttling
|
# Chunk requests into batches of 100 to avoid overwhelming ccxt Throttling
|
||||||
for input_coro in chunks(input_coroutines, 100):
|
for input_coro in chunks(input_coroutines, 100):
|
||||||
async def gather_stuff():
|
async def gather_stuff():
|
||||||
return await asyncio.gather(*input_coro, return_exceptions=True)
|
return await asyncio.gather(*input_coro, return_exceptions=True)
|
||||||
@@ -2295,7 +2295,7 @@ class Exchange:
|
|||||||
since: Optional[int] = None,
|
since: Optional[int] = None,
|
||||||
params: Optional[dict] = None) -> Tuple[List[List], Any]:
|
params: Optional[dict] = None) -> Tuple[List[List], Any]:
|
||||||
"""
|
"""
|
||||||
Asyncronously gets trade history using fetch_trades.
|
Asynchronously gets trade history using fetch_trades.
|
||||||
Handles exchange errors, does one call to the exchange.
|
Handles exchange errors, does one call to the exchange.
|
||||||
:param pair: Pair to fetch trade data for
|
:param pair: Pair to fetch trade data for
|
||||||
:param since: Since as integer timestamp in milliseconds
|
:param since: Since as integer timestamp in milliseconds
|
||||||
@@ -2352,7 +2352,7 @@ class Exchange:
|
|||||||
since: Optional[int] = None,
|
since: Optional[int] = None,
|
||||||
from_id: Optional[str] = None) -> Tuple[str, List[List]]:
|
from_id: Optional[str] = None) -> Tuple[str, List[List]]:
|
||||||
"""
|
"""
|
||||||
Asyncronously gets trade history using fetch_trades
|
Asynchronously gets trade history using fetch_trades
|
||||||
use this when exchange uses id-based iteration (check `self._trades_pagination`)
|
use this when exchange uses id-based iteration (check `self._trades_pagination`)
|
||||||
:param pair: Pair to fetch trade data for
|
:param pair: Pair to fetch trade data for
|
||||||
:param since: Since as integer timestamp in milliseconds
|
:param since: Since as integer timestamp in milliseconds
|
||||||
@@ -2403,7 +2403,7 @@ class Exchange:
|
|||||||
async def _async_get_trade_history_time(self, pair: str, until: int,
|
async def _async_get_trade_history_time(self, pair: str, until: int,
|
||||||
since: Optional[int] = None) -> Tuple[str, List[List]]:
|
since: Optional[int] = None) -> Tuple[str, List[List]]:
|
||||||
"""
|
"""
|
||||||
Asyncronously gets trade history using fetch_trades,
|
Asynchronously gets trade history using fetch_trades,
|
||||||
when the exchange uses time-based iteration (check `self._trades_pagination`)
|
when the exchange uses time-based iteration (check `self._trades_pagination`)
|
||||||
:param pair: Pair to fetch trade data for
|
:param pair: Pair to fetch trade data for
|
||||||
:param since: Since as integer timestamp in milliseconds
|
:param since: Since as integer timestamp in milliseconds
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class Gate(Exchange):
|
|||||||
# As such, futures orders on gate will not contain a fee, which causes
|
# As such, futures orders on gate will not contain a fee, which causes
|
||||||
# a repeated "update fee" cycle and wrong calculations.
|
# a repeated "update fee" cycle and wrong calculations.
|
||||||
# Therefore we patch the response with fees if it's not available.
|
# Therefore we patch the response with fees if it's not available.
|
||||||
# An alternative also contianing fees would be
|
# An alternative also containing fees would be
|
||||||
# privateFuturesGetSettleAccountBook({"settle": "usdt"})
|
# privateFuturesGetSettleAccountBook({"settle": "usdt"})
|
||||||
pair_fees = self._trading_fees.get(pair, {})
|
pair_fees = self._trading_fees.get(pair, {})
|
||||||
if pair_fees:
|
if pair_fees:
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Okx(Exchange):
|
|||||||
"""
|
"""
|
||||||
Exchange ohlcv candle limit
|
Exchange ohlcv candle limit
|
||||||
OKX has the following behaviour:
|
OKX has the following behaviour:
|
||||||
* 300 candles for uptodate data
|
* 300 candles for up-to-date data
|
||||||
* 100 candles for historic data
|
* 100 candles for historic data
|
||||||
* 100 candles for additional candles (not futures or spot).
|
* 100 candles for additional candles (not futures or spot).
|
||||||
:param timeframe: Timeframe to check
|
:param timeframe: Timeframe to check
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class BaseEnvironment(gym.Env):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def step(self, action: int):
|
def step(self, action: int):
|
||||||
"""
|
"""
|
||||||
Step depeneds on action types, this must be inherited.
|
Step depends on action types, this must be inherited.
|
||||||
"""
|
"""
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ class BaseEnvironment(gym.Env):
|
|||||||
|
|
||||||
def _update_unrealized_total_profit(self):
|
def _update_unrealized_total_profit(self):
|
||||||
"""
|
"""
|
||||||
Update the unrealized total profit incase of episode end.
|
Update the unrealized total profit in case of episode end.
|
||||||
"""
|
"""
|
||||||
if self._position in (Positions.Long, Positions.Short):
|
if self._position in (Positions.Long, Positions.Short):
|
||||||
pnl = self.get_unrealized_profit()
|
pnl = self.get_unrealized_profit()
|
||||||
@@ -357,7 +357,7 @@ class BaseEnvironment(gym.Env):
|
|||||||
"""
|
"""
|
||||||
return self.actions
|
return self.actions
|
||||||
|
|
||||||
# Keeping around incase we want to start building more complex environment
|
# Keeping around in case we want to start building more complex environment
|
||||||
# templates in the future.
|
# templates in the future.
|
||||||
# def most_recent_return(self):
|
# def most_recent_return(self):
|
||||||
# """
|
# """
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ class BaseReinforcementLearningModel(IFreqaiModel):
|
|||||||
if not prices_train_old.empty:
|
if not prices_train_old.empty:
|
||||||
prices_train = prices_train_old
|
prices_train = prices_train_old
|
||||||
rename_dict = rename_dict_old
|
rename_dict = rename_dict_old
|
||||||
logger.warning('Reinforcement learning module didnt find the correct raw prices '
|
logger.warning('Reinforcement learning module didn't find the correct raw prices '
|
||||||
'assigned in feature_engineering_standard(). '
|
'assigned in feature_engineering_standard(). '
|
||||||
'Please assign them with:\n'
|
'Please assign them with:\n'
|
||||||
'dataframe["%-raw_close"] = dataframe["close"]\n'
|
'dataframe["%-raw_close"] = dataframe["close"]\n'
|
||||||
@@ -458,7 +458,7 @@ def make_env(MyRLEnv: Type[BaseEnvironment], env_id: str, rank: int,
|
|||||||
|
|
||||||
:param env_id: (str) the environment ID
|
:param env_id: (str) the environment ID
|
||||||
:param num_env: (int) the number of environment you wish to have in subprocesses
|
:param num_env: (int) the number of environment you wish to have in subprocesses
|
||||||
:param seed: (int) the inital seed for RNG
|
:param seed: (int) the initial seed for RNG
|
||||||
:param rank: (int) index of the subprocess
|
:param rank: (int) index of the subprocess
|
||||||
:param env_info: (dict) all required arguments to instantiate the environment.
|
:param env_info: (dict) all required arguments to instantiate the environment.
|
||||||
:return: (Callable)
|
:return: (Callable)
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class FreqaiDataDrawer:
|
|||||||
|
|
||||||
new_pred = pred_df.copy()
|
new_pred = pred_df.copy()
|
||||||
# set new_pred values to nans (we want to signal to user that there was nothing
|
# set new_pred values to nans (we want to signal to user that there was nothing
|
||||||
# historically made during downtime. The newest pred will get appeneded later in
|
# historically made during downtime. The newest pred will get appended later in
|
||||||
# append_model_predictions)
|
# append_model_predictions)
|
||||||
|
|
||||||
new_pred["date_pred"] = dataframe["date"]
|
new_pred["date_pred"] = dataframe["date"]
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ class FreqaiDataKitchen:
|
|||||||
pairs = self.freqai_config["feature_parameters"].get("include_corr_pairlist", [])
|
pairs = self.freqai_config["feature_parameters"].get("include_corr_pairlist", [])
|
||||||
|
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
pair = pair.replace(':', '') # lightgbm doesnt like colons
|
pair = pair.replace(':', '') # lightgbm does not like colons
|
||||||
pair_cols = [col for col in dataframe.columns if col.startswith("%")
|
pair_cols = [col for col in dataframe.columns if col.startswith("%")
|
||||||
and f"{pair}_" in col]
|
and f"{pair}_" in col]
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ class FreqaiDataKitchen:
|
|||||||
pairs = self.freqai_config["feature_parameters"].get("include_corr_pairlist", [])
|
pairs = self.freqai_config["feature_parameters"].get("include_corr_pairlist", [])
|
||||||
current_pair = current_pair.replace(':', '')
|
current_pair = current_pair.replace(':', '')
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
pair = pair.replace(':', '') # lightgbm doesnt work with colons
|
pair = pair.replace(':', '') # lightgbm does not work with colons
|
||||||
if current_pair != pair:
|
if current_pair != pair:
|
||||||
dataframe = dataframe.merge(corr_dataframes[pair], how='left', on='date')
|
dataframe = dataframe.merge(corr_dataframes[pair], how='left', on='date')
|
||||||
|
|
||||||
@@ -841,7 +841,7 @@ class FreqaiDataKitchen:
|
|||||||
f = spy.stats.norm.fit(self.data_dictionary["train_labels"][label])
|
f = spy.stats.norm.fit(self.data_dictionary["train_labels"][label])
|
||||||
self.data["labels_mean"][label], self.data["labels_std"][label] = f[0], f[1]
|
self.data["labels_mean"][label], self.data["labels_std"][label] = f[0], f[1]
|
||||||
|
|
||||||
# incase targets are classifications
|
# in case targets are classifications
|
||||||
for label in self.unique_class_list:
|
for label in self.unique_class_list:
|
||||||
self.data["labels_mean"][label], self.data["labels_std"][label] = 0, 0
|
self.data["labels_mean"][label], self.data["labels_std"][label] = 0, 0
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class IFreqaiModel(ABC):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
pair = self.train_queue[0]
|
pair = self.train_queue[0]
|
||||||
|
|
||||||
# ensure pair is avaialble in dp
|
# ensure pair is available in dp
|
||||||
if pair not in strategy.dp.current_whitelist():
|
if pair not in strategy.dp.current_whitelist():
|
||||||
self.train_queue.popleft()
|
self.train_queue.popleft()
|
||||||
logger.warning(f'{pair} not in current whitelist, removing from train queue.')
|
logger.warning(f'{pair} not in current whitelist, removing from train queue.')
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class PyTorchMLPClassifier(BasePyTorchClassifier):
|
|||||||
model.to(self.device)
|
model.to(self.device)
|
||||||
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
||||||
criterion = torch.nn.CrossEntropyLoss()
|
criterion = torch.nn.CrossEntropyLoss()
|
||||||
# check if continual_learning is activated, and retreive the model to continue training
|
# check if continual_learning is activated, and retrieve the model to continue training
|
||||||
trainer = self.get_init_model(dk.pair)
|
trainer = self.get_init_model(dk.pair)
|
||||||
if trainer is None:
|
if trainer is None:
|
||||||
trainer = PyTorchModelTrainer(
|
trainer = PyTorchModelTrainer(
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class PyTorchMLPRegressor(BasePyTorchRegressor):
|
|||||||
model.to(self.device)
|
model.to(self.device)
|
||||||
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
||||||
criterion = torch.nn.MSELoss()
|
criterion = torch.nn.MSELoss()
|
||||||
# check if continual_learning is activated, and retreive the model to continue training
|
# check if continual_learning is activated, and retrieve the model to continue training
|
||||||
trainer = self.get_init_model(dk.pair)
|
trainer = self.get_init_model(dk.pair)
|
||||||
if trainer is None:
|
if trainer is None:
|
||||||
trainer = PyTorchModelTrainer(
|
trainer = PyTorchModelTrainer(
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class PyTorchTransformerRegressor(BasePyTorchRegressor):
|
|||||||
model.to(self.device)
|
model.to(self.device)
|
||||||
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
optimizer = torch.optim.AdamW(model.parameters(), lr=self.learning_rate)
|
||||||
criterion = torch.nn.MSELoss()
|
criterion = torch.nn.MSELoss()
|
||||||
# check if continual_learning is activated, and retreive the model to continue training
|
# check if continual_learning is activated, and retrieve the model to continue training
|
||||||
trainer = self.get_init_model(dk.pair)
|
trainer = self.get_init_model(dk.pair)
|
||||||
if trainer is None:
|
if trainer is None:
|
||||||
trainer = PyTorchTransformerTrainer(
|
trainer = PyTorchTransformerTrainer(
|
||||||
|
|||||||
@@ -63,6 +63,6 @@ class ReinforcementLearner_multiproc(ReinforcementLearner):
|
|||||||
is_masking_supported(self.eval_env)))
|
is_masking_supported(self.eval_env)))
|
||||||
|
|
||||||
# TENSORBOARD CALLBACK DOES NOT RECOMMENDED TO USE WITH MULTIPLE ENVS,
|
# TENSORBOARD CALLBACK DOES NOT RECOMMENDED TO USE WITH MULTIPLE ENVS,
|
||||||
# IT WILL RETURN FALSE INFORMATIONS, NEVERTHLESS NOT THREAD SAFE WITH SB3!!!
|
# IT WILL RETURN FALSE INFORMATION, NEVERTHELESS NOT THREAD SAFE WITH SB3!!!
|
||||||
actions = self.train_env.env_method("get_actions")[0]
|
actions = self.train_env.env_method("get_actions")[0]
|
||||||
self.tensorboard_callback = TensorboardCallback(verbose=1, actions=actions)
|
self.tensorboard_callback = TensorboardCallback(verbose=1, actions=actions)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class PyTorchModelTrainer(PyTorchTrainerInterface):
|
|||||||
:param init_model: A dictionary containing the initial model/optimizer
|
:param init_model: A dictionary containing the initial model/optimizer
|
||||||
state_dict and model_meta_data saved by self.save() method.
|
state_dict and model_meta_data saved by self.save() method.
|
||||||
:param model_meta_data: Additional metadata about the model (optional).
|
:param model_meta_data: Additional metadata about the model (optional).
|
||||||
:param data_convertor: convertor from pd.DataFrame to torch.tensor.
|
:param data_convertor: converter from pd.DataFrame to torch.tensor.
|
||||||
:param n_steps: used to calculate n_epochs. The number of training iterations to run.
|
:param n_steps: used to calculate n_epochs. The number of training iterations to run.
|
||||||
iteration here refers to the number of times optimizer.step() is called.
|
iteration here refers to the number of times optimizer.step() is called.
|
||||||
ignored if n_epochs is set.
|
ignored if n_epochs is set.
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ def record_params(config: Dict[str, Any], full_path: Path) -> None:
|
|||||||
|
|
||||||
def get_timerange_backtest_live_models(config: Config) -> str:
|
def get_timerange_backtest_live_models(config: Config) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a formated timerange for backtest live/ready models
|
Returns a formatted timerange for backtest live/ready models
|
||||||
:param config: Configuration dictionary
|
:param config: Configuration dictionary
|
||||||
|
|
||||||
:return: a string timerange (format example: '20220801-20220822')
|
:return: a string timerange (format example: '20220801-20220822')
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
# Init objects
|
# Init objects
|
||||||
self.config = config
|
self.config = config
|
||||||
exchange_config: ExchangeConfig = deepcopy(config['exchange'])
|
exchange_config: ExchangeConfig = deepcopy(config['exchange'])
|
||||||
# Remove credentials from original exchange config to avoid accidental credentail exposure
|
# Remove credentials from original exchange config to avoid accidental credential exposure
|
||||||
remove_exchange_credentials(config['exchange'], True)
|
remove_exchange_credentials(config['exchange'], True)
|
||||||
|
|
||||||
self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)
|
self.strategy: IStrategy = StrategyResolver.load_strategy(self.config)
|
||||||
@@ -176,7 +176,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
try:
|
try:
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
# Exeptions here will be happening if the db disappeared.
|
# Exceptions here will be happening if the db disappeared.
|
||||||
# At which point we can no longer commit anyway.
|
# At which point we can no longer commit anyway.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
self.strategy.analyze(self.active_pair_whitelist)
|
self.strategy.analyze(self.active_pair_whitelist)
|
||||||
|
|
||||||
with self._exit_lock:
|
with self._exit_lock:
|
||||||
# Check for exchange cancelations, timeouts and user requested replace
|
# Check for exchange cancellations, timeouts and user requested replace
|
||||||
self.manage_open_orders()
|
self.manage_open_orders()
|
||||||
|
|
||||||
# Protect from collisions with force_exit.
|
# Protect from collisions with force_exit.
|
||||||
@@ -1291,12 +1291,12 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
|
|
||||||
def manage_trade_stoploss_orders(self, trade: Trade, stoploss_orders: List[Dict]):
|
def manage_trade_stoploss_orders(self, trade: Trade, stoploss_orders: List[Dict]):
|
||||||
"""
|
"""
|
||||||
Perform required actions acording to existing stoploss orders of trade
|
Perform required actions according to existing stoploss orders of trade
|
||||||
:param trade: Corresponding Trade
|
:param trade: Corresponding Trade
|
||||||
:param stoploss_orders: Current on exchange stoploss orders
|
:param stoploss_orders: Current on exchange stoploss orders
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
# If all stoploss orderd are canceled for some reason we add it again
|
# If all stoploss ordered are canceled for some reason we add it again
|
||||||
canceled_sl_orders = [o for o in stoploss_orders
|
canceled_sl_orders = [o for o in stoploss_orders
|
||||||
if o['status'] in ('canceled', 'cancelled')]
|
if o['status'] in ('canceled', 'cancelled')]
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class Backtesting:
|
|||||||
candle_type=CandleType.FUNDING_RATE
|
candle_type=CandleType.FUNDING_RATE
|
||||||
)
|
)
|
||||||
|
|
||||||
# For simplicity, assign to CandleType.Mark (might contian index candles!)
|
# For simplicity, assign to CandleType.Mark (might contain index candles!)
|
||||||
mark_rates_dict = history.load_data(
|
mark_rates_dict = history.load_data(
|
||||||
datadir=self.config['datadir'],
|
datadir=self.config['datadir'],
|
||||||
pairs=self.pairlists.whitelist,
|
pairs=self.pairlists.whitelist,
|
||||||
@@ -1217,7 +1217,7 @@ class Backtesting:
|
|||||||
:return: DataFrame with trades (results of backtesting)
|
:return: DataFrame with trades (results of backtesting)
|
||||||
"""
|
"""
|
||||||
self.prepare_backtest(self.enable_protections)
|
self.prepare_backtest(self.enable_protections)
|
||||||
# Ensure wallets are uptodate (important for --strategy-list)
|
# Ensure wallets are up-to-date (important for --strategy-list)
|
||||||
self.wallets.update()
|
self.wallets.update()
|
||||||
# Use dict of lists with data for performance
|
# Use dict of lists with data for performance
|
||||||
# (looping lists is a lot faster than pandas DataFrames)
|
# (looping lists is a lot faster than pandas DataFrames)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class _CustomData(ModelBase):
|
|||||||
"""
|
"""
|
||||||
CustomData database model
|
CustomData database model
|
||||||
Keeps records of metadata as key/value store
|
Keeps records of metadata as key/value store
|
||||||
for trades or global persistant values
|
for trades or global persistent values
|
||||||
One to many relationship with Trades:
|
One to many relationship with Trades:
|
||||||
- One trade can have many metadata entries
|
- One trade can have many metadata entries
|
||||||
- One metadata entry can only be associated with one Trade
|
- One metadata entry can only be associated with one Trade
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ class LocalTrade:
|
|||||||
isclose(order.safe_amount_after_fee, amount_tr, abs_tol=MATH_CLOSE_PREC)
|
isclose(order.safe_amount_after_fee, amount_tr, abs_tol=MATH_CLOSE_PREC)
|
||||||
or (not recalculating and order.safe_amount_after_fee > amount_tr)
|
or (not recalculating and order.safe_amount_after_fee > amount_tr)
|
||||||
):
|
):
|
||||||
# When recalculating a trade, only comming out to 0 can force a close
|
# When recalculating a trade, only coming out to 0 can force a close
|
||||||
self.close(order.safe_price)
|
self.close(order.safe_price)
|
||||||
else:
|
else:
|
||||||
self.recalc_trade_from_orders()
|
self.recalc_trade_from_orders()
|
||||||
@@ -1125,7 +1125,7 @@ class LocalTrade:
|
|||||||
prof = self.calculate_profit(exit_rate, exit_amount, float(avg_price))
|
prof = self.calculate_profit(exit_rate, exit_amount, float(avg_price))
|
||||||
close_profit_abs += prof.profit_abs
|
close_profit_abs += prof.profit_abs
|
||||||
if total_stake > 0:
|
if total_stake > 0:
|
||||||
# This needs to be calculated based on the last occuring exit to be aligned
|
# This needs to be calculated based on the last occurring exit to be aligned
|
||||||
# with realized_profit.
|
# with realized_profit.
|
||||||
close_profit = (close_profit_abs / total_stake) * self.leverage
|
close_profit = (close_profit_abs / total_stake) * self.leverage
|
||||||
else:
|
else:
|
||||||
@@ -1502,7 +1502,7 @@ class Trade(ModelBase, LocalTrade):
|
|||||||
id: Mapped[int] = mapped_column(Integer, primary_key=True) # type: ignore
|
id: Mapped[int] = mapped_column(Integer, primary_key=True) # type: ignore
|
||||||
|
|
||||||
orders: Mapped[List[Order]] = relationship(
|
orders: Mapped[List[Order]] = relationship(
|
||||||
"Order", order_by="Order.id", cascade="all, delete-orphan", lazy="selectin",
|
"Order", order_by="Order.id", cascade="all, delete-orphan", lazy="selection",
|
||||||
innerjoin=True) # type: ignore
|
innerjoin=True) # type: ignore
|
||||||
custom_data: Mapped[List[_CustomData]] = relationship(
|
custom_data: Mapped[List[_CustomData]] = relationship(
|
||||||
"_CustomData", cascade="all, delete-orphan",
|
"_CustomData", cascade="all, delete-orphan",
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ def generate_candlestick_graph(
|
|||||||
) -> go.Figure:
|
) -> go.Figure:
|
||||||
"""
|
"""
|
||||||
Generate the graph from the data generated by Backtesting or from DB
|
Generate the graph from the data generated by Backtesting or from DB
|
||||||
Volume will always be ploted in row2, so Row 1 and 3 are to our disposal for custom indicators
|
Volume will always be plotted in row2, so Row 1 and 3 are to our disposal for custom indicators
|
||||||
:param pair: Pair to Display on the graph
|
:param pair: Pair to Display on the graph
|
||||||
:param data: OHLCV DataFrame containing indicators and entry/exit signals
|
:param data: OHLCV DataFrame containing indicators and entry/exit signals
|
||||||
:param trades: All trades created
|
:param trades: All trades created
|
||||||
@@ -673,7 +673,7 @@ def plot_profit(config: Config) -> None:
|
|||||||
"""
|
"""
|
||||||
Plots the total profit for all pairs.
|
Plots the total profit for all pairs.
|
||||||
Note, the profit calculation isn't realistic.
|
Note, the profit calculation isn't realistic.
|
||||||
But should be somewhat proportional, and therefor useful
|
But should be somewhat proportional, and therefore useful
|
||||||
in helping out to find a good algorithm.
|
in helping out to find a good algorithm.
|
||||||
"""
|
"""
|
||||||
if 'timeframe' not in config:
|
if 'timeframe' not in config:
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class RemotePairList(IPairList):
|
|||||||
"default": "filter",
|
"default": "filter",
|
||||||
"options": ["filter", "append"],
|
"options": ["filter", "append"],
|
||||||
"description": "Processing mode",
|
"description": "Processing mode",
|
||||||
"help": "Append pairs to incomming pairlist or filter them?",
|
"help": "Append pairs to incoming pairlist or filter them?",
|
||||||
},
|
},
|
||||||
**IPairList.refresh_period_parameter(),
|
**IPairList.refresh_period_parameter(),
|
||||||
"keep_pairlist_on_failure": {
|
"keep_pairlist_on_failure": {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class VolumePairList(IPairList):
|
|||||||
self._tf_in_min = timeframe_to_minutes(self._lookback_timeframe)
|
self._tf_in_min = timeframe_to_minutes(self._lookback_timeframe)
|
||||||
_tf_in_sec = self._tf_in_min * 60
|
_tf_in_sec = self._tf_in_min * 60
|
||||||
|
|
||||||
# wether to use range lookback or not
|
# whether to use range lookback or not
|
||||||
self._use_range = (self._tf_in_min > 0) & (self._lookback_period > 0)
|
self._use_range = (self._tf_in_min > 0) & (self._lookback_period > 0)
|
||||||
|
|
||||||
if self._use_range & (self._refresh_period < _tf_in_sec):
|
if self._use_range & (self._refresh_period < _tf_in_sec):
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class IProtection(LoggingMixin, ABC):
|
|||||||
Get lock end time
|
Get lock end time
|
||||||
"""
|
"""
|
||||||
max_date: datetime = max([trade.close_date for trade in trades if trade.close_date])
|
max_date: datetime = max([trade.close_date for trade in trades if trade.close_date])
|
||||||
# comming from Database, tzinfo is not set.
|
# coming from Database, tzinfo is not set.
|
||||||
if max_date.tzinfo is None:
|
if max_date.tzinfo is None:
|
||||||
max_date = max_date.replace(tzinfo=timezone.utc)
|
max_date = max_date.replace(tzinfo=timezone.utc)
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ class IResolver:
|
|||||||
def load_object(cls, object_name: str, config: Config, *, kwargs: dict,
|
def load_object(cls, object_name: str, config: Config, *, kwargs: dict,
|
||||||
extra_dir: Optional[str] = None) -> Any:
|
extra_dir: Optional[str] = None) -> Any:
|
||||||
"""
|
"""
|
||||||
Search and loads the specified object as configured in hte child class.
|
Search and loads the specified object as configured in the child class.
|
||||||
:param object_name: name of the module to import
|
:param object_name: name of the module to import
|
||||||
:param config: configuration dictionary
|
:param config: configuration dictionary
|
||||||
:param extra_dir: additional directory to search for the given pairlist
|
:param extra_dir: additional directory to search for the given pairlist
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ class ExternalMessageConsumer:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# An unforseen error has occurred, log and continue
|
# An unforeseen error has occurred, log and continue
|
||||||
logger.error("Unexpected error has occurred:")
|
logger.error("Unexpected error has occurred:")
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
await asyncio.sleep(self.sleep_time)
|
await asyncio.sleep(self.sleep_time)
|
||||||
@@ -387,7 +387,7 @@ class ExternalMessageConsumer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not did_append:
|
if not did_append:
|
||||||
# We want an overlap in candles incase some data has changed
|
# We want an overlap in candles in case some data has changed
|
||||||
n_missing += 1
|
n_missing += 1
|
||||||
# Set to None for all candles if we missed a full df's worth of candles
|
# Set to None for all candles if we missed a full df's worth of candles
|
||||||
n_missing = n_missing if n_missing < FULL_DATAFRAME_THRESHOLD else 1500
|
n_missing = n_missing if n_missing < FULL_DATAFRAME_THRESHOLD else 1500
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ class RPC:
|
|||||||
for oo in trade.open_orders
|
for oo in trade.open_orders
|
||||||
]
|
]
|
||||||
|
|
||||||
# exemple: '*.**.**' trying to enter, exit and exit with 3 different orders
|
# example: '*.**.**' trying to enter, exit and exit with 3 different orders
|
||||||
active_attempt_side_symbols_str = '.'.join(active_attempt_side_symbols)
|
active_attempt_side_symbols_str = '.'.join(active_attempt_side_symbols)
|
||||||
|
|
||||||
detail_trade = [
|
detail_trade = [
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ class Telegram(RPCHandler):
|
|||||||
elif msg['type'] == RPCMessageType.WARNING:
|
elif msg['type'] == RPCMessageType.WARNING:
|
||||||
message = f"\N{WARNING SIGN} *Warning:* `{msg['status']}`"
|
message = f"\N{WARNING SIGN} *Warning:* `{msg['status']}`"
|
||||||
elif msg['type'] == RPCMessageType.EXCEPTION:
|
elif msg['type'] == RPCMessageType.EXCEPTION:
|
||||||
# Errors will contain exceptions, which are wrapped in tripple ticks.
|
# Errors will contain exceptions, which are wrapped in triple ticks.
|
||||||
message = f"\N{WARNING SIGN} *ERROR:* \n {msg['status']}"
|
message = f"\N{WARNING SIGN} *ERROR:* \n {msg['status']}"
|
||||||
|
|
||||||
elif msg['type'] == RPCMessageType.STARTUP:
|
elif msg['type'] == RPCMessageType.STARTUP:
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ def merge_informative_pair(dataframe: pd.DataFrame, informative: pd.DataFrame,
|
|||||||
# all indicators on the informative sample MUST be calculated before this point
|
# all indicators on the informative sample MUST be calculated before this point
|
||||||
if ffill:
|
if ffill:
|
||||||
# https://pandas.pydata.org/docs/user_guide/merging.html#timeseries-friendly-merging
|
# https://pandas.pydata.org/docs/user_guide/merging.html#timeseries-friendly-merging
|
||||||
# merge_ordered - ffill method is 2.5x faster than seperate ffill()
|
# merge_ordered - ffill method is 2.5x faster than separate ffill()
|
||||||
dataframe = pd.merge_ordered(dataframe, informative, fill_method="ffill", left_on='date',
|
dataframe = pd.merge_ordered(dataframe, informative, fill_method="ffill", left_on='date',
|
||||||
right_on=date_merge, how='left')
|
right_on=date_merge, how='left')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ def bot_loop_start(self, current_time: datetime, **kwargs) -> None:
|
|||||||
"""
|
"""
|
||||||
Called at the start of the bot iteration (one loop).
|
Called at the start of the bot iteration (one loop).
|
||||||
Might be used to perform pair-independent tasks
|
Might be used to perform pair-independent tasks
|
||||||
(e.g. gather some remote ressource for comparison)
|
(e.g. gather some remote resource for comparison)
|
||||||
|
|
||||||
For full documentation please go to https://www.freqtrade.io/en/latest/strategy-advanced/
|
For full documentation please go to https://www.freqtrade.io/en/latest/strategy-advanced/
|
||||||
|
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ class Wallets:
|
|||||||
:raise: DependencyException if the available stake amount is too low
|
:raise: DependencyException if the available stake amount is too low
|
||||||
"""
|
"""
|
||||||
stake_amount: float
|
stake_amount: float
|
||||||
# Ensure wallets are uptodate.
|
# Ensure wallets are up-to-date.
|
||||||
if update:
|
if update:
|
||||||
self.update()
|
self.update()
|
||||||
val_tied_up = Trade.total_open_trades_stakes()
|
val_tied_up = Trade.total_open_trades_stakes()
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ class Worker:
|
|||||||
Throttles the given callable that it
|
Throttles the given callable that it
|
||||||
takes at least `min_secs` to finish execution.
|
takes at least `min_secs` to finish execution.
|
||||||
:param func: Any callable
|
:param func: Any callable
|
||||||
:param throttle_secs: throttling interation execution time limit in seconds
|
:param throttle_secs: throttling iteration execution time limit in seconds
|
||||||
:param timeframe: ensure iteration is executed at the beginning of the next candle.
|
:param timeframe: ensure iteration is executed at the beginning of the next candle.
|
||||||
:param timeframe_offset: offset in seconds to apply to the next candle time.
|
:param timeframe_offset: offset in seconds to apply to the next candle time.
|
||||||
:return: Any (result of execution of func)
|
:return: Any (result of execution of func)
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ class ClientProtocol:
|
|||||||
self.logger.info("Empty DataFrame")
|
self.logger.info("Empty DataFrame")
|
||||||
|
|
||||||
async def _handle_default(self, name, type, data):
|
async def _handle_default(self, name, type, data):
|
||||||
self.logger.info("Unkown message of type {type} received...")
|
self.logger.info("Unknown message of type {type} received...")
|
||||||
self.logger.info(data)
|
self.logger.info(data)
|
||||||
|
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ async def create_client(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# An unforseen error has occurred, log and try reconnecting again
|
# An unforeseen error has occurred, log and try reconnecting again
|
||||||
logger.error("Unexpected error has occurred:")
|
logger.error("Unexpected error has occurred:")
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
|
|
||||||
|
|||||||
@@ -1609,4 +1609,4 @@ def test_start_show_config(capsys, caplog):
|
|||||||
assert "Your combined configuration is:" in captured.out
|
assert "Your combined configuration is:" in captured.out
|
||||||
assert '"max_open_trades":' in captured.out
|
assert '"max_open_trades":' in captured.out
|
||||||
assert '"secret": "REDACTED"' not in captured.out
|
assert '"secret": "REDACTED"' not in captured.out
|
||||||
assert log_has_re(r'Sensitive information will be shown in the upcomming output.*', caplog)
|
assert log_has_re(r'Sensitive information will be shown in the upcoming output.*', caplog)
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ def pytest_addoption(parser):
|
|||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.addinivalue_line(
|
config.addinivalue_line(
|
||||||
"markers", "longrun: mark test that is running slowly and should not be run regularily"
|
"markers", "longrun: mark test that is running slowly and should not be run regularly"
|
||||||
)
|
)
|
||||||
if not config.option.longrun:
|
if not config.option.longrun:
|
||||||
setattr(config.option, 'markexpr', 'not longrun')
|
setattr(config.option, 'markexpr', 'not longrun')
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ def test_datahandler__check_empty_df(testdatadir, caplog):
|
|||||||
# @pytest.mark.parametrize('datahandler', [])
|
# @pytest.mark.parametrize('datahandler', [])
|
||||||
@pytest.mark.skip("All datahandlers currently support trades data.")
|
@pytest.mark.skip("All datahandlers currently support trades data.")
|
||||||
def test_datahandler_trades_not_supported(datahandler, testdatadir, ):
|
def test_datahandler_trades_not_supported(datahandler, testdatadir, ):
|
||||||
# Currently disabled. Reenable should a new provider not support trades data.
|
# Currently disabled. Re-enable should a new provider not support trades data.
|
||||||
dh = get_datahandler(testdatadir, datahandler)
|
dh = get_datahandler(testdatadir, datahandler)
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
dh.trades_load('UNITTEST/ETH')
|
dh.trades_load('UNITTEST/ETH')
|
||||||
|
|||||||
@@ -3830,7 +3830,7 @@ def test_ohlcv_candle_limit(default_conf, mocker, exchange_name):
|
|||||||
[
|
[
|
||||||
("BTC/USDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
|
("BTC/USDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
|
||||||
("USDT/BTC", 'USDT', 'BTC', "binance", True, False, False, 'spot', {}, True),
|
("USDT/BTC", 'USDT', 'BTC', "binance", True, False, False, 'spot', {}, True),
|
||||||
# No seperating /
|
# No separating /
|
||||||
("BTCUSDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
|
("BTCUSDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
|
||||||
("BTCUSDT", None, "USDT", "binance", True, False, False, 'spot', {}, False),
|
("BTCUSDT", None, "USDT", "binance", True, False, False, 'spot', {}, False),
|
||||||
("USDT/BTC", "BTC", None, "binance", True, False, False, 'spot', {}, False),
|
("USDT/BTC", "BTC", None, "binance", True, False, False, 'spot', {}, False),
|
||||||
@@ -4346,7 +4346,7 @@ def test_combine_funding_and_mark(
|
|||||||
('binance', 0, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.00091409999),
|
('binance', 0, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.00091409999),
|
||||||
('binance', 0, 2, "2021-08-31 23:58:00", "2021-09-01 08:00:00", 30.0, -0.00091409999),
|
('binance', 0, 2, "2021-08-31 23:58:00", "2021-09-01 08:00:00", 30.0, -0.00091409999),
|
||||||
('binance', 0, 2, "2021-09-01 00:10:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
|
('binance', 0, 2, "2021-09-01 00:10:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
|
||||||
# TODO: Uncoment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
|
# TODO: Uncomment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
|
||||||
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 30.0, -0.0014937),
|
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 30.0, -0.0014937),
|
||||||
# ('kraken', "2021-09-01 00:00:15", "2021-09-01 08:00:00", 30.0, -0.0008289),
|
# ('kraken', "2021-09-01 00:00:15", "2021-09-01 08:00:00", 30.0, -0.0008289),
|
||||||
# ('kraken', "2021-09-01 01:00:14", "2021-09-01 08:00:00", 30.0, -0.0008289),
|
# ('kraken', "2021-09-01 01:00:14", "2021-09-01 08:00:00", 30.0, -0.0008289),
|
||||||
@@ -4358,7 +4358,7 @@ def test_combine_funding_and_mark(
|
|||||||
('gate', 0, 2, "2021-09-01 00:00:00", "2021-09-01 12:00:00", 30.0, -0.0009140999),
|
('gate', 0, 2, "2021-09-01 00:00:00", "2021-09-01 12:00:00", 30.0, -0.0009140999),
|
||||||
('gate', 1, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
|
('gate', 1, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
|
||||||
('binance', 0, 2, "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0015235),
|
('binance', 0, 2, "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0015235),
|
||||||
# TODO: Uncoment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
|
# TODO: Uncomment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
|
||||||
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0024895),
|
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0024895),
|
||||||
])
|
])
|
||||||
def test__fetch_and_calculate_funding_fees(
|
def test__fetch_and_calculate_funding_fees(
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ def test_get_timerange_from_backtesting_live_df_pred_not_found(mocker, freqai_co
|
|||||||
def test_set_initial_return_values(mocker, freqai_conf):
|
def test_set_initial_return_values(mocker, freqai_conf):
|
||||||
"""
|
"""
|
||||||
Simple test of the set initial return values that ensures
|
Simple test of the set initial return values that ensures
|
||||||
we are concatening and ffilling values properly.
|
we are concatenating and ffilling values properly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
strategy = get_patched_freqai_strategy(mocker, freqai_conf)
|
strategy = get_patched_freqai_strategy(mocker, freqai_conf)
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ def test_edge_overrides_stoploss(limit_order, fee, caplog, mocker,
|
|||||||
'last': enter_price * buy_price_mult,
|
'last': enter_price * buy_price_mult,
|
||||||
})
|
})
|
||||||
|
|
||||||
# stoploss shoud be hit
|
# stoploss should be hit
|
||||||
assert freqtrade.handle_trade(trade) is not ignore_strat_sl
|
assert freqtrade.handle_trade(trade) is not ignore_strat_sl
|
||||||
if not ignore_strat_sl:
|
if not ignore_strat_sl:
|
||||||
assert log_has_re('Exit for NEO/BTC detected. Reason: stop_loss.*', caplog)
|
assert log_has_re('Exit for NEO/BTC detected. Reason: stop_loss.*', caplog)
|
||||||
@@ -1398,7 +1398,7 @@ def test_update_trade_state_sell(
|
|||||||
assert order.status == 'open'
|
assert order.status == 'open'
|
||||||
freqtrade.update_trade_state(trade, trade.open_orders_ids[-1], l_order)
|
freqtrade.update_trade_state(trade, trade.open_orders_ids[-1], l_order)
|
||||||
assert trade.amount == l_order['amount']
|
assert trade.amount == l_order['amount']
|
||||||
# Wallet needs to be updated after closing a limit-sell order to reenable buying
|
# Wallet needs to be updated after closing a limit-sell order to re-enable buying
|
||||||
assert wallet_mock.call_count == 1
|
assert wallet_mock.call_count == 1
|
||||||
assert not trade.is_open
|
assert not trade.is_open
|
||||||
# Order is updated by update_trade_state
|
# Order is updated by update_trade_state
|
||||||
@@ -3240,7 +3240,7 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
|
|||||||
)
|
)
|
||||||
trade.close(ticker_usdt_sell_down()['bid'])
|
trade.close(ticker_usdt_sell_down()['bid'])
|
||||||
assert freqtrade.strategy.is_pair_locked(trade.pair, side='*')
|
assert freqtrade.strategy.is_pair_locked(trade.pair, side='*')
|
||||||
# Boths sides are locked
|
# Both sides are locked
|
||||||
assert freqtrade.strategy.is_pair_locked(trade.pair, side='long')
|
assert freqtrade.strategy.is_pair_locked(trade.pair, side='long')
|
||||||
assert freqtrade.strategy.is_pair_locked(trade.pair, side='short')
|
assert freqtrade.strategy.is_pair_locked(trade.pair, side='short')
|
||||||
|
|
||||||
@@ -4829,7 +4829,7 @@ def test_update_funding_fees(
|
|||||||
freqtrade.execute_entry('ETH/USDT', 123, is_short=is_short)
|
freqtrade.execute_entry('ETH/USDT', 123, is_short=is_short)
|
||||||
freqtrade.execute_entry('LTC/USDT', 2.0, is_short=is_short)
|
freqtrade.execute_entry('LTC/USDT', 2.0, is_short=is_short)
|
||||||
freqtrade.execute_entry('XRP/USDT', 123, is_short=is_short)
|
freqtrade.execute_entry('XRP/USDT', 123, is_short=is_short)
|
||||||
multipl = 1 if is_short else -1
|
multiple = 1 if is_short else -1
|
||||||
trades = Trade.get_open_trades()
|
trades = Trade.get_open_trades()
|
||||||
assert len(trades) == 3
|
assert len(trades) == 3
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
@@ -4847,7 +4847,7 @@ def test_update_funding_fees(
|
|||||||
assert trade.funding_fees == pytest.approx(sum(
|
assert trade.funding_fees == pytest.approx(sum(
|
||||||
trade.amount *
|
trade.amount *
|
||||||
mark_prices[trade.pair].iloc[1:2]['open'] *
|
mark_prices[trade.pair].iloc[1:2]['open'] *
|
||||||
funding_rates[trade.pair].iloc[1:2]['open'] * multipl
|
funding_rates[trade.pair].iloc[1:2]['open'] * multiple
|
||||||
))
|
))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -4859,7 +4859,7 @@ def test_update_funding_fees(
|
|||||||
trade.amount *
|
trade.amount *
|
||||||
mark_prices[trade.pair].iloc[1:2]['open'] *
|
mark_prices[trade.pair].iloc[1:2]['open'] *
|
||||||
funding_rates[trade.pair].iloc[1:2]['open'] *
|
funding_rates[trade.pair].iloc[1:2]['open'] *
|
||||||
multipl
|
multiple
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ tc5 = BTContainer(data=[
|
|||||||
trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)]
|
trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test 6: Drops 3% / Recovers 6% Positive / Closes 1% positve, Stop-Loss triggers 2% Loss
|
# Test 6: Drops 3% / Recovers 6% Positive / Closes 1% positive, Stop-Loss triggers 2% Loss
|
||||||
# stop-loss: 2% ROI: 5%
|
# stop-loss: 2% ROI: 5%
|
||||||
tc6 = BTContainer(data=[
|
tc6 = BTContainer(data=[
|
||||||
# D O H L C V EL XL ES Xs BT
|
# D O H L C V EL XL ES Xs BT
|
||||||
@@ -121,7 +121,7 @@ tc6 = BTContainer(data=[
|
|||||||
trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=2)]
|
trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=2)]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test 7: 6% Positive / 1% Negative / Close 1% Positve, ROI Triggers 3% Gain
|
# Test 7: 6% Positive / 1% Negative / Close 1% Positive, ROI Triggers 3% Gain
|
||||||
# stop-loss: 2% ROI: 3%
|
# stop-loss: 2% ROI: 3%
|
||||||
tc7 = BTContainer(data=[
|
tc7 = BTContainer(data=[
|
||||||
# D O H L C V EL XL ES Xs BT
|
# D O H L C V EL XL ES Xs BT
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ def test_backtest_position_adjustment(default_conf, fee, mocker, testdatadir) ->
|
|||||||
|
|
||||||
for _, t in results.iterrows():
|
for _, t in results.iterrows():
|
||||||
ln = data_pair.loc[data_pair["date"] == t["open_date"]]
|
ln = data_pair.loc[data_pair["date"] == t["open_date"]]
|
||||||
# Check open trade rate alignes to open rate
|
# Check open trade rate aligns to open rate
|
||||||
assert ln is not None
|
assert ln is not None
|
||||||
# check close trade rate alignes to close rate or is between high and low
|
# check close trade rate aligns to close rate or is between high and low
|
||||||
ln = data_pair.loc[data_pair["date"] == t["close_date"]]
|
ln = data_pair.loc[data_pair["date"] == t["close_date"]]
|
||||||
assert (round(ln.iloc[0]["open"], 6) == round(t["close_rate"], 6) or
|
assert (round(ln.iloc[0]["open"], 6) == round(t["close_rate"], 6) or
|
||||||
round(ln.iloc[0]["low"], 6) < round(
|
round(ln.iloc[0]["low"], 6) < round(
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ def test_lookahead_helper_text_table_lookahead_analysis_instances(lookahead_conf
|
|||||||
assert data[0][2].__contains__('too few trades')
|
assert data[0][2].__contains__('too few trades')
|
||||||
assert len(data[0]) == 3
|
assert len(data[0]) == 3
|
||||||
|
|
||||||
# now check for an error which occured after enough trades
|
# now check for an error which occurred after enough trades
|
||||||
analysis.total_signals = 12
|
analysis.total_signals = 12
|
||||||
analysis.false_entry_signals = 11
|
analysis.false_entry_signals = 11
|
||||||
analysis.false_exit_signals = 10
|
analysis.false_exit_signals = 10
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmp_path):
|
|||||||
assert strat_stats['backtest_start'] == min_date.strftime(DATETIME_PRINT_FORMAT)
|
assert strat_stats['backtest_start'] == min_date.strftime(DATETIME_PRINT_FORMAT)
|
||||||
assert strat_stats['backtest_end'] == max_date.strftime(DATETIME_PRINT_FORMAT)
|
assert strat_stats['backtest_end'] == max_date.strftime(DATETIME_PRINT_FORMAT)
|
||||||
assert strat_stats['total_trades'] == len(results['DefStrat']['results'])
|
assert strat_stats['total_trades'] == len(results['DefStrat']['results'])
|
||||||
# Above sample had no loosing trade
|
# Above sample had no losing trade
|
||||||
assert strat_stats['max_drawdown_account'] == 0.0
|
assert strat_stats['max_drawdown_account'] == 0.0
|
||||||
|
|
||||||
# Retry with losing trade
|
# Retry with losing trade
|
||||||
|
|||||||
@@ -1871,7 +1871,7 @@ def test_get_trades__query(fee, is_short):
|
|||||||
# without orders there should be no join issued.
|
# without orders there should be no join issued.
|
||||||
query1 = Trade.get_trades_query([], include_orders=False)
|
query1 = Trade.get_trades_query([], include_orders=False)
|
||||||
|
|
||||||
# Empty "with-options -> default - selectin"
|
# Empty "with-options -> default - selection"
|
||||||
assert query._with_options == ()
|
assert query._with_options == ()
|
||||||
assert query1._with_options != ()
|
assert query1._with_options != ()
|
||||||
|
|
||||||
|
|||||||
@@ -605,7 +605,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
||||||
"lookback_days": 1}],
|
"lookback_days": 1}],
|
||||||
"BTC", "binance", "default_refresh_too_short"), # OperationalException expected
|
"BTC", "binance", "default_refresh_too_short"), # OperationalException expected
|
||||||
# ambigous configuration with lookback days and period
|
# ambiguous configuration with lookback days and period
|
||||||
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
||||||
"lookback_days": 1, "lookback_period": 1}],
|
"lookback_days": 1, "lookback_period": 1}],
|
||||||
"BTC", "binance", "lookback_days_and_period"), # OperationalException expected
|
"BTC", "binance", "lookback_days_and_period"), # OperationalException expected
|
||||||
@@ -617,7 +617,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
||||||
"lookback_timeframe": "1m", "lookback_period": 2000, "refresh_period": 3600}],
|
"lookback_timeframe": "1m", "lookback_period": 2000, "refresh_period": 3600}],
|
||||||
"BTC", "binance", "lookback_exceeds_exchange_request_size"), # OperationalException expected
|
"BTC", "binance", "lookback_exceeds_exchange_request_size"), # OperationalException expected
|
||||||
# expecing pairs as given
|
# expecting pairs as given
|
||||||
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
|
||||||
"lookback_timeframe": "1d", "lookback_period": 1, "refresh_period": 86400}],
|
"lookback_timeframe": "1d", "lookback_period": 1, "refresh_period": 86400}],
|
||||||
"BTC", "binance", ['LTC/BTC', 'ETH/BTC', 'TKN/BTC', 'XRP/BTC', 'HOT/BTC']),
|
"BTC", "binance", ['LTC/BTC', 'ETH/BTC', 'TKN/BTC', 'XRP/BTC', 'HOT/BTC']),
|
||||||
|
|||||||
@@ -1619,7 +1619,7 @@ def test_api_pair_history(botclient, mocker):
|
|||||||
assert 'data' in result
|
assert 'data' in result
|
||||||
data = result['data']
|
data = result['data']
|
||||||
assert len(data) == 289
|
assert len(data) == 289
|
||||||
# analyed DF has 30 columns
|
# analyzed DF has 30 columns
|
||||||
assert len(result['columns']) == 30
|
assert len(result['columns']) == 30
|
||||||
assert len(data[0]) == 30
|
assert len(data[0]) == 30
|
||||||
date_col_idx = [idx for idx, c in enumerate(result['columns']) if c == 'date'][0]
|
date_col_idx = [idx for idx, c in enumerate(result['columns']) if c == 'date'][0]
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ def test_returns_latest_signal(ohlcv_history):
|
|||||||
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
|
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
|
||||||
|
|
||||||
_STRATEGY.config['trading_mode'] = 'futures'
|
_STRATEGY.config['trading_mode'] = 'futures'
|
||||||
# Short signal get's ignored as can_short is not set.
|
# Short signal gets ignored as can_short is not set.
|
||||||
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
|
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
|
||||||
|
|
||||||
_STRATEGY.can_short = True
|
_STRATEGY.can_short = True
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ def test_stoploss_from_open(side, profitrange):
|
|||||||
|
|
||||||
assert stoploss >= 0
|
assert stoploss >= 0
|
||||||
# Technically the formula can yield values greater than 1 for shorts
|
# Technically the formula can yield values greater than 1 for shorts
|
||||||
# eventhough it doesn't make sense because the position would be liquidated
|
# even though it doesn't make sense because the position would be liquidated
|
||||||
if side == 'long':
|
if side == 'long':
|
||||||
assert stoploss <= 1
|
assert stoploss <= 1
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ def test_add_areas(default_conf, testdatadir, caplog):
|
|||||||
assert fig == fig2
|
assert fig == fig2
|
||||||
assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog)
|
assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog)
|
||||||
|
|
||||||
# everythin given in plot config, row 3
|
# everything given in plot config, row 3
|
||||||
fig3 = add_areas(fig, 3, data, indicators)
|
fig3 = add_areas(fig, 3, data, indicators)
|
||||||
figure = fig3.layout.figure
|
figure = fig3.layout.figure
|
||||||
fill_macd = find_trace_in_fig_data(figure.data, "MACD Fill")
|
fill_macd = find_trace_in_fig_data(figure.data, "MACD Fill")
|
||||||
@@ -495,7 +495,7 @@ def test_plot_profit(default_conf, mocker, testdatadir):
|
|||||||
# no main_plot, adds empty main_plot
|
# no main_plot, adds empty main_plot
|
||||||
([], [], {'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
|
([], [], {'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
|
||||||
{'main_plot': {}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}}),
|
{'main_plot': {}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}}),
|
||||||
# indicator 1 / 2 should have prevelance
|
# indicator 1 / 2 should have prevalence
|
||||||
(['sma', 'ema3'], ['macd'],
|
(['sma', 'ema3'], ['macd'],
|
||||||
{'main_plot': {'sma': {}}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
|
{'main_plot': {'sma': {}}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
|
||||||
{'main_plot': {'sma': {}, 'ema3': {}}, 'subplots': {'Other': {'macd': {}}}}
|
{'main_plot': {'sma': {}, 'ema3': {}}, 'subplots': {'Other': {'macd': {}}}}
|
||||||
|
|||||||
Reference in New Issue
Block a user