Compare commits

...

24 Commits

Author SHA1 Message Date
Alxy Savin
e89c3f4a59
Merge d7b86ee436 into 3bbc6cbab1 2024-09-20 05:58:02 +05:30
Matthias
3bbc6cbab1 chore: bump ccxt to 4.4.5
Some checks are pending
Build Documentation / Deploy Docs through mike (push) Waiting to run
closes #10677
2024-09-19 20:41:32 +02:00
Matthias
15de53a22d chore: bump ccxt to 4.4.5
closes #10677
2024-09-19 20:36:56 +02:00
Matthias
59a44d6973
Merge pull request #10679 from freqtrade/update/binance-leverage-tiers
Some checks are pending
Build Documentation / Deploy Docs through mike (push) Waiting to run
Update Binance Leverage Tiers
2024-09-19 06:29:02 +02:00
xmatthias
7561692352 chore: update pre-commit hooks 2024-09-19 03:15:32 +00:00
Matthias
f50a633f87 docs: order table formatting
Some checks failed
Build Documentation / Deploy Docs through mike (push) Waiting to run
Binance Leverage tiers update / auto-update (push) Has been cancelled
2024-09-18 07:11:12 +02:00
Matthias
ad295946c0 fix: use precise calculation for decrease adjustment calculations 2024-09-17 20:19:22 +02:00
Aleksey Savin
d7b86ee436 ruff reformatted 2024-06-01 17:16:10 +03:00
Aleksey Savin
7a04f876c3 Merge branch 'develop' into Error-Skipping 2024-06-01 17:01:47 +03:00
Aleksey Savin
0ef7e9db13
Merge branch 'develop' into Error-Skipping 2024-06-01 00:33:53 +03:00
Aleksey Savin
ac5c22d0bc ... 2024-06-01 00:32:05 +03:00
Aleksey Savin
98ef62cb46
Delete makefile 2024-06-01 00:26:05 +03:00
Aleksey Savin
45c8161448 for local testing 2024-05-31 21:07:43 +00:00
Aleksey Savin
62c64e2467 I tweaked the ensure_data_exists function so that it always works without parameter 2024-04-28 19:59:47 +00:00
Matthias
fce4536ef2 Merge branch 'develop' into Error-Skipping 2024-04-25 21:12:20 +02:00
Aleksey Savin
0008a87232 Merge remote-tracking branch 'upstream/develop' into Error-Skipping 2024-04-25 18:38:58 +03:00
Aleksey Savin
116bcc2bce check for backtesting dataframe 2024-04-25 14:35:02 +00:00
Aleksey Savin
778add6d92 default save_backtest_models sync with docs 2024-04-25 08:18:52 +00:00
Aleksey Savin
5782124df9 flake8 2024-04-23 23:18:32 +00:00
Aleksey Savin
c5e68afb2c remove union 2024-04-23 23:11:08 +00:00
Aleksey Savin
49487afc86 fix for merge 2024-04-23 22:42:04 +00:00
Aleksey Savin
4b9f0c2fc2 remove new feature flag 2024-04-23 18:48:01 +00:00
Aleksey Savin
a72587576e check and fix formating code with ruff 2024-04-18 09:27:30 +00:00
Aleksey Savin
c537c43dd0 only warn on exceptions in backtest for freqai interface 2024-04-18 09:09:01 +00:00
5 changed files with 1962 additions and 931 deletions

View File

@ -130,20 +130,20 @@ Most properties here can be None as they are dependent on the exchange response.
| Attribute | DataType | Description |
|------------|-------------|-------------|
`trade` | Trade | Trade object this order is attached to
`ft_pair` | string | Pair this order is for
`ft_is_open` | boolean | is the order filled?
`order_type` | string | Order type as defined on the exchange - usually market, limit or stoploss
`status` | string | Status as defined by ccxt. Usually open, closed, expired or canceled
`side` | string | Buy or Sell
`price` | float | Price the order was placed at
`average` | float | Average price the order filled at
`amount` | float | Amount in base currency
`filled` | float | Filled amount (in base currency)
`remaining` | float | Remaining amount
`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.*
`order_date` | datetime | Order creation date **use `order_date_utc` instead**
`order_date_utc` | datetime | Order creation date (in UTC)
`order_fill_date` | datetime | Order fill date **use `order_fill_utc` instead**
`order_fill_date_utc` | datetime | Order fill date
| `trade` | Trade | Trade object this order is attached to |
| `ft_pair` | string | Pair this order is for |
| `ft_is_open` | boolean | is the order filled? |
| `order_type` | string | Order type as defined on the exchange - usually market, limit or stoploss |
| `status` | string | Status as defined by ccxt. Usually open, closed, expired or canceled |
| `side` | string | Buy or Sell |
| `price` | float | Price the order was placed at |
| `average` | float | Average price the order filled at |
| `amount` | float | Amount in base currency |
| `filled` | float | Filled amount (in base currency) |
| `remaining` | float | Remaining amount |
| `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.* |
| `order_date` | datetime | Order creation date **use `order_date_utc` instead** |
| `order_date_utc` | datetime | Order creation date (in UTC) |
| `order_fill_date` | datetime | Order fill date **use `order_fill_utc` instead** |
| `order_fill_date_utc` | datetime | Order fill date |

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,7 @@ class IFreqaiModel(ABC):
self.retrain = False
self.first = True
self.set_full_path()
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", True)
self.save_backtest_models: bool = self.freqai_info.get("save_backtest_models", False)
if self.save_backtest_models:
logger.info("Backtesting module configured to save all models.")
@ -258,6 +258,23 @@ class IFreqaiModel(ABC):
if self.freqai_info.get("write_metrics_to_disk", False):
self.dd.save_metric_tracker_to_disk()
def _train_model(self, dataframe_train, pair, dk, tr_backtest):
try:
self.tb_logger = get_tb_logger(
self.dd.model_type, dk.data_path, self.activate_tensorboard
)
model = self.train(dataframe_train, pair, dk)
self.tb_logger.close()
return model
except Exception as msg:
logger.warning(
f"Training {pair} raised exception {msg.__class__.__name__}. "
f"from {tr_backtest.start_fmt} to {tr_backtest.stop_fmt}."
f"Message: {msg}, skipping.",
exc_info=True,
)
return None
def start_backtesting(
self, dataframe: DataFrame, metadata: dict, dk: FreqaiDataKitchen, strategy: IStrategy
) -> FreqaiDataKitchen:
@ -352,21 +369,9 @@ class IFreqaiModel(ABC):
if not self.model_exists(dk):
dk.find_features(dataframe_train)
dk.find_labels(dataframe_train)
self.model = self._train_model(dataframe_train, pair, dk, tr_backtest)
try:
self.tb_logger = get_tb_logger(
self.dd.model_type, dk.data_path, self.activate_tensorboard
)
self.model = self.train(dataframe_train, pair, dk)
self.tb_logger.close()
except Exception as msg:
logger.warning(
f"Training {pair} raised exception {msg.__class__.__name__}. "
f"Message: {msg}, skipping.",
exc_info=True,
)
self.model = None
if self.model:
self.dd.pair_dict[pair]["trained_timestamp"] = int(tr_train.stopts)
if self.plot_features and self.model is not None:
plot_feature_importance(self.model, pair, dk, self.plot_features)
@ -379,6 +384,7 @@ class IFreqaiModel(ABC):
else:
self.model = self.dd.load_data(pair, dk)
if self.model and len(dataframe_backtest):
pred_df, do_preds = self.predict(dataframe_backtest, dk)
append_df = dk.get_predictions_to_append(pred_df, do_preds, dataframe_backtest)
dk.append_predictions(append_df)
@ -829,7 +835,7 @@ class IFreqaiModel(ABC):
:param pair: current pair
:return: if the data exists or not
"""
if self.config.get("freqai_backtest_live_models", False) and len_dataframe_backtest == 0:
if len_dataframe_backtest == 0:
logger.info(
f"No data found for pair {pair} from "
f"from {tr_backtest.start_fmt} to {tr_backtest.stop_fmt}. "

View File

@ -62,7 +62,7 @@ from freqtrade.rpc.rpc_types import (
)
from freqtrade.strategy.interface import IStrategy
from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper
from freqtrade.util import MeasureTime
from freqtrade.util import FtPrecise, MeasureTime
from freqtrade.util.migrations.binance_mig import migrate_binance_futures_names
from freqtrade.wallets import Wallets
@ -784,7 +784,14 @@ class FreqtradeBot(LoggingMixin):
if stake_amount is not None and stake_amount < 0.0:
# We should decrease our position
amount = self.exchange.amount_to_contract_precision(
trade.pair, abs(float(stake_amount * trade.amount / trade.stake_amount))
trade.pair,
abs(
float(
FtPrecise(stake_amount)
* FtPrecise(trade.amount)
/ FtPrecise(trade.stake_amount)
)
),
)
if amount == 0.0:

View File

@ -4,7 +4,7 @@ bottleneck==1.4.0
numexpr==2.10.1
pandas-ta==0.3.14b
ccxt==4.4.3
ccxt==4.4.5
cryptography==42.0.8; platform_machine == 'armv7l'
cryptography==43.0.1; platform_machine != 'armv7l'
aiohttp==3.10.5