From 2164b02c66f494bfdc60d06f9423e1b44c4160bc Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 19:55:44 +0200 Subject: [PATCH 001/145] Add initial code for trade_kraken import --- .../data/converter/trade_converter_kraken.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 freqtrade/data/converter/trade_converter_kraken.py diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py new file mode 100644 index 000000000..fa23b627a --- /dev/null +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -0,0 +1,67 @@ +import logging +from pathlib import Path + +import numpy as np +import pandas as pd + +from freqtrade.constants import DATETIME_PRINT_FORMAT, DEFAULT_TRADES_COLUMNS, Config +from freqtrade.data.converter.trade_converter import (trades_convert_types, + trades_df_remove_duplicates) +from freqtrade.resolvers import ExchangeResolver + + +logger = logging.getLogger(__name__) + +KRAKEN_CSV_TRADE_COLUMNS = ['timestamp', 'price', 'amount'] + + +def import_kraken_trades_from_csv(config: Config, convert_to: str): + """ + Import kraken trades from csv + """ + if config['exchange']['name'] != 'kraken': + raise ValueError('This function is only for kraken exchange') + + from freqtrade.data.history.idatahandler import get_datahandler + datadir: Path = config['datadir'] + data_handler = get_datahandler(datadir, data_format=convert_to) + + tradesdir: Path = config['datadir'] / 'trades_csv' + exchange = ExchangeResolver.load_exchange(config, validate=False) + # iterate through directories in this directory + data_symbols = {p.stem for p in tradesdir.rglob('*.csv')} + print(data_symbols) + + # create pair/filename mapping + markets = { + (m['symbol'], m['altname']) for m in exchange.markets.values() + if m.get('altname') in data_symbols + } + + for pair, name in markets: + dfs = [] + # Load and combine all csv files for this pair + for f in tradesdir.rglob(f"{name}.csv"): + # print(pair, f) + df = pd.read_csv(f, names=KRAKEN_CSV_TRADE_COLUMNS) + dfs.append(df) + + if not dfs: + continue + trades = pd.concat(dfs, ignore_index=True) + + trades.loc[:, 'timestamp'] = trades['timestamp'] * 1e3 + trades.loc[:, 'cost'] = trades['price'] * trades['amount'] + for col in DEFAULT_TRADES_COLUMNS: + if col not in trades.columns: + trades[col] = np.nan + + trades = trades[DEFAULT_TRADES_COLUMNS] + trades = trades_convert_types(trades) + + trades_df = trades_df_remove_duplicates(trades) + logger.info(f"{pair}: {len(trades_df)} trades, from " + f"{trades_df['date'].min():{DATETIME_PRINT_FORMAT}} to " + f"{trades_df['date'].max():{DATETIME_PRINT_FORMAT}}") + + data_handler.trades_store(pair, trades_df) From 2e430519e3dd64e77db9428b7e530193d552e488 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 19:58:50 +0200 Subject: [PATCH 002/145] Call kraken-convert in special cases --- freqtrade/data/converter/trade_converter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/freqtrade/data/converter/trade_converter.py b/freqtrade/data/converter/trade_converter.py index 398ddc85e..cbc9b5712 100644 --- a/freqtrade/data/converter/trade_converter.py +++ b/freqtrade/data/converter/trade_converter.py @@ -12,6 +12,7 @@ from freqtrade.configuration import TimeRange from freqtrade.constants import (DEFAULT_DATAFRAME_COLUMNS, DEFAULT_TRADES_COLUMNS, TRADES_DTYPES, Config, TradeList) from freqtrade.enums import CandleType +from freqtrade.exceptions import OperationalException logger = logging.getLogger(__name__) @@ -127,6 +128,15 @@ def convert_trades_format(config: Config, convert_from: str, convert_to: str, er :param convert_to: Target format :param erase: Erase source data (does not apply if source and target format are identical) """ + if convert_from == 'csv': + if config['exchange']['name'] != 'kraken': + raise OperationalException( + 'Converting from csv is only supported for kraken.' + 'Please refer to the documentation for details about this special mode.' + ) + from freqtrade.data.converter.trade_converter_kraken import import_kraken_trades_from_csv + import_kraken_trades_from_csv(config, convert_to) + from freqtrade.data.history.idatahandler import get_datahandler src = get_datahandler(config['datadir'], convert_from) trg = get_datahandler(config['datadir'], convert_to) From 1e8814b43e952e022971f3372259edcfd0cff1e8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 20:10:27 +0200 Subject: [PATCH 003/145] Improve handling of kraken dataconvert --- freqtrade/data/converter/trade_converter.py | 1 + freqtrade/data/converter/trade_converter_kraken.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/data/converter/trade_converter.py b/freqtrade/data/converter/trade_converter.py index cbc9b5712..18648a133 100644 --- a/freqtrade/data/converter/trade_converter.py +++ b/freqtrade/data/converter/trade_converter.py @@ -136,6 +136,7 @@ def convert_trades_format(config: Config, convert_from: str, convert_to: str, er ) from freqtrade.data.converter.trade_converter_kraken import import_kraken_trades_from_csv import_kraken_trades_from_csv(config, convert_to) + return from freqtrade.data.history.idatahandler import get_datahandler src = get_datahandler(config['datadir'], convert_from) diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index fa23b627a..d3d8723cc 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -30,13 +30,13 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): exchange = ExchangeResolver.load_exchange(config, validate=False) # iterate through directories in this directory data_symbols = {p.stem for p in tradesdir.rglob('*.csv')} - print(data_symbols) # create pair/filename mapping markets = { (m['symbol'], m['altname']) for m in exchange.markets.values() if m.get('altname') in data_symbols } + logger.info(f"Found csv files for {', '.join(data_symbols)}") for pair, name in markets: dfs = [] From a3f167f6dfee952c26cfd09b09deb08be0a19b85 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 20:11:58 +0200 Subject: [PATCH 004/145] Split format-from for trades to allow for trades special case --- freqtrade/commands/arguments.py | 4 ++-- freqtrade/commands/cli_options.py | 6 ++++++ freqtrade/commands/data_commands.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/freqtrade/commands/arguments.py b/freqtrade/commands/arguments.py index 5473e95e1..ffe942773 100755 --- a/freqtrade/commands/arguments.py +++ b/freqtrade/commands/arguments.py @@ -65,8 +65,8 @@ ARGS_BUILD_CONFIG = ["config"] ARGS_BUILD_STRATEGY = ["user_data_dir", "strategy", "template"] +ARGS_CONVERT_DATA_TRADES = ["pairs", "format_from_trades", "format_to", "erase", "exchange"] ARGS_CONVERT_DATA = ["pairs", "format_from", "format_to", "erase", "exchange"] - ARGS_CONVERT_DATA_OHLCV = ARGS_CONVERT_DATA + ["timeframes", "trading_mode", "candle_types"] ARGS_CONVERT_TRADES = ["pairs", "timeframes", "exchange", "dataformat_ohlcv", "dataformat_trades"] @@ -265,7 +265,7 @@ class Arguments: parents=[_common_parser], ) convert_trade_data_cmd.set_defaults(func=partial(start_convert_data, ohlcv=False)) - self._build_args(optionlist=ARGS_CONVERT_DATA, parser=convert_trade_data_cmd) + self._build_args(optionlist=ARGS_CONVERT_DATA_TRADES, parser=convert_trade_data_cmd) # Add trades-to-ohlcv subcommand convert_trade_data_cmd = subparsers.add_parser( diff --git a/freqtrade/commands/cli_options.py b/freqtrade/commands/cli_options.py index 586318e30..53147856d 100755 --- a/freqtrade/commands/cli_options.py +++ b/freqtrade/commands/cli_options.py @@ -421,6 +421,12 @@ AVAILABLE_CLI_OPTIONS = { 'desired timeframe as specified as --timeframes/-t.', action='store_true', ), + "format_from_trades": Arg( + '--format-from', + help='Source format for data conversion.', + choices=constants.AVAILABLE_DATAHANDLERS + ['csv'], + required=True, + ), "format_from": Arg( '--format-from', help='Source format for data conversion.', diff --git a/freqtrade/commands/data_commands.py b/freqtrade/commands/data_commands.py index bccc6ea9a..229373400 100644 --- a/freqtrade/commands/data_commands.py +++ b/freqtrade/commands/data_commands.py @@ -85,7 +85,7 @@ def start_convert_data(args: Dict[str, Any], ohlcv: bool = True) -> None: erase=args['erase']) else: convert_trades_format(config, - convert_from=args['format_from'], convert_to=args['format_to'], + convert_from=args['format_from_trades'], convert_to=args['format_to'], erase=args['erase']) From 488629096bcfd4b1e3315dc684811bdb940a37a9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 22:47:44 +0200 Subject: [PATCH 005/145] Improve logging in kraken-converter --- freqtrade/data/converter/trade_converter_kraken.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index d3d8723cc..256e0f205 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -46,8 +46,11 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): df = pd.read_csv(f, names=KRAKEN_CSV_TRADE_COLUMNS) dfs.append(df) + # Load existing trades data if not dfs: + logger.info(f"No data found for pair {pair}") continue + trades = pd.concat(dfs, ignore_index=True) trades.loc[:, 'timestamp'] = trades['timestamp'] * 1e3 From 83b37e2f7834a0d490100204f35c823faec99c06 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 24 Sep 2023 23:14:04 +0200 Subject: [PATCH 006/145] Add documentation for kraken data mode --- docs/exchanges.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/exchanges.md b/docs/exchanges.md index ab42cb9cf..bf8796f0e 100644 --- a/docs/exchanges.md +++ b/docs/exchanges.md @@ -136,6 +136,43 @@ Freqtrade will not attempt to change these settings. The Kraken API does only provide 720 historic candles, which is sufficient for Freqtrade dry-run and live trade modes, but is a problem for backtesting. To download data for the Kraken exchange, using `--dl-trades` is mandatory, otherwise the bot will download the same 720 candles over and over, and you'll not have enough backtest data. +To speed up downloading, you can download the [trades zip files](https://support.kraken.com/hc/en-us/articles/360047543791-Downloadable-historical-market-data-time-and-sales-) kraken provides. +These are usually updated once per quarter. Freqtrade expects these files to be placed in `user_data/data/kraken/trades_csv`. + +A structure as follows can make sense if using incremental files, with the "full" history in one directory, and incremental files in different directories. +The assumption for this mode is that the data is downloaded and unzipped keeping filenames as they are. +Duplicate content will be ignored (based on timestamp) - though the assumption is that there is no gap in the data. + +This means, if your "full" history ends in Q4 2022 - then both incremental updates Q1 2023 and Q2 2023 are available. +Not having this will lead to incomplete data, and therefore invalid results while using the data. + +``` +└── trades_csv +    ├── Kraken_full_history +    │   ├── BCHEUR.csv +    │   └── XBTEUR.csv +    ├── Kraken_Trading_History_Q1_2023 +    │   ├── BCHEUR.csv +    │   └── XBTEUR.csv +    └── Kraken_Trading_History_Q2_2023 +       ├── BCHEUR.csv +       └── XBTEUR.csv +``` + +You can convert these files into freqtrade files: + +``` bash +freqtrade convert-trade-data --exchange kraken --format-from csv --format-to feather +# Convert trade data to different ohlcv timeframes +freqtrade trades-to-ohlcv -p BTC/EUR BCH/EUR --exchange kraken -t 1m 5m 15m 1h +``` + +The converted data also makes downloading data possible, and will start the download after the latest loaded trade. + +``` bash +freqtrade download-data --exchange kraken --dl-trades -p BTC/EUR BCH/EUR +``` + !!! Warning "Downloading data from kraken" Downloading kraken data will require significantly more memory (RAM) than any other exchange, as the trades-data needs to be converted into candles on your machine. It will also take a long time, as freqtrade will need to download every single trade that happened on the exchange for the pair / timerange combination, therefore please be patient. From a7d90e2a252e6d5920bf52bbc69ba9e1af9a9f51 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Sep 2023 19:45:03 +0200 Subject: [PATCH 007/145] Minor adjustments to conversions --- freqtrade/data/converter/trade_converter_kraken.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index 256e0f205..a70a0889b 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -1,12 +1,12 @@ import logging from pathlib import Path -import numpy as np import pandas as pd from freqtrade.constants import DATETIME_PRINT_FORMAT, DEFAULT_TRADES_COLUMNS, Config from freqtrade.data.converter.trade_converter import (trades_convert_types, trades_df_remove_duplicates) +from freqtrade.data.history.idatahandler import get_datahandler from freqtrade.resolvers import ExchangeResolver @@ -22,7 +22,6 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): if config['exchange']['name'] != 'kraken': raise ValueError('This function is only for kraken exchange') - from freqtrade.data.history.idatahandler import get_datahandler datadir: Path = config['datadir'] data_handler = get_datahandler(datadir, data_format=convert_to) @@ -36,7 +35,7 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): (m['symbol'], m['altname']) for m in exchange.markets.values() if m.get('altname') in data_symbols } - logger.info(f"Found csv files for {', '.join(data_symbols)}") + logger.info(f"Found csv files for {', '.join(data_symbols)}.") for pair, name in markets: dfs = [] @@ -57,7 +56,7 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): trades.loc[:, 'cost'] = trades['price'] * trades['amount'] for col in DEFAULT_TRADES_COLUMNS: if col not in trades.columns: - trades[col] = np.nan + trades[col] = '' trades = trades[DEFAULT_TRADES_COLUMNS] trades = trades_convert_types(trades) From a2d8f92e05934f203c2026b31537a6e7ed8166e5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Sep 2023 19:46:15 +0200 Subject: [PATCH 008/145] Add rudimentary test for test_trade_converter --- tests/data/test_trade_converter_kraken.py | 46 ++ tests/testdata/kraken/trades_csv/BCHEUR.csv | 148 ++++++ .../trades_csv/incremental_q2/BCHEUR.csv | 486 ++++++++++++++++++ 3 files changed, 680 insertions(+) create mode 100644 tests/data/test_trade_converter_kraken.py create mode 100644 tests/testdata/kraken/trades_csv/BCHEUR.csv create mode 100644 tests/testdata/kraken/trades_csv/incremental_q2/BCHEUR.csv diff --git a/tests/data/test_trade_converter_kraken.py b/tests/data/test_trade_converter_kraken.py new file mode 100644 index 000000000..e400fa8c3 --- /dev/null +++ b/tests/data/test_trade_converter_kraken.py @@ -0,0 +1,46 @@ +from datetime import datetime, timezone +from pathlib import Path +from shutil import copytree +from unittest.mock import PropertyMock + +from freqtrade.data.converter.trade_converter_kraken import import_kraken_trades_from_csv +from freqtrade.data.history.idatahandler import get_datahandler +from tests.conftest import EXMS, log_has, log_has_re, patch_exchange + + +def test_import_kraken_trades_from_csv(testdatadir, tmpdir, caplog, default_conf_usdt, mocker): + default_conf_usdt['exchange']['name'] = 'kraken' + + patch_exchange(mocker, id='kraken') + mocker.patch(f'{EXMS}.markets', PropertyMock(return_value={ + 'BCH/EUR': {'symbol': 'BCH/EUR', 'id': 'BCHEUR', 'altname': 'BCHEUR'}, + })) + tmpdir1 = Path(tmpdir) + dstfile = tmpdir1 / 'BCH_EUR-trades.feather' + assert not dstfile.is_file() + default_conf_usdt['datadir'] = tmpdir1 + # There's 2 files in this tree, containing a total of 2 days. + # tests/testdata/kraken/ + # └── trades_csv + # ├── BCHEUR.csv <-- 2023-01-01 + # └── incremental_q2 + # └── BCHEUR.csv <-- 2023-01-02 + + copytree(testdatadir / 'kraken/trades_csv', tmpdir1 / 'trades_csv') + + import_kraken_trades_from_csv(default_conf_usdt, 'feather') + assert log_has("Found csv files for BCHEUR.", caplog) + assert log_has_re(r"BCH/EUR: 340 trades.* 2023-01-01.* 2023-01-02.*", caplog) + + assert dstfile.is_file() + + dh = get_datahandler(tmpdir1, 'feather') + trades = dh.trades_load('BCH_EUR') + assert len(trades) == 340 + + assert trades['date'].min().to_pydatetime() == datetime(2023, 1, 1, 0, 3, 56, + tzinfo=timezone.utc) + assert trades['date'].max().to_pydatetime() == datetime(2023, 1, 2, 23, 17, 3, + tzinfo=timezone.utc) + # ID is not filled + assert len(trades.loc[trades['id'] != '']) == 0 diff --git a/tests/testdata/kraken/trades_csv/BCHEUR.csv b/tests/testdata/kraken/trades_csv/BCHEUR.csv new file mode 100644 index 000000000..7a9ca8eb3 --- /dev/null +++ b/tests/testdata/kraken/trades_csv/BCHEUR.csv @@ -0,0 +1,148 @@ +1672531436,90.540000,1.10448420 +1672531471,90.450000,1.00000000 +1672531647,90.360000,0.28600000 +1672533909,90.000000,0.05000000 +1672533909,90.000000,0.55555555 +1672533909,90.000000,0.05000000 +1672539535,90.160000,5.15191003 +1672539535,90.170000,6.19997081 +1672541045,90.170000,0.17270970 +1672541045,90.170000,0.81109774 +1672547372,89.940000,0.51535378 +1672549388,89.820000,0.10000000 +1672552963,90.020000,0.49279466 +1672556400,90.020000,0.02188895 +1672556899,89.880000,0.95129174 +1672559791,90.040000,0.11100000 +1672562703,90.130000,5.00000000 +1672563176,90.040000,0.11106175 +1672568240,90.260000,0.49146128 +1672568359,90.270000,2.00000000 +1672568359,90.270000,15.00000000 +1672568359,90.280000,15.00000000 +1672568359,90.290000,8.00000000 +1672568359,90.310000,1.10000000 +1672568359,90.310000,5.00000000 +1672568359,90.320000,7.24209194 +1672568359,90.320000,0.33774286 +1672568359,90.340000,7.70694586 +1672568359,90.350000,1.00000000 +1672568359,90.360000,1.00000000 +1672568359,90.360000,3.44290939 +1672568359,90.370000,1.00000000 +1672568359,90.370000,1.49359404 +1672568359,90.380000,1.00000000 +1672568359,90.390000,1.00000000 +1672568359,90.390000,0.65058415 +1672568359,90.390000,3.38801189 +1672568359,90.420000,3.42212570 +1672568359,90.440000,5.15202596 +1672568359,90.450000,3.38991070 +1672568359,90.450000,0.19329203 +1672568359,90.460000,21.52896864 +1672568526,90.250000,0.28048094 +1672569016,90.340000,5.95581833 +1672569115,90.340000,6.00000000 +1672570237,90.310000,0.14993569 +1672571388,90.370000,0.21230004 +1672571631,90.370000,0.74619835 +1672574412,90.400000,0.12438419 +1672576112,90.400000,0.53000000 +1672577367,90.400000,0.47000000 +1672577367,90.370000,0.10698000 +1672579099,90.360000,0.49091739 +1672580071,90.310000,0.29699158 +1672580225,90.300000,9.00000000 +1672581264,90.280000,0.17823568 +1672581264,90.280000,0.49008938 +1672581589,90.250000,4.00000000 +1672582660,90.250000,0.17506004 +1672582660,90.250000,3.75716335 +1672585445,90.180000,0.17600000 +1672585589,90.180000,0.05426674 +1672586068,90.190000,0.20000000 +1672587250,90.120000,1.33484000 +1672587559,90.100000,0.21882576 +1672587585,90.100000,0.28075194 +1672588454,90.160000,0.19694290 +1672588454,90.170000,0.92488128 +1672589636,90.080000,0.29193475 +1672590151,90.150000,14.08171960 +1672590566,90.120000,1.01627000 +1672590888,90.270000,4.25070441 +1672590952,90.250000,0.14121710 +1672590952,90.250000,1.98437057 +1672591010,90.200000,0.34152350 +1672591010,90.190000,9.00575666 +1672591132,90.300000,0.89294468 +1672591380,90.310000,0.10531140 +1672591380,90.320000,0.72237064 +1672591390,90.260000,0.17076175 +1672591390,90.250000,0.93726662 +1672591626,90.280000,0.13803658 +1672591626,90.270000,1.39856040 +1672592025,90.330000,0.18053494 +1672592350,90.340000,3.82317350 +1672592350,90.360000,5.66081594 +1672592350,90.370000,0.23660665 +1672592350,90.380000,0.89618051 +1672592398,90.370000,1.04662011 +1672592444,90.360000,0.12419225 +1672593227,90.360000,1.96390112 +1672599481,90.710000,0.05520000 +1672599657,90.710000,39.94480000 +1672600545,90.720000,1.09096000 +1672600545,90.720000,39.99904000 +1672601235,90.790000,0.11022927 +1672601584,90.790000,0.11897764 +1672601584,90.800000,0.16215666 +1672602875,90.830000,1.00000000 +1672604100,90.820000,0.53216284 +1672604129,90.820000,0.05503577 +1672604219,90.810000,0.07234981 +1672607019,90.920000,2.00000000 +1672607019,90.920000,40.00000000 +1672607019,90.920000,8.00000000 +1672607067,90.930000,2.00000000 +1672607067,90.930000,8.00000000 +1672607067,90.930000,21.35000000 +1672607076,90.910000,5.50000000 +1672607196,90.910000,2.00000000 +1672607196,90.910000,0.30030000 +1672607310,90.890000,0.96144343 +1672607310,90.900000,0.50292482 +1672607703,90.760000,1.00000000 +1672607703,90.750000,3.52448259 +1672607703,90.750000,0.15295233 +1672607703,90.740000,0.82256508 +1672608691,90.790000,0.19963741 +1672608691,90.810000,0.31977406 +1672609051,90.820000,0.38000000 +1672609580,90.780000,0.24004396 +1672609580,90.770000,5.25995604 +1672609695,90.740000,0.98519900 +1672609697,90.740000,0.14629976 +1672609698,90.740000,0.10000000 +1672610001,90.740000,0.21984068 +1672610001,90.740000,0.08898963 +1672610507,90.760000,0.35960205 +1672610527,90.760000,0.74039795 +1672610527,90.760000,0.11030671 +1672610527,90.760000,1.82902226 +1672611326,90.680000,0.08710000 +1672612351,90.680000,1.18193004 +1672612351,90.660000,0.11985422 +1672612460,90.640000,0.22000000 +1672612460,90.600000,0.24680297 +1672612460,90.590000,0.65058415 +1672612460,90.590000,1.10000000 +1672612460,90.570000,2.78261288 +1672612485,90.520000,2.00000000 +1672612485,90.530000,1.10000000 +1672612485,90.530000,5.00000000 +1672613044,90.520000,1.08661000 +1672613471,90.550000,0.22739075 +1672613471,90.560000,0.92169701 +1672613957,90.490000,0.50000000 +1672614482,90.520000,0.19893239 +1672615187,90.530000,1.00000000 diff --git a/tests/testdata/kraken/trades_csv/incremental_q2/BCHEUR.csv b/tests/testdata/kraken/trades_csv/incremental_q2/BCHEUR.csv new file mode 100644 index 000000000..68fd844ea --- /dev/null +++ b/tests/testdata/kraken/trades_csv/incremental_q2/BCHEUR.csv @@ -0,0 +1,486 @@ +1672620536,90.070000,1.10000000 +1672621569,90.000000,0.05000000 +1672621572,89.900000,0.16781327 +1672621572,89.880000,3.21796979 +1672621574,89.680000,0.15038625 +1672621591,89.500000,0.40223000 +1672621591,89.500000,0.00000463 +1672621591,89.460000,0.42312537 +1672621591,89.460000,0.00001340 +1672621591,89.450000,0.27462660 +1672621591,89.450000,1.55812912 +1672621592,89.430000,3.49563000 +1672621592,89.430000,0.00000245 +1672621592,89.400000,3.24020755 +1672621593,89.400000,0.00000579 +1672621593,89.340000,3.39843000 +1672621593,89.340000,0.00000367 +1672621594,89.310000,3.46879000 +1672621594,89.310000,0.00000151 +1672621594,89.300000,0.23606849 +1672621594,89.300000,0.00000151 +1672621611,89.510000,0.05201346 +1672623048,89.400000,0.05000000 +1672623487,89.340000,3.29746218 +1672624539,89.480000,0.13947779 +1672630508,89.970000,0.48616536 +1672633444,89.830000,0.36077173 +1672633444,89.840000,0.18222827 +1672635717,90.070000,0.15020808 +1672638127,90.170000,0.11950000 +1672638790,90.250000,2.08482000 +1672639521,90.250000,0.00000100 +1672639521,90.350000,0.16503183 +1672639521,90.360000,0.10887277 +1672641041,90.420000,0.33000000 +1672643661,90.290000,0.16644000 +1672643664,90.290000,0.00000378 +1672643677,90.900000,0.27611440 +1672643677,90.910000,3.55887567 +1672643677,90.930000,1.94112433 +1672643681,90.930000,1.45287534 +1672643683,91.000000,0.26528000 +1672643683,91.000000,0.27938000 +1672643698,91.100000,1.02000000 +1672643698,91.090000,1.10000000 +1672643698,91.080000,9.37501459 +1672643698,91.080000,10.00000000 +1672643698,91.080000,30.20498538 +1672643740,91.050000,2.00000000 +1672643740,91.050000,1.25174226 +1672643740,91.100000,0.21657000 +1672643742,91.140000,3.41661000 +1672643742,91.140000,0.00000339 +1672643745,91.300000,0.22559000 +1672643745,91.300000,0.20927000 +1672643754,91.530000,1.46349415 +1672643754,91.500000,0.05000000 +1672643755,91.500000,0.19820000 +1672643755,91.500000,0.23323000 +1672643755,91.400000,0.25276000 +1672643755,91.400000,0.24522000 +1672643755,91.360000,0.17059000 +1672643762,91.590000,3.38609591 +1672643762,91.590000,1.70666409 +1672643762,91.590000,5.00245000 +1672643763,91.590000,0.00000222 +1672643763,91.620000,3.28019778 +1672643764,91.620000,0.00001175 +1672643764,91.680000,3.35131000 +1672643765,91.680000,0.00000053 +1672643765,91.710000,1.99999947 +1672643765,91.710000,1.45873628 +1672643780,91.800000,0.24421000 +1672643781,91.700000,0.24097000 +1672643786,91.500000,0.24123000 +1672643786,91.500000,0.23718000 +1672643917,91.440000,0.09961400 +1672643954,91.460000,1.46349415 +1672644454,91.420000,1.10000000 +1672644454,91.410000,0.90000000 +1672644817,91.290000,0.97023360 +1672644888,91.370000,5.00000000 +1672645505,91.500000,0.55869071 +1672645505,91.500000,0.20130929 +1672646731,91.680000,0.10000000 +1672647152,91.840000,1.10000000 +1672647152,91.840000,0.72640000 +1672647284,91.900000,0.10000000 +1672647284,92.000000,0.10000000 +1672647294,92.100000,0.07400739 +1672647331,92.100000,0.02599261 +1672647331,92.200000,0.10000000 +1672647408,92.300000,0.10000000 +1672647447,92.400000,0.10000000 +1672647452,92.530000,1.10000000 +1672647452,92.530000,7.07935280 +1672647452,92.520000,1.82064720 +1672647453,92.530000,7.08005995 +1672647453,92.520000,2.91994005 +1672647453,92.520000,1.10000000 +1672647453,92.520000,7.08106089 +1672647453,92.520000,0.11257595 +1672647453,92.520000,1.70636316 +1672647453,92.520000,1.61618244 +1672647977,92.290000,1.10000000 +1672647977,92.280000,6.10788595 +1672648596,92.600000,0.28769588 +1672649352,92.520000,1.00000000 +1672649722,92.360000,0.43190135 +1672649722,92.350000,0.56809865 +1672650340,92.430000,1.10000000 +1672650340,92.440000,0.17885343 +1672650340,92.450000,0.63696354 +1672651165,92.390000,40.00000000 +1672651596,92.380000,1.00000000 +1672651664,92.390000,2.00754507 +1672651716,92.380000,1.00000000 +1672651727,92.390000,1.40528155 +1672651746,92.380000,0.10934211 +1672651746,92.370000,0.14252789 +1672651865,92.410000,0.10000000 +1672651866,92.410000,0.10000000 +1672651922,92.420000,1.02836794 +1672651981,92.410000,0.33805200 +1672651982,92.410000,2.96775605 +1672652034,92.400000,40.00000000 +1672652230,92.410000,3.00000003 +1672652230,92.410000,40.00000000 +1672652462,92.560000,4.72637791 +1672652785,92.540000,0.26371093 +1672652785,92.550000,0.06028907 +1672653191,92.380000,0.11300328 +1672653191,92.370000,0.08699672 +1672654246,92.480000,1.10000000 +1672654246,92.480000,0.18835710 +1672654246,92.480000,0.71723426 +1672654327,92.420000,1.10000000 +1672654327,92.430000,0.90624217 +1672654405,92.400000,0.71000000 +1672654405,92.420000,1.10000000 +1672654405,92.430000,0.19732780 +1672654469,92.400000,0.44000000 +1672654469,92.410000,0.18835711 +1672654469,92.420000,1.10000000 +1672654469,92.420000,0.27897069 +1672654503,92.420000,1.56537046 +1672654551,92.370000,2.00000000 +1672654551,92.380000,0.00732780 +1672656132,92.360000,0.51441726 +1672656132,92.350000,0.07117974 +1672656562,92.460000,1.09777201 +1672656822,92.540000,0.25720863 +1672656822,92.550000,0.17503688 +1672657382,92.410000,0.88037274 +1672657843,92.300000,0.52109000 +1672659479,92.450000,0.86375500 +1672659527,92.450000,0.95973892 +1672659842,92.380000,0.10000000 +1672659844,92.380000,0.28000000 +1672659858,92.380000,0.40000000 +1672659860,92.380000,0.59000000 +1672659860,92.380000,0.21230377 +1672659860,92.380000,0.19581295 +1672659860,92.370000,0.05188328 +1672659880,92.440000,0.41651079 +1672659880,92.450000,1.58233921 +1672660744,92.620000,0.20825539 +1672660744,92.620000,2.00000000 +1672660744,92.620000,0.81325838 +1672660786,92.540000,0.40620484 +1672660786,92.530000,0.50322423 +1672661316,92.760000,3.00000000 +1672661316,92.760000,0.51083000 +1672661316,92.760000,0.00000750 +1672661763,92.880000,0.40600000 +1672662004,92.680000,0.63474730 +1672662021,92.610000,0.99999999 +1672662056,92.670000,0.51391586 +1672662831,92.640000,0.20718714 +1672662831,92.630000,0.19281286 +1672663146,92.780000,0.20678545 +1672664406,92.660000,0.20698630 +1672664406,92.650000,0.09207754 +1672665304,92.600000,0.27096400 +1672665644,92.560000,0.10349315 +1672665644,92.550000,0.50000000 +1672665644,92.550000,1.10000000 +1672665644,92.540000,2.29650685 +1672665885,92.680000,0.25647281 +1672666383,92.750000,1.10000000 +1672666383,92.770000,0.33443428 +1672666383,92.780000,1.61158033 +1672666724,92.620000,0.26415235 +1672666724,92.600000,0.00975325 +1672667271,92.530000,0.21512394 +1672667271,92.520000,3.44492536 +1672667271,92.520000,1.10000000 +1672667271,92.500000,13.00000000 +1672667271,92.500000,4.17971070 +1672667820,92.490000,0.90149481 +1672668419,92.600000,0.05179685 +1672668761,92.600000,0.20000000 +1672668970,92.600000,1.00000000 +1672668970,92.600000,0.36870115 +1672669497,92.870000,0.27986569 +1672669497,92.920000,0.23423604 +1672670020,92.780000,0.24749482 +1672670020,92.780000,0.22946945 +1672670088,92.860000,0.39066985 +1672670088,92.870000,0.60802221 +1672670162,92.800000,0.19533493 +1672670162,92.810000,1.57768714 +1672671482,92.970000,0.05000000 +1672671482,92.990000,0.25805040 +1672671482,93.000000,0.05500000 +1672671482,93.000000,1.17150537 +1672671484,93.030000,1.90000000 +1672671484,93.050000,0.10000000 +1672671484,93.050000,0.09533493 +1672671484,93.100000,5.50000000 +1672671597,93.210000,0.28559636 +1672671922,93.210000,0.06224165 +1672672258,93.190000,0.05360162 +1672672715,93.440000,0.35848855 +1672673021,93.390000,0.24603359 +1672673644,93.500000,1.25128947 +1672673926,93.370000,0.10000000 +1672673926,93.370000,0.10000000 +1672674245,93.570000,3.00000000 +1672674245,93.570000,0.27582332 +1672674251,93.600000,3.00000000 +1672674251,93.600000,0.27021894 +1672674269,93.620000,0.05000000 +1672674278,93.690000,0.16020297 +1672674928,93.870000,16.00000000 +1672674928,93.870000,0.42229400 +1672674928,93.880000,3.00000000 +1672674928,93.880000,0.83625840 +1672675263,93.920000,0.15897954 +1672675354,93.790000,0.05541000 +1672675420,93.750000,3.42716504 +1672675420,93.750000,1.10000000 +1672675420,93.730000,0.30071309 +1672675420,93.730000,0.26523930 +1672675420,93.720000,3.43747306 +1672675420,93.720000,2.00000000 +1672675420,93.700000,2.00000000 +1672675420,93.690000,3.50480003 +1672675420,93.690000,17.74436742 +1672675420,93.690000,2.53044755 +1672675420,93.690000,5.59187611 +1672675420,93.690000,1.10269129 +1672675420,93.690000,5.00000000 +1672675420,93.690000,10.00000000 +1672675420,93.690000,1.99522711 +1672677602,93.900000,0.33635572 +1672677602,93.890000,0.02213283 +1672677724,93.960000,0.20921217 +1672677724,93.970000,4.01815113 +1672677724,93.980000,1.10000000 +1672677724,93.980000,4.99304515 +1672678203,93.960000,0.53112491 +1672678563,93.780000,1.06849022 +1672678711,93.780000,0.25694338 +1672678807,93.720000,0.21340200 +1672678854,93.710000,0.20162914 +1672678854,93.710000,1.00949171 +1672678856,93.710000,1.48404486 +1672678996,93.660000,0.21353800 +1672679012,93.660000,0.21353800 +1672679028,93.660000,0.21356100 +1672679037,93.670000,0.11009220 +1672679037,93.660000,1.78643900 +1672679037,93.660000,3.52200393 +1672679042,93.660000,0.21353800 +1672679057,93.660000,0.21353800 +1672679072,93.670000,0.21351600 +1672679087,93.650000,0.11692327 +1672679087,93.650000,0.09663773 +1672679094,93.660000,4.95970000 +1672679104,93.660000,0.21356100 +1672679118,93.660000,0.21353800 +1672679135,93.650000,0.11692328 +1672679135,93.650000,0.09663772 +1672679151,93.650000,0.21356100 +1672679166,93.620000,0.21358400 +1672679180,93.630000,0.21360700 +1672679195,93.620000,0.21363000 +1672679212,93.620000,0.21363000 +1672679225,93.620000,0.21363000 +1672679240,93.620000,0.21363000 +1672679256,93.620000,0.21363000 +1672679273,93.630000,0.21360700 +1672679286,93.630000,0.21360700 +1672679303,93.630000,0.21360700 +1672679315,93.630000,1.39400000 +1672679318,93.640000,0.21360700 +1672679332,93.640000,0.21358400 +1672679342,93.650000,40.00000000 +1672679356,93.640000,0.21358400 +1672679370,93.640000,0.21358400 +1672679386,93.640000,0.21358400 +1672679402,93.640000,0.21358400 +1672679416,93.640000,0.21358400 +1672679432,93.640000,0.21358400 +1672679448,93.640000,0.21358400 +1672679463,93.640000,0.21358400 +1672679477,93.640000,0.21358400 +1672679494,93.620000,0.21365200 +1672679510,93.620000,0.21363000 +1672679525,93.620000,0.21363000 +1672679540,93.630000,0.21363000 +1672679554,93.630000,0.21360700 +1672679570,93.630000,0.21360700 +1672679585,93.630000,0.21360700 +1672679600,93.630000,0.21360700 +1672679615,93.630000,0.21360700 +1672679632,93.630000,0.21360700 +1672679646,93.620000,0.21363000 +1672679661,93.630000,0.21360700 +1672679676,93.630000,0.21360700 +1672679691,93.630000,0.21360700 +1672679707,93.620000,0.21363000 +1672679726,93.620000,0.21363000 +1672679741,93.620000,0.21360700 +1672679757,93.620000,0.21363000 +1672679778,93.640000,0.21360700 +1672679794,93.660000,0.21360700 +1672679809,93.680000,0.21349300 +1672679821,93.700000,0.21340200 +1672679821,93.700000,0.21353800 +1672679821,93.700000,0.21353800 +1672679821,93.700000,0.21356100 +1672679821,93.700000,0.21353800 +1672679821,93.700000,0.21353800 +1672679821,93.700000,0.21351600 +1672679821,93.700000,0.21356100 +1672679821,93.700000,0.21356100 +1672679821,93.700000,0.21353800 +1672679821,93.700000,0.21356100 +1672679821,93.700000,0.21356100 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21358400 +1672679821,93.700000,0.21365200 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21363000 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21360700 +1672679821,93.700000,0.21349300 +1672679829,93.690000,0.21349300 +1672679943,93.730000,0.10000000 +1672679943,93.740000,0.35573142 +1672680124,93.760000,0.41611649 +1672680124,93.770000,1.10000000 +1672680124,93.770000,1.00289427 +1672680599,93.710000,40.00000000 +1672680599,93.710000,40.00000000 +1672681203,93.760000,0.30635902 +1672681203,93.770000,0.68274662 +1672681262,93.710000,1.01899965 +1672681304,93.700000,40.00000000 +1672681323,93.750000,0.57938646 +1672681386,93.750000,1.48381671 +1672681458,93.750000,0.01067000 +1672681669,93.630000,40.00000000 +1672682646,93.650000,0.17545586 +1672682646,93.660000,2.04572869 +1672682700,93.660000,0.43630185 +1672683062,93.520000,0.21349300 +1672683333,93.400000,40.00000000 +1672683540,93.370000,0.37323978 +1672683540,93.360000,0.78018965 +1672683664,93.400000,40.00000000 +1672683664,93.400000,40.00000000 +1672683912,93.360000,40.00000000 +1672684035,93.380000,0.10000000 +1672684681,93.400000,40.00000000 +1672684681,93.400000,5.00000000 +1672684895,93.450000,0.28232122 +1672684895,93.450000,0.16798232 +1672684895,93.460000,2.74269478 +1672686428,93.590000,0.32054706 +1672686593,93.610000,0.18606342 +1672686593,93.600000,1.10000000 +1672686593,93.600000,0.64000000 +1672686593,93.600000,2.00000000 +1672686593,93.600000,0.56906893 +1672686763,93.580000,1.10000000 +1672686763,93.570000,0.18606343 +1672686763,93.560000,3.00000000 +1672686763,93.550000,6.66393657 +1672686853,93.600000,1.04000000 +1672686853,93.580000,0.31000000 +1672687010,93.660000,0.51441726 +1672687010,93.670000,0.49536629 +1672687144,93.660000,0.25720863 +1672687144,93.670000,0.13025611 +1672687924,93.380000,1.38703774 +1672688043,93.450000,1.10000000 +1672688043,93.470000,9.62310000 +1672688163,93.450000,0.12860432 +1672688163,93.460000,0.74330839 +1672688463,93.450000,0.12860432 +1672688463,93.460000,2.43888543 +1672689094,93.500000,0.48000000 +1672689094,93.500000,1.52000000 +1672689122,93.500000,0.69746509 +1672689605,93.380000,0.85913567 +1672690623,93.360000,1.55373756 +1672690623,93.380000,0.97334211 +1672690731,93.280000,0.37258400 +1672691284,93.510000,1.10000000 +1672691284,93.520000,0.17017217 +1672691284,93.530000,1.86482783 +1672693176,93.340000,0.08092000 +1672693262,93.400000,0.43291938 +1672694405,93.280000,0.40741109 +1672694828,93.200000,0.41321135 +1672694828,93.200000,0.12328865 +1672695290,93.240000,0.20660567 +1672695290,93.230000,1.10000000 +1672695290,93.220000,3.00000000 +1672695290,93.210000,3.44792866 +1672695290,93.200000,3.00000000 +1672695290,93.200000,1.34083632 +1672695290,93.200000,2.52411935 +1672695567,93.230000,0.09530603 +1672695997,93.310000,0.10280546 +1672696328,93.270000,0.10705255 +1672696328,93.260000,0.00294745 +1672697520,93.390000,0.38943251 +1672697520,93.400000,1.10000000 +1672697520,93.400000,0.03084631 +1672697584,93.400000,0.21413300 +1672697656,93.400000,0.21413300 +1672697671,93.400000,0.21314117 +1672698111,93.500000,0.34000000 +1672698111,93.500000,0.26617473 +1672698111,93.510000,3.39382527 +1672698284,93.430000,0.38132990 +1672698284,93.420000,1.10000000 +1672698284,93.400000,12.34766434 +1672698922,93.220000,0.11677000 +1672699624,93.220000,0.32375231 +1672699624,93.230000,1.10000000 +1672699624,93.230000,0.50000000 +1672699624,93.240000,0.07624769 +1672701005,93.000000,0.34305825 +1672701389,93.180000,0.26786932 +1672701423,93.180000,1.00000000 +1672701423,93.190000,1.10000000 +1672701423,93.190000,0.44235389 From 9e6cc5ebbd523227c992c89831cc54728e8a5796 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Sep 2023 19:46:27 +0200 Subject: [PATCH 009/145] Improve comment on special handling --- freqtrade/data/converter/trade_converter_kraken.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index a70a0889b..6ad3b66fa 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -41,12 +41,12 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): dfs = [] # Load and combine all csv files for this pair for f in tradesdir.rglob(f"{name}.csv"): - # print(pair, f) df = pd.read_csv(f, names=KRAKEN_CSV_TRADE_COLUMNS) dfs.append(df) # Load existing trades data if not dfs: + # edgecase, can only happen if the file was deleted between the above glob and here logger.info(f"No data found for pair {pair}") continue From 74709461e3b2c3fd600f541f747b018038d912b7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Sep 2023 19:48:09 +0200 Subject: [PATCH 010/145] Improve exception wording --- freqtrade/data/converter/trade_converter_kraken.py | 3 ++- tests/data/test_trade_converter_kraken.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/freqtrade/data/converter/trade_converter_kraken.py b/freqtrade/data/converter/trade_converter_kraken.py index 6ad3b66fa..5abebd6a2 100644 --- a/freqtrade/data/converter/trade_converter_kraken.py +++ b/freqtrade/data/converter/trade_converter_kraken.py @@ -7,6 +7,7 @@ from freqtrade.constants import DATETIME_PRINT_FORMAT, DEFAULT_TRADES_COLUMNS, C from freqtrade.data.converter.trade_converter import (trades_convert_types, trades_df_remove_duplicates) from freqtrade.data.history.idatahandler import get_datahandler +from freqtrade.exceptions import OperationalException from freqtrade.resolvers import ExchangeResolver @@ -20,7 +21,7 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str): Import kraken trades from csv """ if config['exchange']['name'] != 'kraken': - raise ValueError('This function is only for kraken exchange') + raise OperationalException('This function is only for the kraken exchange.') datadir: Path = config['datadir'] data_handler = get_datahandler(datadir, data_format=convert_to) diff --git a/tests/data/test_trade_converter_kraken.py b/tests/data/test_trade_converter_kraken.py index e400fa8c3..2c5bf71e0 100644 --- a/tests/data/test_trade_converter_kraken.py +++ b/tests/data/test_trade_converter_kraken.py @@ -3,12 +3,18 @@ from pathlib import Path from shutil import copytree from unittest.mock import PropertyMock +import pytest + from freqtrade.data.converter.trade_converter_kraken import import_kraken_trades_from_csv from freqtrade.data.history.idatahandler import get_datahandler +from freqtrade.exceptions import OperationalException from tests.conftest import EXMS, log_has, log_has_re, patch_exchange def test_import_kraken_trades_from_csv(testdatadir, tmpdir, caplog, default_conf_usdt, mocker): + with pytest.raises(OperationalException, match="This function is only for the kraken exchange"): + import_kraken_trades_from_csv(default_conf_usdt, 'feather') + default_conf_usdt['exchange']['name'] = 'kraken' patch_exchange(mocker, id='kraken') From 8ad6eb98968a6895333f84c3541e8de450545c8d Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 25 Sep 2023 19:55:58 +0200 Subject: [PATCH 011/145] Update parameter value to be clearer --- docs/exchanges.md | 2 +- freqtrade/commands/cli_options.py | 2 +- freqtrade/data/converter/trade_converter.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/exchanges.md b/docs/exchanges.md index bf8796f0e..237125e88 100644 --- a/docs/exchanges.md +++ b/docs/exchanges.md @@ -162,7 +162,7 @@ Not having this will lead to incomplete data, and therefore invalid results whil You can convert these files into freqtrade files: ``` bash -freqtrade convert-trade-data --exchange kraken --format-from csv --format-to feather +freqtrade convert-trade-data --exchange kraken --format-from kraken_csv --format-to feather # Convert trade data to different ohlcv timeframes freqtrade trades-to-ohlcv -p BTC/EUR BCH/EUR --exchange kraken -t 1m 5m 15m 1h ``` diff --git a/freqtrade/commands/cli_options.py b/freqtrade/commands/cli_options.py index 53147856d..4a9f36697 100755 --- a/freqtrade/commands/cli_options.py +++ b/freqtrade/commands/cli_options.py @@ -424,7 +424,7 @@ AVAILABLE_CLI_OPTIONS = { "format_from_trades": Arg( '--format-from', help='Source format for data conversion.', - choices=constants.AVAILABLE_DATAHANDLERS + ['csv'], + choices=constants.AVAILABLE_DATAHANDLERS + ['kraken_csv'], required=True, ), "format_from": Arg( diff --git a/freqtrade/data/converter/trade_converter.py b/freqtrade/data/converter/trade_converter.py index 18648a133..0485930a6 100644 --- a/freqtrade/data/converter/trade_converter.py +++ b/freqtrade/data/converter/trade_converter.py @@ -128,7 +128,7 @@ def convert_trades_format(config: Config, convert_from: str, convert_to: str, er :param convert_to: Target format :param erase: Erase source data (does not apply if source and target format are identical) """ - if convert_from == 'csv': + if convert_from == 'kraken_csv': if config['exchange']['name'] != 'kraken': raise OperationalException( 'Converting from csv is only supported for kraken.' From f7ff1dc610d48ad9fd73d227881a5a98cd6e342b Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 30 Sep 2023 13:13:18 +0200 Subject: [PATCH 012/145] Bump develop version to 2023.10-dev --- freqtrade/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index 4dfcfea21..e546b0eb5 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -1,5 +1,5 @@ """ Freqtrade bot """ -__version__ = '2023.9-dev' +__version__ = '2023.10-dev' if 'dev' in __version__: from pathlib import Path From 7e6f2cba539449b37786e68f46f491efc6b810de Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 1 Oct 2023 07:54:09 +0200 Subject: [PATCH 013/145] Move analysis command into their own subspace --- freqtrade/commands/optimize_commands.py | 4 ++-- freqtrade/optimize/analysis/__init__.py | 0 freqtrade/optimize/{ => analysis}/lookahead_analysis.py | 0 .../optimize/{ => analysis}/lookahead_analysis_helpers.py | 2 +- freqtrade/optimize/{ => analysis}/recursive_analysis.py | 0 .../optimize/{ => analysis}/recursive_analysis_helpers.py | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 freqtrade/optimize/analysis/__init__.py rename freqtrade/optimize/{ => analysis}/lookahead_analysis.py (100%) rename freqtrade/optimize/{ => analysis}/lookahead_analysis_helpers.py (99%) rename freqtrade/optimize/{ => analysis}/recursive_analysis.py (100%) rename freqtrade/optimize/{ => analysis}/recursive_analysis_helpers.py (98%) diff --git a/freqtrade/commands/optimize_commands.py b/freqtrade/commands/optimize_commands.py index 0a63753d9..b416c814f 100644 --- a/freqtrade/commands/optimize_commands.py +++ b/freqtrade/commands/optimize_commands.py @@ -140,7 +140,7 @@ def start_lookahead_analysis(args: Dict[str, Any]) -> None: :param args: Cli args from Arguments() :return: None """ - from freqtrade.optimize.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions + from freqtrade.optimize.analysis.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE) LookaheadAnalysisSubFunctions.start(config) @@ -152,7 +152,7 @@ def start_recursive_analysis(args: Dict[str, Any]) -> None: :param args: Cli args from Arguments() :return: None """ - from freqtrade.optimize.recursive_analysis_helpers import RecursiveAnalysisSubFunctions + from freqtrade.optimize.analysis.recursive_analysis_helpers import RecursiveAnalysisSubFunctions config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE) RecursiveAnalysisSubFunctions.start(config) diff --git a/freqtrade/optimize/analysis/__init__.py b/freqtrade/optimize/analysis/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/freqtrade/optimize/lookahead_analysis.py b/freqtrade/optimize/analysis/lookahead_analysis.py similarity index 100% rename from freqtrade/optimize/lookahead_analysis.py rename to freqtrade/optimize/analysis/lookahead_analysis.py diff --git a/freqtrade/optimize/lookahead_analysis_helpers.py b/freqtrade/optimize/analysis/lookahead_analysis_helpers.py similarity index 99% rename from freqtrade/optimize/lookahead_analysis_helpers.py rename to freqtrade/optimize/analysis/lookahead_analysis_helpers.py index 81ea5d61b..f8ddd73f5 100644 --- a/freqtrade/optimize/lookahead_analysis_helpers.py +++ b/freqtrade/optimize/analysis/lookahead_analysis_helpers.py @@ -7,7 +7,7 @@ import pandas as pd from freqtrade.constants import Config from freqtrade.exceptions import OperationalException -from freqtrade.optimize.lookahead_analysis import LookaheadAnalysis +from freqtrade.optimize.analysis.lookahead_analysis import LookaheadAnalysis from freqtrade.resolvers import StrategyResolver diff --git a/freqtrade/optimize/recursive_analysis.py b/freqtrade/optimize/analysis/recursive_analysis.py similarity index 100% rename from freqtrade/optimize/recursive_analysis.py rename to freqtrade/optimize/analysis/recursive_analysis.py diff --git a/freqtrade/optimize/recursive_analysis_helpers.py b/freqtrade/optimize/analysis/recursive_analysis_helpers.py similarity index 98% rename from freqtrade/optimize/recursive_analysis_helpers.py rename to freqtrade/optimize/analysis/recursive_analysis_helpers.py index ba1cf8745..3fff2125c 100644 --- a/freqtrade/optimize/recursive_analysis_helpers.py +++ b/freqtrade/optimize/analysis/recursive_analysis_helpers.py @@ -5,7 +5,7 @@ from typing import Any, Dict, List from freqtrade.constants import Config from freqtrade.exceptions import OperationalException -from freqtrade.optimize.recursive_analysis import RecursiveAnalysis +from freqtrade.optimize.analysis.recursive_analysis import RecursiveAnalysis from freqtrade.resolvers import StrategyResolver From 4db7962048cdb2b925c64011c578566d0faa5e07 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 1 Oct 2023 07:55:03 +0200 Subject: [PATCH 014/145] Update tests to new structure --- tests/optimize/test_lookahead_analysis.py | 11 ++++++----- tests/optimize/test_recursive_analysis.py | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/optimize/test_lookahead_analysis.py b/tests/optimize/test_lookahead_analysis.py index decc4706d..6dd0d2452 100644 --- a/tests/optimize/test_lookahead_analysis.py +++ b/tests/optimize/test_lookahead_analysis.py @@ -8,8 +8,8 @@ import pytest from freqtrade.commands.optimize_commands import start_lookahead_analysis from freqtrade.data.history import get_timerange from freqtrade.exceptions import OperationalException -from freqtrade.optimize.lookahead_analysis import Analysis, LookaheadAnalysis -from freqtrade.optimize.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions +from freqtrade.optimize.analysis.lookahead_analysis import Analysis, LookaheadAnalysis +from freqtrade.optimize.analysis.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions from tests.conftest import EXMS, get_args, log_has_re, patch_exchange @@ -32,7 +32,7 @@ def test_start_lookahead_analysis(mocker): single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', + 'freqtrade.optimize.analysis.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', initialize_single_lookahead_analysis=single_mock, text_table_lookahead_analysis_instances=text_table_mock, ) @@ -117,7 +117,7 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None: single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', + 'freqtrade.optimize.analysis.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', initialize_single_lookahead_analysis=single_mock, text_table_lookahead_analysis_instances=text_table_mock, ) @@ -324,7 +324,8 @@ def test_initialize_single_lookahead_analysis(lookahead_conf, mocker, caplog): lookahead_conf['timeframe'] = '5m' lookahead_conf['timerange'] = '20180119-20180122' - start_mock = mocker.patch('freqtrade.optimize.lookahead_analysis.LookaheadAnalysis.start') + start_mock = mocker.patch( + 'freqtrade.optimize.analysis.lookahead_analysis.LookaheadAnalysis.start') strategy_obj = { 'name': "strategy_test_v3_with_lookahead_bias", 'location': Path(lookahead_conf['strategy_path'], f"{lookahead_conf['strategy']}.py") diff --git a/tests/optimize/test_recursive_analysis.py b/tests/optimize/test_recursive_analysis.py index f025f5b76..0bbb1131d 100644 --- a/tests/optimize/test_recursive_analysis.py +++ b/tests/optimize/test_recursive_analysis.py @@ -8,8 +8,8 @@ import pytest from freqtrade.commands.optimize_commands import start_recursive_analysis from freqtrade.data.history import get_timerange from freqtrade.exceptions import OperationalException -from freqtrade.optimize.recursive_analysis import RecursiveAnalysis -from freqtrade.optimize.recursive_analysis_helpers import RecursiveAnalysisSubFunctions +from freqtrade.optimize.analysis.recursive_analysis import RecursiveAnalysis +from freqtrade.optimize.analysis.recursive_analysis_helpers import RecursiveAnalysisSubFunctions from tests.conftest import get_args, log_has_re, patch_exchange @@ -29,7 +29,7 @@ def test_start_recursive_analysis(mocker): single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', + 'freqtrade.optimize.analysis.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', initialize_single_recursive_analysis=single_mock, text_table_recursive_analysis_instances=text_table_mock, ) @@ -83,7 +83,7 @@ def test_recursive_helper_start(recursive_conf, mocker) -> None: single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', + 'freqtrade.optimize.analysis.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', initialize_single_recursive_analysis=single_mock, text_table_recursive_analysis_instances=text_table_mock, ) @@ -133,7 +133,8 @@ def test_initialize_single_recursive_analysis(recursive_conf, mocker, caplog): recursive_conf['timeframe'] = '5m' recursive_conf['timerange'] = '20180119-20180122' - start_mock = mocker.patch('freqtrade.optimize.recursive_analysis.RecursiveAnalysis.start') + start_mock = mocker.patch( + 'freqtrade.optimize.analysis.recursive_analysis.RecursiveAnalysis.start') strategy_obj = { 'name': "strategy_test_v3_recursive_issue", 'location': Path(recursive_conf['strategy_path'], f"{recursive_conf['strategy']}.py") From 19af144b337a27bfe803381c153bde3122113c2d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 1 Oct 2023 07:58:46 +0200 Subject: [PATCH 015/145] Improve of analysis files further --- freqtrade/commands/optimize_commands.py | 4 ++-- .../optimize/analysis/{lookahead_analysis.py => lookahead.py} | 0 .../{lookahead_analysis_helpers.py => lookahead_helpers.py} | 2 +- .../optimize/analysis/{recursive_analysis.py => recursive.py} | 0 .../{recursive_analysis_helpers.py => recursive_helpers.py} | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename freqtrade/optimize/analysis/{lookahead_analysis.py => lookahead.py} (100%) rename freqtrade/optimize/analysis/{lookahead_analysis_helpers.py => lookahead_helpers.py} (99%) rename freqtrade/optimize/analysis/{recursive_analysis.py => recursive.py} (100%) rename freqtrade/optimize/analysis/{recursive_analysis_helpers.py => recursive_helpers.py} (98%) diff --git a/freqtrade/commands/optimize_commands.py b/freqtrade/commands/optimize_commands.py index b416c814f..2238c5e0a 100644 --- a/freqtrade/commands/optimize_commands.py +++ b/freqtrade/commands/optimize_commands.py @@ -140,7 +140,7 @@ def start_lookahead_analysis(args: Dict[str, Any]) -> None: :param args: Cli args from Arguments() :return: None """ - from freqtrade.optimize.analysis.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions + from freqtrade.optimize.analysis.lookahead_helpers import LookaheadAnalysisSubFunctions config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE) LookaheadAnalysisSubFunctions.start(config) @@ -152,7 +152,7 @@ def start_recursive_analysis(args: Dict[str, Any]) -> None: :param args: Cli args from Arguments() :return: None """ - from freqtrade.optimize.analysis.recursive_analysis_helpers import RecursiveAnalysisSubFunctions + from freqtrade.optimize.analysis.recursive_helpers import RecursiveAnalysisSubFunctions config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE) RecursiveAnalysisSubFunctions.start(config) diff --git a/freqtrade/optimize/analysis/lookahead_analysis.py b/freqtrade/optimize/analysis/lookahead.py similarity index 100% rename from freqtrade/optimize/analysis/lookahead_analysis.py rename to freqtrade/optimize/analysis/lookahead.py diff --git a/freqtrade/optimize/analysis/lookahead_analysis_helpers.py b/freqtrade/optimize/analysis/lookahead_helpers.py similarity index 99% rename from freqtrade/optimize/analysis/lookahead_analysis_helpers.py rename to freqtrade/optimize/analysis/lookahead_helpers.py index f8ddd73f5..1d2b9db48 100644 --- a/freqtrade/optimize/analysis/lookahead_analysis_helpers.py +++ b/freqtrade/optimize/analysis/lookahead_helpers.py @@ -7,7 +7,7 @@ import pandas as pd from freqtrade.constants import Config from freqtrade.exceptions import OperationalException -from freqtrade.optimize.analysis.lookahead_analysis import LookaheadAnalysis +from freqtrade.optimize.analysis.lookahead import LookaheadAnalysis from freqtrade.resolvers import StrategyResolver diff --git a/freqtrade/optimize/analysis/recursive_analysis.py b/freqtrade/optimize/analysis/recursive.py similarity index 100% rename from freqtrade/optimize/analysis/recursive_analysis.py rename to freqtrade/optimize/analysis/recursive.py diff --git a/freqtrade/optimize/analysis/recursive_analysis_helpers.py b/freqtrade/optimize/analysis/recursive_helpers.py similarity index 98% rename from freqtrade/optimize/analysis/recursive_analysis_helpers.py rename to freqtrade/optimize/analysis/recursive_helpers.py index 3fff2125c..58983b245 100644 --- a/freqtrade/optimize/analysis/recursive_analysis_helpers.py +++ b/freqtrade/optimize/analysis/recursive_helpers.py @@ -5,7 +5,7 @@ from typing import Any, Dict, List from freqtrade.constants import Config from freqtrade.exceptions import OperationalException -from freqtrade.optimize.analysis.recursive_analysis import RecursiveAnalysis +from freqtrade.optimize.analysis.recursive import RecursiveAnalysis from freqtrade.resolvers import StrategyResolver From 4809c9f07aa4f3eb7ace033520842b3e983c8369 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 1 Oct 2023 08:00:09 +0200 Subject: [PATCH 016/145] Adjust tests for new naming --- tests/optimize/test_lookahead_analysis.py | 11 +++++------ tests/optimize/test_recursive_analysis.py | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/optimize/test_lookahead_analysis.py b/tests/optimize/test_lookahead_analysis.py index 6dd0d2452..8b13bddea 100644 --- a/tests/optimize/test_lookahead_analysis.py +++ b/tests/optimize/test_lookahead_analysis.py @@ -8,8 +8,8 @@ import pytest from freqtrade.commands.optimize_commands import start_lookahead_analysis from freqtrade.data.history import get_timerange from freqtrade.exceptions import OperationalException -from freqtrade.optimize.analysis.lookahead_analysis import Analysis, LookaheadAnalysis -from freqtrade.optimize.analysis.lookahead_analysis_helpers import LookaheadAnalysisSubFunctions +from freqtrade.optimize.analysis.lookahead import Analysis, LookaheadAnalysis +from freqtrade.optimize.analysis.lookahead_helpers import LookaheadAnalysisSubFunctions from tests.conftest import EXMS, get_args, log_has_re, patch_exchange @@ -32,7 +32,7 @@ def test_start_lookahead_analysis(mocker): single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.analysis.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', + 'freqtrade.optimize.analysis.lookahead_helpers.LookaheadAnalysisSubFunctions', initialize_single_lookahead_analysis=single_mock, text_table_lookahead_analysis_instances=text_table_mock, ) @@ -117,7 +117,7 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None: single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.analysis.lookahead_analysis_helpers.LookaheadAnalysisSubFunctions', + 'freqtrade.optimize.analysis.lookahead_helpers.LookaheadAnalysisSubFunctions', initialize_single_lookahead_analysis=single_mock, text_table_lookahead_analysis_instances=text_table_mock, ) @@ -324,8 +324,7 @@ def test_initialize_single_lookahead_analysis(lookahead_conf, mocker, caplog): lookahead_conf['timeframe'] = '5m' lookahead_conf['timerange'] = '20180119-20180122' - start_mock = mocker.patch( - 'freqtrade.optimize.analysis.lookahead_analysis.LookaheadAnalysis.start') + start_mock = mocker.patch('freqtrade.optimize.analysis.lookahead.LookaheadAnalysis.start') strategy_obj = { 'name': "strategy_test_v3_with_lookahead_bias", 'location': Path(lookahead_conf['strategy_path'], f"{lookahead_conf['strategy']}.py") diff --git a/tests/optimize/test_recursive_analysis.py b/tests/optimize/test_recursive_analysis.py index 0bbb1131d..aad465ff3 100644 --- a/tests/optimize/test_recursive_analysis.py +++ b/tests/optimize/test_recursive_analysis.py @@ -8,8 +8,8 @@ import pytest from freqtrade.commands.optimize_commands import start_recursive_analysis from freqtrade.data.history import get_timerange from freqtrade.exceptions import OperationalException -from freqtrade.optimize.analysis.recursive_analysis import RecursiveAnalysis -from freqtrade.optimize.analysis.recursive_analysis_helpers import RecursiveAnalysisSubFunctions +from freqtrade.optimize.analysis.recursive import RecursiveAnalysis +from freqtrade.optimize.analysis.recursive_helpers import RecursiveAnalysisSubFunctions from tests.conftest import get_args, log_has_re, patch_exchange @@ -29,7 +29,7 @@ def test_start_recursive_analysis(mocker): single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.analysis.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', + 'freqtrade.optimize.analysis.recursive_helpers.RecursiveAnalysisSubFunctions', initialize_single_recursive_analysis=single_mock, text_table_recursive_analysis_instances=text_table_mock, ) @@ -83,7 +83,7 @@ def test_recursive_helper_start(recursive_conf, mocker) -> None: single_mock = MagicMock() text_table_mock = MagicMock() mocker.patch.multiple( - 'freqtrade.optimize.analysis.recursive_analysis_helpers.RecursiveAnalysisSubFunctions', + 'freqtrade.optimize.analysis.recursive_helpers.RecursiveAnalysisSubFunctions', initialize_single_recursive_analysis=single_mock, text_table_recursive_analysis_instances=text_table_mock, ) @@ -133,8 +133,7 @@ def test_initialize_single_recursive_analysis(recursive_conf, mocker, caplog): recursive_conf['timeframe'] = '5m' recursive_conf['timerange'] = '20180119-20180122' - start_mock = mocker.patch( - 'freqtrade.optimize.analysis.recursive_analysis.RecursiveAnalysis.start') + start_mock = mocker.patch('freqtrade.optimize.analysis.recursive.RecursiveAnalysis.start') strategy_obj = { 'name': "strategy_test_v3_recursive_issue", 'location': Path(recursive_conf['strategy_path'], f"{recursive_conf['strategy']}.py") From f32a13bfb0bc53b1972e2cfe57c71c628d095cff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:40:10 +0000 Subject: [PATCH 017/145] Bump schedule from 1.2.0 to 1.2.1 Bumps [schedule](https://github.com/dbader/schedule) from 1.2.0 to 1.2.1. - [Changelog](https://github.com/dbader/schedule/blob/master/HISTORY.rst) - [Commits](https://github.com/dbader/schedule/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: schedule dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efcb478ca..1a44e01b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -54,7 +54,7 @@ prompt-toolkit==3.0.36 python-dateutil==2.8.2 #Futures -schedule==1.2.0 +schedule==1.2.1 #WS Messages websockets==11.0.3 From 0204f666b3b0d4c539957ffbc39015f95198f1c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:40:23 +0000 Subject: [PATCH 018/145] Bump ccxt from 4.0.105 to 4.0.112 Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.0.105 to 4.0.112. - [Release notes](https://github.com/ccxt/ccxt/releases) - [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md) - [Commits](https://github.com/ccxt/ccxt/compare/4.0.105...4.0.112) --- updated-dependencies: - dependency-name: ccxt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efcb478ca..4ebf301fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ numpy==1.25.2; platform_machine == 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b -ccxt==4.0.105 +ccxt==4.0.112 cryptography==41.0.3 aiohttp==3.8.5 SQLAlchemy==2.0.21 From 3868f9c6988b9d36ba5a915e3824aba41d79bc6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:40:40 +0000 Subject: [PATCH 019/145] Bump scipy from 1.11.2 to 1.11.3 Bumps [scipy](https://github.com/scipy/scipy) from 1.11.2 to 1.11.3. - [Release notes](https://github.com/scipy/scipy/releases) - [Commits](https://github.com/scipy/scipy/compare/v1.11.2...v1.11.3) --- updated-dependencies: - dependency-name: scipy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-hyperopt.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-hyperopt.txt b/requirements-hyperopt.txt index 06f8ddbaf..33d94ce1b 100644 --- a/requirements-hyperopt.txt +++ b/requirements-hyperopt.txt @@ -2,7 +2,7 @@ -r requirements.txt # Required for hyperopt -scipy==1.11.2 +scipy==1.11.3 scikit-learn==1.1.3 scikit-optimize==0.9.0 filelock==3.12.4 From fafc102573ad0ce0e342e1ad5539a647a5e08eaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:40:52 +0000 Subject: [PATCH 020/145] Bump mkdocs-material from 9.4.1 to 9.4.2 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.1 to 9.4.2. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.1...9.4.2) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 545e11f91..9e402b0b1 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,6 +1,6 @@ markdown==3.4.4 mkdocs==1.5.3 -mkdocs-material==9.4.1 +mkdocs-material==9.4.2 mdx_truly_sane_lists==1.3 pymdown-extensions==10.3 jinja2==3.1.2 From 19fb3f9b547821c618394c3b8feb5ef23218fad9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:40:59 +0000 Subject: [PATCH 021/145] Bump types-requests from 2.31.0.4 to 2.31.0.7 Bumps [types-requests](https://github.com/python/typeshed) from 2.31.0.4 to 2.31.0.7. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-requests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index ba01a71c2..421df952c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,6 +25,6 @@ nbconvert==7.8.0 # mypy types types-cachetools==5.3.0.6 types-filelock==3.2.7 -types-requests==2.31.0.4 +types-requests==2.31.0.7 types-tabulate==0.9.0.3 types-python-dateutil==2.8.19.14 From 4d920d7866a6af3dc2ed14c3e964e2c843bdec97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:41:09 +0000 Subject: [PATCH 022/145] Bump packaging from 23.1 to 23.2 Bumps [packaging](https://github.com/pypa/packaging) from 23.1 to 23.2. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/23.1...23.2) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efcb478ca..86b52855a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -61,4 +61,4 @@ websockets==11.0.3 janus==1.0.0 ast-comments==1.1.0 -packaging==23.1 +packaging==23.2 From 1f36f4802a115446f0ce04694e267e8eafb73119 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:41:23 +0000 Subject: [PATCH 023/145] Bump tensorboard from 2.14.0 to 2.14.1 Bumps [tensorboard](https://github.com/tensorflow/tensorboard) from 2.14.0 to 2.14.1. - [Release notes](https://github.com/tensorflow/tensorboard/releases) - [Changelog](https://github.com/tensorflow/tensorboard/blob/master/RELEASE.md) - [Commits](https://github.com/tensorflow/tensorboard/compare/2.14.0...2.14.1) --- updated-dependencies: - dependency-name: tensorboard dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-freqai.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-freqai.txt b/requirements-freqai.txt index 0cd68df2a..b79f02e93 100644 --- a/requirements-freqai.txt +++ b/requirements-freqai.txt @@ -8,5 +8,5 @@ joblib==1.3.2 catboost==1.2.2; 'arm' not in platform_machine lightgbm==4.1.0 xgboost==2.0.0 -tensorboard==2.14.0 +tensorboard==2.14.1 datasieve==0.1.7 From 7478c56ca50dcc109e98ecd0d8db5c2b29400b29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:41:29 +0000 Subject: [PATCH 024/145] Bump rich from 13.5.3 to 13.6.0 Bumps [rich](https://github.com/Textualize/rich) from 13.5.3 to 13.6.0. - [Release notes](https://github.com/Textualize/rich/releases) - [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md) - [Commits](https://github.com/Textualize/rich/compare/v13.5.3...v13.6.0) --- updated-dependencies: - dependency-name: rich dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efcb478ca..4fa96fa9a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,7 @@ jinja2==3.1.2 tables==3.8.0 blosc==1.11.1 joblib==1.3.2 -rich==13.5.3 +rich==13.6.0 pyarrow==13.0.0; platform_machine != 'armv7l' # find first, C search in arrays From 9edd7e6bc8516422ad17018a9d0fad900c2455b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 03:41:42 +0000 Subject: [PATCH 025/145] Bump fastapi from 0.103.1 to 0.103.2 Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.1 to 0.103.2. - [Release notes](https://github.com/tiangolo/fastapi/releases) - [Commits](https://github.com/tiangolo/fastapi/compare/0.103.1...0.103.2) --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efcb478ca..d51bc1d35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,7 +38,7 @@ orjson==3.9.7 sdnotify==0.3.2 # API Server -fastapi==0.103.1 +fastapi==0.103.2 pydantic==2.3.0 uvicorn==0.23.2 pyjwt==2.8.0 From 84335d58b3942ae0340bbdaa3afc8bb6dc3dc773 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 2 Oct 2023 06:33:57 +0200 Subject: [PATCH 026/145] Greatly speed up recursive by caching exchange --- freqtrade/optimize/analysis/recursive.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/optimize/analysis/recursive.py b/freqtrade/optimize/analysis/recursive.py index 45c2a457c..47dfc6b1a 100644 --- a/freqtrade/optimize/analysis/recursive.py +++ b/freqtrade/optimize/analysis/recursive.py @@ -120,6 +120,7 @@ class RecursiveAnalysis(BaseAnalysis): prepare_data_config['exchange']['pair_whitelist'] = pairs_to_load backtesting = Backtesting(prepare_data_config, self.exchange) + self.exchange = backtesting.exchange backtesting._set_strategy(backtesting.strategylist[0]) varholder.data, varholder.timerange = backtesting.load_bt_data() From 980960bc6ab4b8f4cfb14cccd338e4d1ac28961e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 06:18:56 +0000 Subject: [PATCH 027/145] Bump arrow from 1.2.3 to 1.3.0 Bumps [arrow](https://github.com/arrow-py/arrow) from 1.2.3 to 1.3.0. - [Release notes](https://github.com/arrow-py/arrow/releases) - [Changelog](https://github.com/arrow-py/arrow/blob/master/CHANGELOG.rst) - [Commits](https://github.com/arrow-py/arrow/compare/1.2.3...1.3.0) --- updated-dependencies: - dependency-name: arrow dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9a7587f29..14ee7ff5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ SQLAlchemy==2.0.21 python-telegram-bot==20.5 # can't be hard-pinned due to telegram-bot pinning httpx with ~ httpx>=0.24.1 -arrow==1.2.3 +arrow==1.3.0 cachetools==5.3.1 requests==2.31.0 urllib3==2.0.5 From 5feb7fe654cd1b1eeed5f4a752d07b424dac2d44 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 06:19:59 +0000 Subject: [PATCH 028/145] Bump ast-comments from 1.1.0 to 1.1.1 Bumps [ast-comments](https://github.com/t3rn0/ast-comments) from 1.1.0 to 1.1.1. - [Release notes](https://github.com/t3rn0/ast-comments/releases) - [Commits](https://github.com/t3rn0/ast-comments/compare/1.1.0...1.1.1) --- updated-dependencies: - dependency-name: ast-comments dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9a7587f29..80ac30580 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,5 +60,5 @@ schedule==1.2.1 websockets==11.0.3 janus==1.0.0 -ast-comments==1.1.0 +ast-comments==1.1.1 packaging==23.2 From b409ab5eadeb53016bdbef69ec25035949a89c50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 07:59:35 +0000 Subject: [PATCH 029/145] Bump pydantic from 2.3.0 to 2.4.2 Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.3.0 to 2.4.2. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.3.0...v2.4.2) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5cbc2a50f..ef96cc9ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -39,7 +39,7 @@ sdnotify==0.3.2 # API Server fastapi==0.103.2 -pydantic==2.3.0 +pydantic==2.4.2 uvicorn==0.23.2 pyjwt==2.8.0 aiofiles==23.2.1 From 79e59bdda0f3bab0e22ddfe7f9b4205dd22f449f Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 2 Oct 2023 13:37:49 +0200 Subject: [PATCH 030/145] Bump types-requests pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c7a1728b..13f4de236 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: additional_dependencies: - types-cachetools==5.3.0.6 - types-filelock==3.2.7 - - types-requests==2.31.0.4 + - types-requests==2.31.0.7 - types-tabulate==0.9.0.3 - types-python-dateutil==2.8.19.14 - SQLAlchemy==2.0.21 From 60c2b1d6ca1f4343e675b0dc7a20555c03771f4d Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 2 Oct 2023 18:02:36 +0200 Subject: [PATCH 031/145] Revert "Bump ast-comments from 1.1.0 to 1.1.1" --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5cbc2a50f..0e5364578 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,5 +60,5 @@ schedule==1.2.1 websockets==11.0.3 janus==1.0.0 -ast-comments==1.1.1 +ast-comments==1.1.0 packaging==23.2 From cd071c3bdce08eb1867d6a40c7b6364ff6a7cedf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:21:57 +0000 Subject: [PATCH 032/145] Bump cryptography from 41.0.3 to 41.0.4 Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.3 to 41.0.4. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/41.0.3...41.0.4) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index aa646e585..ce2f310c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ pandas==2.0.3 pandas-ta==0.3.14b ccxt==4.0.112 -cryptography==41.0.3 +cryptography==41.0.4 aiohttp==3.8.5 SQLAlchemy==2.0.21 python-telegram-bot==20.5 From 183166b3fbeebf110a084e9503def2c03f4ff2fe Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Tue, 3 Oct 2023 08:27:28 +0900 Subject: [PATCH 033/145] fix output if no variance, and fix docs --- docs/backtesting.md | 4 +-- docs/recursive-analysis.md | 34 +++++++++++++++++-- freqtrade/optimize/analysis/recursive.py | 4 +-- .../optimize/analysis/recursive_helpers.py | 17 +++++----- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/docs/backtesting.md b/docs/backtesting.md index d1cd61057..41498fb00 100644 --- a/docs/backtesting.md +++ b/docs/backtesting.md @@ -31,9 +31,9 @@ optional arguments: Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). --timerange TIMERANGE Specify what timerange of data to use. - --data-format-ohlcv {json,jsongz,hdf5} + --data-format-ohlcv {json,jsongz,hdf5,feather,parquet} Storage format for downloaded candle (OHLCV) data. - (default: `json`). + (default: `feather`). --max-open-trades INT Override the value of the `max_open_trades` configuration setting. diff --git a/docs/recursive-analysis.md b/docs/recursive-analysis.md index 512b79f8f..07ef2121c 100644 --- a/docs/recursive-analysis.md +++ b/docs/recursive-analysis.md @@ -40,11 +40,41 @@ usage: freqtrade recursive-analysis [-h] [-v] [--logfile FILE] [-V] [-c PATH] [--startup-candle STARTUP_CANDLES [STARTUP_CANDLES ...]] optional arguments: --p PAIR, --pairs PAIR + -h, --help show this help message and exit + -i TIMEFRAME, --timeframe TIMEFRAME + Specify timeframe (`1m`, `5m`, `30m`, `1h`, `1d`). + --data-format-ohlcv {json,jsongz,hdf5,feather,parquet} + Storage format for downloaded candle (OHLCV) data. + (default: `feather`). + -p PAIR, --pairs PAIR Limit command to this pair. ---startup-candle STARTUP_CANDLE [STARTUP_CANDLE ...] + --startup-candle STARTUP_CANDLE [STARTUP_CANDLE ...] Provide a space-separated list of startup_candle_count to be checked. Default : `199 399 499 999 1999`. + +Common arguments: + -v, --verbose Verbose mode (-vv for more, -vvv to get all messages). + --logfile FILE Log to the file specified. Special values are: + 'syslog', 'journald'. See the documentation for more + details. + -V, --version show program's version number and exit + -c PATH, --config PATH + Specify configuration file (default: + `userdir/config.json` or `config.json` whichever + exists). Multiple --config options may be used. Can be + set to `-` to read config from stdin. + -d PATH, --datadir PATH + Path to directory with historical backtesting data. + --userdir PATH, --user-data-dir PATH + Path to userdata directory. + +Strategy arguments: + -s NAME, --strategy NAME + Specify strategy class name which will be used by the + bot. + --strategy-path PATH Specify additional strategy lookup path. + --timerange TIMERANGE + Specify what timerange of data to use. ``` ### Why are odd-numbered default startup candles used? diff --git a/freqtrade/optimize/analysis/recursive.py b/freqtrade/optimize/analysis/recursive.py index 47dfc6b1a..5a41f8795 100644 --- a/freqtrade/optimize/analysis/recursive.py +++ b/freqtrade/optimize/analysis/recursive.py @@ -64,7 +64,7 @@ class RecursiveAnalysis(BaseAnalysis): self.dict_recursive[indicator][part.startup_candle] = f"{diff:.3f}%" else: - logger.info("No difference found. Stop the process.") + logger.info("No variance on indicator(s) found due to recursive formula.") break # For lookahead bias check @@ -100,7 +100,7 @@ class RecursiveAnalysis(BaseAnalysis): # logger.info("part value {:.5f}".format(values_diff_other)) else: - logger.info("No lookahead bias on indicators found. Stop the process.") + logger.info("No lookahead bias on indicators found.") def prepare_data(self, varholder: VarHolder, pairs_to_load: List[DataFrame]): diff --git a/freqtrade/optimize/analysis/recursive_helpers.py b/freqtrade/optimize/analysis/recursive_helpers.py index 58983b245..463f6acdc 100644 --- a/freqtrade/optimize/analysis/recursive_helpers.py +++ b/freqtrade/optimize/analysis/recursive_helpers.py @@ -31,10 +31,13 @@ class RecursiveAnalysisSubFunctions: temp_data.append(values.get(int(candle), '-')) data.append(temp_data) - from tabulate import tabulate - table = tabulate(data, headers=headers, tablefmt="orgtbl") - print(table) - return table, headers, data + if len(data) > 0: + from tabulate import tabulate + table = tabulate(data, headers=headers, tablefmt="orgtbl") + print(table) + return table, headers, data + + return None @staticmethod def calculate_config_overrides(config: Config): @@ -81,8 +84,7 @@ class RecursiveAnalysisSubFunctions: if not (strategy_list := config.get('strategy_list', [])): if config.get('strategy') is None: raise OperationalException( - "No Strategy specified. Please specify a strategy via --strategy or " - "--strategy-list" + "No Strategy specified. Please specify a strategy via --strategy" ) strategy_list = [config['strategy']] @@ -101,6 +103,5 @@ class RecursiveAnalysisSubFunctions: RecursiveAnalysis_instances) else: logger.error("There were no strategies specified neither through " - "--strategy nor through " - "--strategy-list " + "--strategy " "or timeframe was not specified.") From 609ed2d7b3898e6816122364cb8e37373db5162b Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 3 Oct 2023 08:41:05 +0900 Subject: [PATCH 034/145] fix return values --- freqtrade/optimize/analysis/recursive_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/optimize/analysis/recursive_helpers.py b/freqtrade/optimize/analysis/recursive_helpers.py index 463f6acdc..5ee03a9ce 100644 --- a/freqtrade/optimize/analysis/recursive_helpers.py +++ b/freqtrade/optimize/analysis/recursive_helpers.py @@ -37,7 +37,7 @@ class RecursiveAnalysisSubFunctions: print(table) return table, headers, data - return None + return None, None, data @staticmethod def calculate_config_overrides(config: Config): From 3c2e043e8286d8baa57debb044ae6124391c1be2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 00:22:39 +0000 Subject: [PATCH 035/145] Bump urllib3 from 2.0.5 to 2.0.6 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.5 to 2.0.6. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/v2.0.5...2.0.6) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 145c23352..b55d83bb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ httpx>=0.24.1 arrow==1.3.0 cachetools==5.3.1 requests==2.31.0 -urllib3==2.0.5 +urllib3==2.0.6 jsonschema==4.19.1 TA-Lib==0.4.28 technical==1.4.0 From f14b4133c3a827dddd39053b1629d4b93d931d9f Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Tue, 3 Oct 2023 13:36:31 +0900 Subject: [PATCH 036/145] fix wording --- freqtrade/optimize/analysis/recursive_helpers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/freqtrade/optimize/analysis/recursive_helpers.py b/freqtrade/optimize/analysis/recursive_helpers.py index 5ee03a9ce..32dbce149 100644 --- a/freqtrade/optimize/analysis/recursive_helpers.py +++ b/freqtrade/optimize/analysis/recursive_helpers.py @@ -102,6 +102,5 @@ class RecursiveAnalysisSubFunctions: RecursiveAnalysisSubFunctions.text_table_recursive_analysis_instances( RecursiveAnalysis_instances) else: - logger.error("There were no strategies specified neither through " - "--strategy " + logger.error("There was no strategy specified through --strategy " "or timeframe was not specified.") From b2796b850b871dbe36c44f8b8c352fcda0ee9a98 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Oct 2023 06:36:31 +0200 Subject: [PATCH 037/145] Add funding_fee export to order object Helps debugging #9163 --- freqtrade/persistence/trade_model.py | 1 + tests/rpc/test_rpc.py | 1 + 2 files changed, 2 insertions(+) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 8efce76d1..631585127 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -237,6 +237,7 @@ class Order(ModelBase): 'price': self.price, 'remaining': self.remaining, 'ft_fee_base': self.ft_fee_base, + 'funding_fee': self.funding_fee, }) return resp diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index b8eb51a91..7ea9dae89 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -99,6 +99,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'order_filled_timestamp': ANY, 'order_type': 'limit', 'price': 1.098e-05, 'is_open': False, 'pair': 'ETH/BTC', 'order_id': ANY, 'remaining': ANY, 'status': ANY, 'ft_is_entry': True, 'ft_fee_base': None, + 'funding_fee': ANY, }], } mocker.patch('freqtrade.rpc.telegram.Telegram', MagicMock()) From 04409602a6ff609de034dcab6cbc61af59c208fa Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Oct 2023 07:10:51 +0200 Subject: [PATCH 038/145] Remove numpy armv7l lock since wheels are now available --- docker/Dockerfile.armhf | 4 ++-- requirements.txt | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.armhf b/docker/Dockerfile.armhf index 902cab9aa..5431706d8 100644 --- a/docker/Dockerfile.armhf +++ b/docker/Dockerfile.armhf @@ -36,9 +36,9 @@ ENV LD_LIBRARY_PATH /usr/local/lib # Install dependencies COPY --chown=ftuser:ftuser requirements.txt /freqtrade/ USER ftuser -RUN pip install --user --no-cache-dir numpy==1.25.2 \ +RUN pip install --user --no-cache-dir numpy \ && pip install --user /tmp/pyarrow-*.whl \ - && pip install --user --no-build-isolation TA-Lib==0.4.28 \ + && pip install --user TA-Lib==0.4.28 \ && pip install --user --no-cache-dir -r requirements.txt # Copy dependencies to runtime-image diff --git a/requirements.txt b/requirements.txt index b55d83bb1..803843129 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -numpy==1.26.0; platform_machine != 'armv7l' -numpy==1.25.2; platform_machine == 'armv7l' +numpy==1.26.0 pandas==2.0.3 pandas-ta==0.3.14b From 5bfd3fdc33f6a1c4a7865947e50f6c0b79fcab8d Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Oct 2023 17:55:06 +0200 Subject: [PATCH 039/145] Add openblas to armhf image --- docker/Dockerfile.armhf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.armhf b/docker/Dockerfile.armhf index 5431706d8..231305778 100644 --- a/docker/Dockerfile.armhf +++ b/docker/Dockerfile.armhf @@ -23,7 +23,7 @@ WORKDIR /freqtrade # Install dependencies FROM base as python-deps RUN apt-get update \ - && apt-get -y install build-essential libssl-dev libffi-dev libgfortran5 pkg-config cmake gcc \ + && apt-get -y install build-essential libssl-dev libffi-dev libopenblas-dev libgfortran5 pkg-config cmake gcc \ && apt-get clean \ && pip install --upgrade pip \ && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf From 1d941249ede429be41c0729d8f54ca09ecec0144 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 4 Oct 2023 19:57:26 +0200 Subject: [PATCH 040/145] Revert "Remove numpy armv7l lock since wheels are now available" This reverts commit 04409602a6ff609de034dcab6cbc61af59c208fa. --- docker/Dockerfile.armhf | 4 ++-- requirements.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.armhf b/docker/Dockerfile.armhf index 231305778..9e518a01d 100644 --- a/docker/Dockerfile.armhf +++ b/docker/Dockerfile.armhf @@ -36,9 +36,9 @@ ENV LD_LIBRARY_PATH /usr/local/lib # Install dependencies COPY --chown=ftuser:ftuser requirements.txt /freqtrade/ USER ftuser -RUN pip install --user --no-cache-dir numpy \ +RUN pip install --user --no-cache-dir numpy==1.25.2 \ && pip install --user /tmp/pyarrow-*.whl \ - && pip install --user TA-Lib==0.4.28 \ + && pip install --user --no-build-isolation TA-Lib==0.4.28 \ && pip install --user --no-cache-dir -r requirements.txt # Copy dependencies to runtime-image diff --git a/requirements.txt b/requirements.txt index 163e0fbba..2f40b1c4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -numpy==1.26.0 +numpy==1.26.0; platform_machine != 'armv7l' +numpy==1.25.2; platform_machine == 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b From 1e0d622d80cd50631e88761af5ddd8cf0aa7e00e Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Oct 2023 06:45:00 +0200 Subject: [PATCH 041/145] Don't run "recovery" when stop-orders are open --- freqtrade/freqtradebot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 02d43432d..5345db161 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1087,7 +1087,11 @@ class FreqtradeBot(LoggingMixin): trades_closed = 0 for trade in trades: - if not trade.has_open_orders and not self.wallets.check_exit_amount(trade): + if ( + not trade.has_open_orders + and not trade.stoploss_order_id + and not self.wallets.check_exit_amount(trade) + ): logger.warning( f'Not enough {trade.safe_base_currency} in wallet to exit {trade}. ' 'Trying to recover.') From b2ad40253f52b0f2bcf07d9bb91ed09f7ba20de3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Oct 2023 07:03:29 +0200 Subject: [PATCH 042/145] Hide most non-freqtrade logs in `-v` mode --- freqtrade/loggers/set_log_levels.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/freqtrade/loggers/set_log_levels.py b/freqtrade/loggers/set_log_levels.py index 7311fa0a0..abaee1523 100644 --- a/freqtrade/loggers/set_log_levels.py +++ b/freqtrade/loggers/set_log_levels.py @@ -8,15 +8,13 @@ logger = logging.getLogger(__name__) def set_loggers(verbosity: int = 0, api_verbosity: str = 'info') -> None: """ Set the logging level for third party libraries + :param verbosity: Verbosity level. amount of `-v` passed to the command line :return: None """ - - logging.getLogger('requests').setLevel( - logging.INFO if verbosity <= 1 else logging.DEBUG - ) - logging.getLogger("urllib3").setLevel( - logging.INFO if verbosity <= 1 else logging.DEBUG - ) + for logger_name in ('requests', 'urllib3', 'httpcore'): + logging.getLogger(logger_name).setLevel( + logging.INFO if verbosity <= 1 else logging.DEBUG + ) logging.getLogger('ccxt.base.exchange').setLevel( logging.INFO if verbosity <= 2 else logging.DEBUG ) From f5db856a755c0b42b46da9252a22fc903687cc90 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Oct 2023 18:11:35 +0200 Subject: [PATCH 043/145] re-align adjust_entry_price between backtest and live --- freqtrade/freqtradebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 5345db161..17b799601 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1435,7 +1435,7 @@ class FreqtradeBot(LoggingMixin): trade=trade, order=order_obj, pair=trade.pair, current_time=datetime.now(timezone.utc), proposed_rate=proposed_rate, current_order_rate=order_obj.safe_price, entry_tag=trade.enter_tag, - side=trade.entry_side) + side=trade.trade_direction) replacing = True cancel_reason = constants.CANCEL_REASON['REPLACE'] From 1ef5adbb0eadc66344a78f1c3a6d0d7ca0c1e9c8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 6 Oct 2023 20:13:11 +0200 Subject: [PATCH 044/145] Test for #9270 --- tests/test_freqtradebot.py | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 9791a92ff..79bd2904c 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -2899,6 +2899,51 @@ def test_adjust_entry_replace_fail( assert freqtrade.strategy.adjust_entry_price.call_count == 1 +@pytest.mark.parametrize("is_short", [False, True]) +def test_adjust_entry_replace_fail_create_order( + default_conf_usdt, ticker_usdt, limit_buy_order_old, open_trade, + limit_sell_order_old, fee, mocker, caplog, is_short +) -> None: + freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt) + old_order = limit_sell_order_old if is_short else limit_buy_order_old + old_order['id'] = open_trade.open_orders[0].order_id + limit_entry_cancel = deepcopy(old_order) + limit_entry_cancel['status'] = 'canceled' + cancel_order_mock = MagicMock(return_value=limit_entry_cancel) + fetch_order_mock = MagicMock(return_value=old_order) + mocker.patch.multiple( + EXMS, + fetch_ticker=ticker_usdt, + fetch_order=fetch_order_mock, + cancel_order_with_result=cancel_order_mock, + get_fee=fee + ) + mocker.patch('freqtrade.freqtradebot.sleep') + mocker.patch('freqtrade.freqtradebot.FreqtradeBot.execute_entry', + side_effect=DependencyException()) + + open_trade.is_short = is_short + Trade.session.add(open_trade) + Trade.commit() + + # Timeout to not interfere + freqtrade.strategy.ft_check_timed_out = MagicMock(return_value=False) + + # Attempt replace order - which fails + freqtrade.strategy.adjust_entry_price = MagicMock(return_value=12234) + freqtrade.manage_open_orders() + trades = Trade.session.scalars( + select(Trade) + .where(Trade.is_open.is_(True)) + ).all() + + assert len(trades) == 0 + assert len(Order.session.scalars(select(Order)).all()) == 0 + assert fetch_order_mock.call_count == 1 + assert log_has_re( + r"Could not replace order for.*", caplog) + + @pytest.mark.parametrize("is_short", [False, True]) def test_adjust_entry_maintain_replace( default_conf_usdt, ticker_usdt, limit_buy_order_old, open_trade, From 910e317a4586fab6ac11211d90ea04f891e7afa4 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 6 Oct 2023 20:13:37 +0200 Subject: [PATCH 045/145] Fix unhandled exception closes #9270 --- freqtrade/freqtradebot.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 17b799601..7fdff5420 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -749,6 +749,7 @@ class FreqtradeBot(LoggingMixin): :param pair: pair for which we want to create a LIMIT_BUY :param stake_amount: amount of stake-currency for the pair :return: True if a buy order is created, false if it fails. + :raise: DependencyException or it's subclasses like ExchangeError. """ time_in_force = self.strategy.order_time_in_force['entry'] @@ -1452,15 +1453,21 @@ class FreqtradeBot(LoggingMixin): return if adjusted_entry_price: # place new order only if new price is supplied - if not self.execute_entry( - pair=trade.pair, - stake_amount=( - order_obj.safe_remaining * order_obj.safe_price / trade.leverage), - price=adjusted_entry_price, - trade=trade, - is_short=trade.is_short, - mode='replace', - ): + try: + if not self.execute_entry( + pair=trade.pair, + stake_amount=( + order_obj.safe_remaining * order_obj.safe_price / trade.leverage), + price=adjusted_entry_price, + trade=trade, + is_short=trade.is_short, + mode='replace', + ): + self.replace_order_failed( + trade, f"Could not replace order for {trade}.") + except DependencyException as exception: + logger.warning( + f'Unable to replace order for {trade.pair}: {exception}') self.replace_order_failed(trade, f"Could not replace order for {trade}.") def cancel_all_open_orders(self) -> None: From 178c0972ff669530a0b1ce6d2498e78bafdd7019 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 7 Oct 2023 08:43:06 +0200 Subject: [PATCH 046/145] Read funding_fee on order objects in "from_json" --- freqtrade/persistence/trade_model.py | 1 + tests/persistence/test_trade_fromjson.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 631585127..ea48d5466 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -1817,6 +1817,7 @@ class Trade(ModelBase, LocalTrade): price=order["price"], ft_price=order["price"], remaining=order["remaining"], + funding_fee=order.get("funding_fee", None), ) trade.orders.append(order_obj) diff --git a/tests/persistence/test_trade_fromjson.py b/tests/persistence/test_trade_fromjson.py index 24a693c75..e565b06d4 100644 --- a/tests/persistence/test_trade_fromjson.py +++ b/tests/persistence/test_trade_fromjson.py @@ -170,7 +170,8 @@ def test_trade_fromjson(): "order_filled_date": "2022-10-18 09:45:22", "order_type": "market", "price": 0.2592, - "remaining": 0.0 + "remaining": 0.0, + "funding_fee": -0.055 } ] }""" @@ -192,3 +193,4 @@ def test_trade_fromjson(): last_o = trade.orders[-1] assert last_o.order_filled_utc == datetime(2022, 10, 18, 9, 45, 22, tzinfo=timezone.utc) assert isinstance(last_o.order_date, datetime) + assert last_o.funding_fee == -0.055 From 081411fba4db508491ed8514a93b69dc0a812820 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 7 Oct 2023 15:09:34 +0200 Subject: [PATCH 047/145] Improve bot typehints --- freqtrade/freqtradebot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 7fdff5420..86785012e 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -312,9 +312,9 @@ class FreqtradeBot(LoggingMixin): open_trades = Trade.get_open_trade_count() return max(0, self.config['max_open_trades'] - open_trades) - def update_funding_fees(self): + def update_funding_fees(self) -> None: if self.trading_mode == TradingMode.FUTURES: - trades = Trade.get_open_trades() + trades: List[Trade] = Trade.get_open_trades() try: for trade in trades: funding_fees = self.exchange.get_funding_fees( @@ -327,7 +327,7 @@ class FreqtradeBot(LoggingMixin): except ExchangeError: logger.warning("Could not update funding fees for open trades.") - def startup_backpopulate_precision(self): + def startup_backpopulate_precision(self) -> None: trades = Trade.get_trades([Trade.contract_size.is_(None)]) for trade in trades: From 094984eb2f03610f282698dad62c4c0b0f5b0efc Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 7 Oct 2023 15:09:44 +0200 Subject: [PATCH 048/145] Fix wrong typehint --- freqtrade/exchange/exchange.py | 5 ++--- freqtrade/exchange/kraken.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 4592c82a1..7ec31d5f8 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2733,8 +2733,7 @@ class Exchange: except KeyError: raise ExchangeError("Could not find funding rates.") from None - funding_mark_rates = self.combine_funding_and_mark( - funding_rates=funding_rates, mark_rates=mark_rates) + funding_mark_rates = self.combine_funding_and_mark(funding_rates, mark_rates) return self.calculate_funding_fees( funding_mark_rates, @@ -2781,7 +2780,7 @@ class Exchange: amount: float, is_short: bool, open_date: datetime, - close_date: Optional[datetime] = None, + close_date: datetime, time_in_ratio: Optional[float] = None ) -> float: """ diff --git a/freqtrade/exchange/kraken.py b/freqtrade/exchange/kraken.py index f855ed472..46e34cec8 100644 --- a/freqtrade/exchange/kraken.py +++ b/freqtrade/exchange/kraken.py @@ -195,7 +195,7 @@ class Kraken(Exchange): amount: float, is_short: bool, open_date: datetime, - close_date: Optional[datetime] = None, + close_date: datetime, time_in_ratio: Optional[float] = None ) -> float: """ From 6c00bf423b1587f0c7a5c8f9efb608a11adee0be Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 08:59:18 +0200 Subject: [PATCH 049/145] Fix comment --- freqtrade/freqtradebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 86785012e..63e6ecdec 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1921,7 +1921,7 @@ class FreqtradeBot(LoggingMixin): if self.exchange.check_order_canceled_empty(order): # Trade has been cancelled on exchange - # Handling of this will happen in check_handle_timedout. + # Handling of this will happen in handle_cancel_order. return True order_obj_or_none = trade.select_order_by_order_id(order_id) From 897c14e2e5f3725337747a9e093e0c8c2039677d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 09:40:35 +0200 Subject: [PATCH 050/145] Don't check for "open orders" in handle_cancel_enter it's actually irrelenant (closes #9273). --- freqtrade/freqtradebot.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 63e6ecdec..1b6f9b8ae 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1506,9 +1506,6 @@ class FreqtradeBot(LoggingMixin): """ was_trade_fully_canceled = False side = trade.entry_side.capitalize() - if not trade.has_open_orders: - logger.warning(f"No open order for {trade}.") - return False if order['status'] not in constants.NON_OPEN_EXCHANGE_STATES: filled_val: float = order.get('filled', 0.0) or 0.0 From e525c6694bca344591a4fb8b4c66e0df8f527eef Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 09:30:21 +0200 Subject: [PATCH 051/145] Add ft_cancel_reason column to order object --- freqtrade/persistence/migrations.py | 9 +++++---- freqtrade/persistence/trade_model.py | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/freqtrade/persistence/migrations.py b/freqtrade/persistence/migrations.py index 69d37530f..717a13f90 100644 --- a/freqtrade/persistence/migrations.py +++ b/freqtrade/persistence/migrations.py @@ -220,6 +220,7 @@ def migrate_orders_table(engine, table_back_name: str, cols_order: List): funding_fee = get_column_def(cols_order, 'funding_fee', '0.0') ft_amount = get_column_def(cols_order, 'ft_amount', 'coalesce(amount, 0.0)') ft_price = get_column_def(cols_order, 'ft_price', 'coalesce(price, 0.0)') + ft_cancel_reason = get_column_def(cols_order, 'ft_cancel_reason', 'null') # sqlite does not support literals for booleans with engine.begin() as connection: @@ -227,13 +228,13 @@ def migrate_orders_table(engine, table_back_name: str, cols_order: List): insert into orders (id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id, status, symbol, order_type, side, price, amount, filled, average, remaining, cost, stop_price, order_date, order_filled_date, order_update_date, ft_fee_base, funding_fee, - ft_amount, ft_price + ft_amount, ft_price, ft_cancel_reason ) select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id, status, symbol, order_type, side, price, amount, filled, {average} average, remaining, cost, {stop_price} stop_price, order_date, order_filled_date, order_update_date, {ft_fee_base} ft_fee_base, {funding_fee} funding_fee, - {ft_amount} ft_amount, {ft_price} ft_price + {ft_amount} ft_amount, {ft_price} ft_price, {ft_cancel_reason} ft_cancel_reason from {table_back_name} """)) @@ -328,8 +329,8 @@ def check_migrate(engine, decl_base, previous_tables) -> None: # if ('orders' not in previous_tables # or not has_column(cols_orders, 'funding_fee')): migrating = False - # if not has_column(cols_orders, 'ft_price'): - if not has_column(cols_trades, 'is_stop_loss_trailing'): + # if not has_column(cols_trades, 'is_stop_loss_trailing'): + if not has_column(cols_orders, 'ft_cancel_reason'): migrating = True logger.info(f"Running database migration for trades - " f"backup: {table_back_name}, {order_table_bak_name}") diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index ea48d5466..3a90271d5 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -68,6 +68,7 @@ class Order(ModelBase): ft_is_open: Mapped[bool] = mapped_column(nullable=False, default=True, index=True) ft_amount: Mapped[float] = mapped_column(Float(), nullable=False) ft_price: Mapped[float] = mapped_column(Float(), nullable=False) + ft_cancel_reason: Mapped[str] = mapped_column(String(CUSTOM_TAG_MAX_LENGTH), nullable=True) order_id: Mapped[str] = mapped_column(String(255), nullable=False, index=True) status: Mapped[Optional[str]] = mapped_column(String(255), nullable=True) From c59b5e77813bf53bcecdc4f9f208f6bd9659b7b0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 09:58:06 +0200 Subject: [PATCH 052/145] Improve type hinting --- freqtrade/freqtradebot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 1b6f9b8ae..2f622a36c 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1336,6 +1336,7 @@ class FreqtradeBot(LoggingMixin): :return: None """ for trade in Trade.get_open_trades(): + open_order: Order for open_order in trade.open_orders: try: order = self.exchange.fetch_order(open_order.order_id, trade.pair) From f02c9f0435d7df74c5fde57cea855944762fb644 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 10:01:29 +0200 Subject: [PATCH 053/145] Pass order object to handle_cancel* methods --- freqtrade/freqtradebot.py | 29 +++++++++++++++-------------- freqtrade/rpc/rpc.py | 6 +++--- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 2f622a36c..e7ec1cd68 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -374,8 +374,7 @@ class FreqtradeBot(LoggingMixin): fo = order.to_ccxt_object() fo['status'] = 'canceled' self.handle_cancel_order( - fo, order.order_id, order.trade, - constants.CANCEL_REASON['TIMEOUT'] + fo, order, order.trade, constants.CANCEL_REASON['TIMEOUT'] ) except ExchangeError as e: @@ -1357,22 +1356,23 @@ class FreqtradeBot(LoggingMixin): ) ): self.handle_cancel_order( - order, open_order.order_id, trade, constants.CANCEL_REASON['TIMEOUT'] + order, open_order, trade, constants.CANCEL_REASON['TIMEOUT'] ) else: self.replace_order(order, open_order, trade) - def handle_cancel_order(self, order: Dict, order_id: str, trade: Trade, reason: str) -> None: + def handle_cancel_order(self, order: Dict, order_obj: Order, trade: Trade, reason: str) -> None: """ Check if current analyzed order timed out and cancel if necessary. :param order: Order dict grabbed with exchange.fetch_order() + :param order_obj: Order object from the database. :param trade: Trade object. :return: None """ if order['side'] == trade.entry_side: - self.handle_cancel_enter(trade, order, order_id, reason) + self.handle_cancel_enter(trade, order, order_obj, reason) else: - canceled = self.handle_cancel_exit(trade, order, order_id, reason) + canceled = self.handle_cancel_exit(trade, order, order_obj, reason) canceled_count = trade.get_canceled_exit_order_count() max_timeouts = self.config.get('unfilledtimeout', {}).get('exit_timeout_count', 0) if (canceled and max_timeouts > 0 and canceled_count >= max_timeouts): @@ -1446,7 +1446,7 @@ class FreqtradeBot(LoggingMixin): cancel_reason = constants.CANCEL_REASON['USER_CANCEL'] if order_obj.price != adjusted_entry_price: # cancel existing order if new price is supplied or None - res = self.handle_cancel_enter(trade, order, order_obj.order_id, cancel_reason, + res = self.handle_cancel_enter(trade, order, order_obj, cancel_reason, replacing=replacing) if not res: self.replace_order_failed( @@ -1487,25 +1487,27 @@ class FreqtradeBot(LoggingMixin): if order['side'] == trade.entry_side: self.handle_cancel_enter( - trade, order, open_order.order_id, constants.CANCEL_REASON['ALL_CANCELLED'] + trade, order, open_order, constants.CANCEL_REASON['ALL_CANCELLED'] ) elif order['side'] == trade.exit_side: self.handle_cancel_exit( - trade, order, open_order.order_id, constants.CANCEL_REASON['ALL_CANCELLED'] + trade, order, open_order, constants.CANCEL_REASON['ALL_CANCELLED'] ) Trade.commit() def handle_cancel_enter( - self, trade: Trade, order: Dict, order_id: str, + self, trade: Trade, order: Dict, order_obj: Order, reason: str, replacing: Optional[bool] = False ) -> bool: """ entry cancel - cancel order + :param order_obj: Order object from the database. :param replacing: Replacing order - prevent trade deletion. :return: True if trade was fully cancelled """ was_trade_fully_canceled = False + order_id = order_obj.order_id side = trade.entry_side.capitalize() if order['status'] not in constants.NON_OPEN_EXCHANGE_STATES: @@ -1519,8 +1521,7 @@ class FreqtradeBot(LoggingMixin): f"Order {order_id} for {trade.pair} not cancelled, " f"as the filled amount of {filled_val} would result in an unexitable trade.") return False - corder = self.exchange.cancel_order_with_result(order_id, trade.pair, - trade.amount) + corder = self.exchange.cancel_order_with_result(order_id, trade.pair, trade.amount) # if replacing, retry fetching the order 3 times if the status is not what we need if replacing: retry_count = 0 @@ -1574,13 +1575,13 @@ class FreqtradeBot(LoggingMixin): return was_trade_fully_canceled def handle_cancel_exit( - self, trade: Trade, order: Dict, order_id: str, - reason: str + self, trade: Trade, order: Dict, order_obj: Order, reason: str ) -> bool: """ exit order cancel - cancel order and update trade :return: True if exit order was cancelled, false otherwise """ + order_id = order_obj.order_id cancelled = False # Cancelled orders may have the status of 'canceled' or 'closed' if order['status'] not in constants.NON_OPEN_EXCHANGE_STATES: diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 0abac3975..ef789db52 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -795,14 +795,14 @@ class RPC: if order['side'] == trade.entry_side: fully_canceled = self._freqtrade.handle_cancel_enter( - trade, order, oo.order_id, CANCEL_REASON['FORCE_EXIT']) + trade, order, oo, CANCEL_REASON['FORCE_EXIT']) trade_entry_cancelation_res['cancel_state'] = fully_canceled trade_entry_cancelation_registry.append(trade_entry_cancelation_res) if order['side'] == trade.exit_side: # Cancel order - so it is placed anew with a fresh price. self._freqtrade.handle_cancel_exit( - trade, order, oo.order_id, CANCEL_REASON['FORCE_EXIT']) + trade, order, oo, CANCEL_REASON['FORCE_EXIT']) if all(tocr['cancel_state'] is False for tocr in trade_entry_cancelation_registry): if trade.has_open_orders: @@ -955,7 +955,7 @@ class RPC: logger.info(f"Cannot query order for {trade} due to {e}.", exc_info=True) raise RPCException("Order not found.") self._freqtrade.handle_cancel_order( - order, open_order.order_id, trade, CANCEL_REASON['USER_CANCEL']) + order, open_order, trade, CANCEL_REASON['USER_CANCEL']) Trade.commit() def _rpc_delete(self, trade_id: int) -> Dict[str, Union[str, int]]: From 5cf7ad85a05a9ade83e70b8cab47ef2ba8246ac7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 10:44:37 +0200 Subject: [PATCH 054/145] Adjust tests for new interface to handle_cancel_* methods --- tests/test_freqtradebot.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 79bd2904c..95aa6cee4 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -3443,20 +3443,20 @@ def test_handle_cancel_enter(mocker, caplog, default_conf_usdt, limit_order, is_ l_order['filled'] = 0.0 l_order['status'] = 'open' reason = CANCEL_REASON['TIMEOUT'] - assert freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert cancel_order_mock.call_count == 1 cancel_order_mock.reset_mock() caplog.clear() l_order['filled'] = 0.01 - assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert cancel_order_mock.call_count == 0 assert log_has_re("Order .* for .* not cancelled, as the filled amount.* unexitable.*", caplog) caplog.clear() cancel_order_mock.reset_mock() l_order['filled'] = 2 - assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert cancel_order_mock.call_count == 1 # Order remained open for some reason (cancel failed) @@ -3464,12 +3464,12 @@ def test_handle_cancel_enter(mocker, caplog, default_conf_usdt, limit_order, is_ cancel_order_mock = MagicMock(return_value=cancel_entry_order) mocker.patch(f'{EXMS}.cancel_order_with_result', cancel_order_mock) - assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert log_has_re(r"Order .* for .* not cancelled.", caplog) # min_pair_stake empty should not crash mocker.patch(f'{EXMS}.get_min_pair_stake_amount', return_value=None) assert not freqtrade.handle_cancel_enter( - trade, limit_order[entry_side(is_short)], trade.open_orders_ids[0], reason + trade, limit_order[entry_side(is_short)], trade.open_orders[0], reason ) # Retry ... @@ -3480,7 +3480,7 @@ def test_handle_cancel_enter(mocker, caplog, default_conf_usdt, limit_order, is_ co_mock = mocker.patch(f'{EXMS}.cancel_order_with_result', return_value=cbo) fo_mock = mocker.patch(f'{EXMS}.fetch_order', return_value=cbo) assert not freqtrade.handle_cancel_enter( - trade, cbo, cbo['id'], reason, replacing=True + trade, cbo, trade.open_orders[0], reason, replacing=True ) assert co_mock.call_count == 1 assert fo_mock.call_count == 3 @@ -3505,7 +3505,7 @@ def test_handle_cancel_enter_exchanges(mocker, caplog, default_conf_usdt, is_sho Trade.session.add(trade) Trade.commit() assert freqtrade.handle_cancel_enter( - trade, limit_buy_order_canceled_empty, trade.open_orders_ids[0], reason + trade, limit_buy_order_canceled_empty, trade.open_orders[0], reason ) assert cancel_order_mock.call_count == 0 assert log_has_re( @@ -3543,7 +3543,7 @@ def test_handle_cancel_enter_corder_empty(mocker, default_conf_usdt, limit_order l_order['filled'] = 0.0 l_order['status'] = 'open' reason = CANCEL_REASON['TIMEOUT'] - assert freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert cancel_order_mock.call_count == 1 cancel_order_mock.reset_mock() @@ -3551,7 +3551,7 @@ def test_handle_cancel_enter_corder_empty(mocker, default_conf_usdt, limit_order order = deepcopy(l_order) order['status'] = 'canceled' mocker.patch(f'{EXMS}.fetch_order', return_value=order) - assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders_ids[0], reason) + assert not freqtrade.handle_cancel_enter(trade, l_order, trade.open_orders[0], reason) assert cancel_order_mock.call_count == 1 @@ -3632,8 +3632,9 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee, is_short, 'amount': 1, 'status': "open"} reason = CANCEL_REASON['TIMEOUT'] + order_obj = trade.open_orders[-1] send_msg_mock.reset_mock() - assert freqtrade.handle_cancel_exit(trade, order, order['id'], reason) + assert freqtrade.handle_cancel_exit(trade, order, order_obj, reason) assert cancel_order_mock.call_count == 1 assert send_msg_mock.call_count == 1 assert trade.close_rate is None @@ -3645,14 +3646,14 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee, is_short, # Partial exit - below exit threshold order['amount'] = amount * leverage order['filled'] = amount * 0.99 * leverage - assert not freqtrade.handle_cancel_exit(trade, order, order['id'], reason) + assert not freqtrade.handle_cancel_exit(trade, order, order_obj, reason) # Assert cancel_order was not called (callcount remains unchanged) assert cancel_order_mock.call_count == 1 assert send_msg_mock.call_count == 1 assert (send_msg_mock.call_args_list[0][0][0]['reason'] == CANCEL_REASON['PARTIALLY_FILLED_KEEP_OPEN']) - assert not freqtrade.handle_cancel_exit(trade, order, order['id'], reason) + assert not freqtrade.handle_cancel_exit(trade, order, order_obj, reason) assert (send_msg_mock.call_args_list[0][0][0]['reason'] == CANCEL_REASON['PARTIALLY_FILLED_KEEP_OPEN']) @@ -3664,7 +3665,7 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee, is_short, send_msg_mock.reset_mock() order['filled'] = amount * 0.5 * leverage - assert freqtrade.handle_cancel_exit(trade, order, order['id'], reason) + assert freqtrade.handle_cancel_exit(trade, order, order_obj, reason) assert send_msg_mock.call_count == 1 assert (send_msg_mock.call_args_list[0][0][0]['reason'] == CANCEL_REASON['PARTIALLY_FILLED']) @@ -3680,13 +3681,14 @@ def test_handle_cancel_exit_cancel_exception(mocker, default_conf_usdt) -> None: # TODO: should not be magicmock trade = MagicMock() - order_id = '125' + order_obj = MagicMock() + order_obj.order_id = '125' reason = CANCEL_REASON['TIMEOUT'] order = {'remaining': 1, 'id': '125', 'amount': 1, 'status': "open"} - assert not freqtrade.handle_cancel_exit(trade, order, order_id, reason) + assert not freqtrade.handle_cancel_exit(trade, order, order_obj, reason) # mocker.patch(f'{EXMS}.cancel_order_with_result', return_value=order) # assert not freqtrade.handle_cancel_exit(trade, order, reason) From 40ec2c4921e6b9ac4bad3933032c3011e4665b47 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 11:17:29 +0200 Subject: [PATCH 055/145] Improve messaging in case of delayed exchange cancel --- freqtrade/freqtradebot.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index e7ec1cd68..08c18ee42 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1522,6 +1522,7 @@ class FreqtradeBot(LoggingMixin): f"as the filled amount of {filled_val} would result in an unexitable trade.") return False corder = self.exchange.cancel_order_with_result(order_id, trade.pair, trade.amount) + order_obj.ft_cancel_reason = reason # if replacing, retry fetching the order 3 times if the status is not what we need if replacing: retry_count = 0 @@ -1542,9 +1543,10 @@ class FreqtradeBot(LoggingMixin): else: # Order was cancelled already, so we can reuse the existing dict corder = order - reason = constants.CANCEL_REASON['CANCELLED_ON_EXCHANGE'] + if order_obj.ft_cancel_reason is None: + order_obj.ft_cancel_reason = constants.CANCEL_REASON['CANCELLED_ON_EXCHANGE'] - logger.info(f'{side} order {reason} for {trade}.') + logger.info(f'{side} order {order_obj.ft_cancel_reason} for {trade}.') # Using filled to determine the filled amount filled_amount = safe_value_fallback2(corder, order, 'filled', 'filled') @@ -1557,7 +1559,7 @@ class FreqtradeBot(LoggingMixin): if open_order_count < 1 and trade.nr_of_successful_entries == 0 and not replacing: logger.info(f'{side} order fully cancelled. Removing {trade} from database.') trade.delete() - reason += f", {constants.CANCEL_REASON['FULLY_CANCELLED']}" + order_obj.ft_cancel_reason += f", {constants.CANCEL_REASON['FULLY_CANCELLED']}" else: self.update_trade_state(trade, order_id, corder) logger.info(f'{side} Order timeout for {trade}.') @@ -1567,11 +1569,11 @@ class FreqtradeBot(LoggingMixin): self.update_trade_state(trade, order_id, corder) logger.info(f'Partial {trade.entry_side} order timeout for {trade}.') - reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}" + order_obj.ft_cancel_reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}" self.wallets.update() self._notify_enter_cancel(trade, order_type=self.strategy.order_types['entry'], - reason=reason) + reason=order_obj.ft_cancel_reason) return was_trade_fully_canceled def handle_cancel_exit( @@ -1606,7 +1608,7 @@ class FreqtradeBot(LoggingMixin): sub_trade=trade.amount != order['amount'] ) return False - + order_obj.ft_cancel_reason = reason try: order = self.exchange.cancel_order_with_result( order['id'], trade.pair, trade.amount) @@ -1625,19 +1627,22 @@ class FreqtradeBot(LoggingMixin): trade.exit_reason = exit_reason_prev cancelled = True else: - reason = constants.CANCEL_REASON['CANCELLED_ON_EXCHANGE'] + if order_obj.ft_cancel_reason is None: + order_obj.ft_cancel_reason = constants.CANCEL_REASON['CANCELLED_ON_EXCHANGE'] trade.exit_reason = None self.update_trade_state(trade, order['id'], order) - logger.info(f'{trade.exit_side.capitalize()} order {reason} for {trade}.') + logger.info( + f'{trade.exit_side.capitalize()} order {order_obj.ft_cancel_reason} for {trade}.') trade.close_rate = None trade.close_rate_requested = None self._notify_exit_cancel( trade, order_type=self.strategy.order_types['exit'], - reason=reason, order_id=order['id'], sub_trade=trade.amount != order['amount'] + reason=order_obj.ft_cancel_reason, order_id=order['id'], + sub_trade=trade.amount != order['amount'] ) return cancelled From 422b9c8fbc93e4e0a23368708ba69cfa49baf397 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:01 +0000 Subject: [PATCH 056/145] Bump ccxt from 4.0.112 to 4.1.8 Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.0.112 to 4.1.8. - [Release notes](https://github.com/ccxt/ccxt/releases) - [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md) - [Commits](https://github.com/ccxt/ccxt/compare/4.0.112...4.1.8) --- updated-dependencies: - dependency-name: ccxt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2f40b1c4a..618e52fff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ numpy==1.25.2; platform_machine == 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b -ccxt==4.0.112 +ccxt==4.1.8 cryptography==41.0.4 aiohttp==3.8.5 SQLAlchemy==2.0.21 From 756f5d5408e723f9cd9ea594293ec54b588bc3e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:10 +0000 Subject: [PATCH 057/145] Bump mkdocs-material from 9.4.2 to 9.4.4 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.2 to 9.4.4. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.2...9.4.4) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 9e402b0b1..0ea662712 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,6 +1,6 @@ markdown==3.4.4 mkdocs==1.5.3 -mkdocs-material==9.4.2 +mkdocs-material==9.4.4 mdx_truly_sane_lists==1.3 pymdown-extensions==10.3 jinja2==3.1.2 From 41a6709eceb0ae7b86233140c806a80d443af8e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:23 +0000 Subject: [PATCH 058/145] Bump torch from 2.0.1 to 2.1.0 Bumps [torch](https://github.com/pytorch/pytorch) from 2.0.1 to 2.1.0. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.0.1...v2.1.0) --- updated-dependencies: - dependency-name: torch dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-freqai-rl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index c2cca5427..0e6811fd1 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -2,7 +2,7 @@ -r requirements-freqai.txt # Required for freqai-rl -torch==2.0.1 +torch==2.1.0 #until these branches will be released we can use this gymnasium==0.29.1 stable_baselines3==2.1.0 From d28d6cbdb4077ac0b98416f2c36cb206b468eed9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:34 +0000 Subject: [PATCH 059/145] Bump python-telegram-bot from 20.5 to 20.6 Bumps [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) from 20.5 to 20.6. - [Release notes](https://github.com/python-telegram-bot/python-telegram-bot/releases) - [Changelog](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/CHANGES.rst) - [Commits](https://github.com/python-telegram-bot/python-telegram-bot/compare/v20.5...v20.6) --- updated-dependencies: - dependency-name: python-telegram-bot dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2f40b1c4a..3b8724fe9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ ccxt==4.0.112 cryptography==41.0.4 aiohttp==3.8.5 SQLAlchemy==2.0.21 -python-telegram-bot==20.5 +python-telegram-bot==20.6 # can't be hard-pinned due to telegram-bot pinning httpx with ~ httpx>=0.24.1 arrow==1.3.0 From 08a65b50aabfa6749f7bacc0214d7c424ef4da22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:37 +0000 Subject: [PATCH 060/145] Bump types-requests from 2.31.0.7 to 2.31.0.8 Bumps [types-requests](https://github.com/python/typeshed) from 2.31.0.7 to 2.31.0.8. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-requests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 421df952c..41bbe1a6d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,6 +25,6 @@ nbconvert==7.8.0 # mypy types types-cachetools==5.3.0.6 types-filelock==3.2.7 -types-requests==2.31.0.7 +types-requests==2.31.0.8 types-tabulate==0.9.0.3 types-python-dateutil==2.8.19.14 From ef12dafea8cdd1ed02310029673a52a84d538ae9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:42 +0000 Subject: [PATCH 061/145] Bump python-rapidjson from 1.11 to 1.12 Bumps [python-rapidjson](https://github.com/python-rapidjson/python-rapidjson) from 1.11 to 1.12. - [Changelog](https://github.com/python-rapidjson/python-rapidjson/blob/master/CHANGES.rst) - [Commits](https://github.com/python-rapidjson/python-rapidjson/compare/v1.11...v1.12) --- updated-dependencies: - dependency-name: python-rapidjson dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2f40b1c4a..66810a22b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ pyarrow==13.0.0; platform_machine != 'armv7l' py_find_1st==1.1.5 # Load ticker files 30% faster -python-rapidjson==1.11 +python-rapidjson==1.12 # Properly format api responses orjson==3.9.7 From ccbab6ee6fa8eeee6baffa5fbadd546ed63e7dd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:53:53 +0000 Subject: [PATCH 062/145] Bump tables from 3.8.0 to 3.9.1 Bumps [tables](https://github.com/PyTables/PyTables) from 3.8.0 to 3.9.1. - [Release notes](https://github.com/PyTables/PyTables/releases) - [Changelog](https://github.com/PyTables/PyTables/blob/master/RELEASE_NOTES.rst) - [Commits](https://github.com/PyTables/PyTables/compare/v3.8.0...v3.9.1) --- updated-dependencies: - dependency-name: tables dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2f40b1c4a..1ba29220d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ technical==1.4.0 tabulate==0.9.0 pycoingecko==3.1.0 jinja2==3.1.2 -tables==3.8.0 +tables==3.9.1 blosc==1.11.1 joblib==1.3.2 rich==13.6.0 From f7f0f3bebb70edc7209b2b83eafe21d9e764758f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:54:13 +0000 Subject: [PATCH 063/145] Bump ruff from 0.0.291 to 0.0.292 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.291 to 0.0.292. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.0.291...v0.0.292) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 421df952c..1441b4b6f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,7 +7,7 @@ -r docs/requirements-docs.txt coveralls==3.3.1 -ruff==0.0.291 +ruff==0.0.292 mypy==1.5.1 pre-commit==3.4.0 pytest==7.4.2 From 5fae03f7beae6ac0dfa05c4bdf9ee43e83b3fae3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 03:54:23 +0000 Subject: [PATCH 064/145] Bump nbconvert from 7.8.0 to 7.9.2 Bumps [nbconvert](https://github.com/jupyter/nbconvert) from 7.8.0 to 7.9.2. - [Release notes](https://github.com/jupyter/nbconvert/releases) - [Changelog](https://github.com/jupyter/nbconvert/blob/main/CHANGELOG.md) - [Commits](https://github.com/jupyter/nbconvert/compare/v7.8.0...v7.9.2) --- updated-dependencies: - dependency-name: nbconvert dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 421df952c..b5236e90e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -20,7 +20,7 @@ isort==5.12.0 time-machine==2.13.0 # Convert jupyter notebooks to markdown documents -nbconvert==7.8.0 +nbconvert==7.9.2 # mypy types types-cachetools==5.3.0.6 From a86bf8d6d7a3ef358d935a70486b6915037ca2a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 05:02:10 +0000 Subject: [PATCH 065/145] Bump aiohttp from 3.8.5 to 3.8.6 Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.8.5 to 3.8.6. - [Release notes](https://github.com/aio-libs/aiohttp/releases) - [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst) - [Commits](https://github.com/aio-libs/aiohttp/compare/v3.8.5...v3.8.6) --- updated-dependencies: - dependency-name: aiohttp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 618e52fff..3347f7ac9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ pandas-ta==0.3.14b ccxt==4.1.8 cryptography==41.0.4 -aiohttp==3.8.5 +aiohttp==3.8.6 SQLAlchemy==2.0.21 python-telegram-bot==20.5 # can't be hard-pinned due to telegram-bot pinning httpx with ~ From 14908e52e2fc864dbbacfb42157197f7d7c4adea Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 20:39:25 +0200 Subject: [PATCH 066/145] Improv variable naming --- freqtrade/exchange/exchange.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 7ec31d5f8..4ef6b5e0b 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2655,6 +2655,8 @@ class Exchange: def funding_fee_cutoff(self, open_date: datetime): """ + Funding fees are only charged at full hours (usually every 4-8h). + Therefore a trade opening at 10:00:01 will not be charged a funding fee until the next hour. :param open_date: The open date for a trade :return: The cutoff open time for when a funding fee is charged """ @@ -2796,8 +2798,8 @@ class Exchange: fees: float = 0 if not df.empty: - df = df[(df['date'] >= open_date) & (df['date'] <= close_date)] - fees = sum(df['open_fund'] * df['open_mark'] * amount) + df1 = df[(df['date'] >= open_date) & (df['date'] <= close_date)] + fees = sum(df1['open_fund'] * df1['open_mark'] * amount) # Negate fees for longs as funding_fees expects it this way based on live endpoints. return fees if is_short else -fees From bc531cf846c520e2fe1274b415da11e749d99bf1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Oct 2023 21:00:41 +0200 Subject: [PATCH 067/145] Improve variable naming --- freqtrade/exchange/exchange.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 4ef6b5e0b..247a0192b 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2715,8 +2715,7 @@ class Exchange: if not close_date: close_date = datetime.now(timezone.utc) - open_timestamp = int(timeframe_to_prev_date(timeframe, open_date).timestamp()) * 1000 - # close_timestamp = int(close_date.timestamp()) * 1000 + since_ms = int(timeframe_to_prev_date(timeframe, open_date).timestamp()) * 1000 mark_comb: PairWithTimeframe = ( pair, timeframe, CandleType.from_string(self._ft_has["mark_ohlcv_price"])) @@ -2724,7 +2723,7 @@ class Exchange: funding_comb: PairWithTimeframe = (pair, timeframe_ff, CandleType.FUNDING_RATE) candle_histories = self.refresh_latest_ohlcv( [mark_comb, funding_comb], - since_ms=open_timestamp, + since_ms=since_ms, cache=False, drop_incomplete=False, ) From 7a69b01b9bacf298b08d8fe4c9bebfa542eecc00 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 06:35:51 +0200 Subject: [PATCH 068/145] avoid edge-case in test --- tests/exchange/test_exchange.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 7320f1074..b39ecb9d2 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -4191,7 +4191,7 @@ def test__fetch_and_calculate_funding_fees_datetime_called( type(api_mock).has = PropertyMock(return_value={'fetchFundingRateHistory': True}) mocker.patch(f'{EXMS}.timeframes', PropertyMock(return_value=['4h', '8h'])) exchange = get_patched_exchange(mocker, default_conf, api_mock, id=exchange) - d1 = datetime.strptime("2021-09-01 00:00:00 +0000", '%Y-%m-%d %H:%M:%S %z') + d1 = datetime.strptime("2021-08-31 23:00:01 +0000", '%Y-%m-%d %H:%M:%S %z') time_machine.move_to("2021-09-01 08:00:00 +00:00") funding_fees = exchange._fetch_and_calculate_funding_fees('ADA/USDT', 30.0, True, d1) From 19620470bd1753e3b034d72846ebda5c3e30b670 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 06:37:08 +0200 Subject: [PATCH 069/145] Improve funding fee cutof logic --- freqtrade/exchange/binance.py | 8 ++++++-- freqtrade/exchange/exchange.py | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/freqtrade/exchange/binance.py b/freqtrade/exchange/binance.py index bd7ef9b20..89b983d91 100644 --- a/freqtrade/exchange/binance.py +++ b/freqtrade/exchange/binance.py @@ -123,10 +123,14 @@ class Binance(Exchange): def funding_fee_cutoff(self, open_date: datetime): """ + Funding fees are only charged at full hours (usually every 4-8h). + Therefore a trade opening at 10:00:01 will not be charged a funding fee until the next hour. + On binance, this cutoff is 15s. + https://github.com/freqtrade/freqtrade/pull/5779#discussion_r740175931 :param open_date: The open date for a trade - :return: The cutoff open time for when a funding fee is charged + :return: True if the date falls on a full hour, False otherwise """ - return open_date.minute > 0 or (open_date.minute == 0 and open_date.second > 15) + return open_date.minute == 0 and open_date.second < 15 def dry_run_liquidation_price( self, diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 247a0192b..ae8cdaa98 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2653,14 +2653,14 @@ class Exchange: """ return 0.0 - def funding_fee_cutoff(self, open_date: datetime): + def funding_fee_cutoff(self, open_date: datetime) -> bool: """ Funding fees are only charged at full hours (usually every 4-8h). Therefore a trade opening at 10:00:01 will not be charged a funding fee until the next hour. :param open_date: The open date for a trade - :return: The cutoff open time for when a funding fee is charged + :return: True if the date falls on a full hour, False otherwise """ - return open_date.minute > 0 or open_date.second > 0 + return open_date.minute == 0 and open_date.second == 0 @retrier def set_margin_mode(self, pair: str, margin_mode: MarginMode, accept_fail: bool = False, @@ -2708,7 +2708,9 @@ class Exchange: """ if self.funding_fee_cutoff(open_date): - open_date += timedelta(hours=1) + # Shift back to 1h candle to avoid missing funding fees + # Only really relevant for trades very close to the full hour + open_date = timeframe_to_prev_date('1h', open_date) timeframe = self._ft_has['mark_ohlcv_timeframe'] timeframe_ff = self._ft_has.get('funding_fee_timeframe', self._ft_has['mark_ohlcv_timeframe']) From 29eb6d938b288e6bd51be4626c8013f980313b46 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 06:54:08 +0200 Subject: [PATCH 070/145] Update test for fixed funding_fee logic --- tests/exchange/test_exchange.py | 4 +++- tests/test_freqtradebot.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index b39ecb9d2..c86822f7b 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -4075,7 +4075,9 @@ def test_combine_funding_and_mark( ('binance', 1, 2, "2021-09-01 00:00:16", "2021-09-01 08:00:00", 30.0, -0.0002493), ('binance', 0, 1, "2021-09-01 00:00:00", "2021-09-01 07:59:59", 30.0, -0.00066479999), ('binance', 0, 2, "2021-09-01 00:00:00", "2021-09-01 12:00:00", 30.0, -0.00091409999), - ('binance', 0, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.0002493), + # :01 must be rounded down. + ('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: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 # ('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), diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 79bd2904c..cb6674ea8 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -5978,7 +5978,7 @@ def test_update_funding_fees( time: 8, mark: 1.2, fundRate: 0.00032715, nominal_value: 147.6, fundFee: 0.04828734 """ # SETUP - time_machine.move_to("2021-09-01 00:00:00 +00:00") + time_machine.move_to("2021-09-01 00:00:16 +00:00") open_order = limit_order_open[entry_side(is_short)] open_exit_order = limit_order_open[exit_side(is_short)] From b1fd0c73c7eebdcb47ad0eba59b6c9fbda197b7e Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 07:05:39 +0200 Subject: [PATCH 071/145] Add additional test case for funding-fee calculation --- tests/exchange/test_exchange.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index c86822f7b..297417436 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -4077,6 +4077,7 @@ def test_combine_funding_and_mark( ('binance', 0, 2, "2021-09-01 00:00:00", "2021-09-01 12:00:00", 30.0, -0.00091409999), # :01 must be rounded down. ('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-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 # ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 30.0, -0.0014937), From 1bba0cf7fcc8807432cd243c03ac2fc1be880fd2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 07:06:33 +0200 Subject: [PATCH 072/145] Bump pre-commit types-requests --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13f4de236..0674fb598 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: additional_dependencies: - types-cachetools==5.3.0.6 - types-filelock==3.2.7 - - types-requests==2.31.0.7 + - types-requests==2.31.0.8 - types-tabulate==0.9.0.3 - types-python-dateutil==2.8.19.14 - SQLAlchemy==2.0.21 From 74f678a26f6ba796d3b483855491004c2dcf0840 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 06:13:16 +0000 Subject: [PATCH 073/145] Bump markdown from 3.4.4 to 3.5 Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.4.4 to 3.5. - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md) - [Commits](https://github.com/Python-Markdown/markdown/compare/3.4.4...3.5) --- updated-dependencies: - dependency-name: markdown dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 0ea662712..ca44bc753 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,4 +1,4 @@ -markdown==3.4.4 +markdown==3.5 mkdocs==1.5.3 mkdocs-material==9.4.4 mdx_truly_sane_lists==1.3 From 1bfecb03132421f39be0603dc73f421044891033 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 18:11:01 +0200 Subject: [PATCH 074/145] Revert "Bump tables from 3.8.0 to 3.9.1" --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 473037ca7..802352872 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ technical==1.4.0 tabulate==0.9.0 pycoingecko==3.1.0 jinja2==3.1.2 -tables==3.9.1 +tables==3.8.0 blosc==1.11.1 joblib==1.3.2 rich==13.6.0 From 86d4497aaf5646177f4a9a70f8334a7deffc9ba6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 9 Oct 2023 20:01:41 +0200 Subject: [PATCH 075/145] Add additional test for from_json --- tests/persistence/test_trade_fromjson.py | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/persistence/test_trade_fromjson.py b/tests/persistence/test_trade_fromjson.py index e565b06d4..4d546ec04 100644 --- a/tests/persistence/test_trade_fromjson.py +++ b/tests/persistence/test_trade_fromjson.py @@ -1,8 +1,10 @@ +import json from datetime import datetime, timezone import pytest from freqtrade.persistence.trade_model import Trade +from tests.conftest import create_mock_trades_usdt @pytest.mark.usefixtures("init_persistence") @@ -194,3 +196,64 @@ def test_trade_fromjson(): assert last_o.order_filled_utc == datetime(2022, 10, 18, 9, 45, 22, tzinfo=timezone.utc) assert isinstance(last_o.order_date, datetime) assert last_o.funding_fee == -0.055 + + +@pytest.mark.usefixtures("init_persistence") +def test_trade_serialize_load_back(fee): + + create_mock_trades_usdt(fee, None) + + t = Trade.get_trades([Trade.id == 1]).first() + assert t.id == 1 + t.funding_fees = 0.025 + t.orders[0].funding_fee = 0.0125 + Trade.commit() + + tjson = t.to_json(False) + assert isinstance(tjson, dict) + trade_string = json.dumps(tjson) + trade = Trade.from_json(trade_string) + + assert trade.id == t.id + assert trade.funding_fees == t.funding_fees + assert trade.orders[0].funding_fee == t.orders[0].funding_fee + excluded = [ + 'trade_id', 'quote_currency', 'open_timestamp', 'close_timestamp', + 'realized_profit_ratio', 'close_profit_pct', + 'trade_duration_s', 'trade_duration', + 'profit_ratio', 'profit_pct', 'profit_abs', 'stop_loss_abs', + 'initial_stop_loss_abs', + 'orders', + ] + failed = [] + # Ensure all attributes written can be read. + for obj, value in tjson.items(): + if obj in excluded: + continue + tattr = getattr(trade, obj, None) + if isinstance(tattr, datetime): + tattr = tattr.strftime('%Y-%m-%d %H:%M:%S') + if tattr != value: + failed.append((obj, tattr, value)) + + assert tjson.get('trade_id') == trade.id + assert tjson.get('quote_currency') == trade.stake_currency + assert tjson.get('stop_loss_abs') == trade.stop_loss + assert tjson.get('initial_stop_loss_abs') == trade.initial_stop_loss + + excluded_o = [ + 'order_filled_timestamp', 'ft_is_entry', 'pair', 'is_open', 'order_timestamp', + ] + order_obj = trade.orders[0] + for obj, value in tjson['orders'][0].items(): + if obj in excluded_o: + continue + tattr = getattr(order_obj, obj, None) + if isinstance(tattr, datetime): + tattr = tattr.strftime('%Y-%m-%d %H:%M:%S') + if tattr != value: + failed.append((obj, tattr, value)) + + assert tjson['orders'][0]['pair'] == order_obj.ft_pair + print(failed) + assert not failed From 0f5b69b4f208f18b20b344b1dc71449d3c90b5fc Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 10 Oct 2023 07:13:32 +0200 Subject: [PATCH 076/145] Move from_json to LocalTrade class --- freqtrade/persistence/trade_model.py | 186 +++++++++++++-------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 3a90271d5..f7817c7e5 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -1287,6 +1287,99 @@ class LocalTrade: trade.adjust_stop_loss(trade.open_rate, desired_stoploss) logger.info(f"New stoploss: {trade.stop_loss}.") + @classmethod + def from_json(cls, json_str: str) -> Self: + """ + Create a Trade instance from a json string. + + Used for debugging purposes - please keep. + :param json_str: json string to parse + :return: Trade instance + """ + import rapidjson + data = rapidjson.loads(json_str) + trade = cls( + __FROM_JSON=True, + id=data["trade_id"], + pair=data["pair"], + base_currency=data["base_currency"], + stake_currency=data["quote_currency"], + is_open=data["is_open"], + exchange=data["exchange"], + amount=data["amount"], + amount_requested=data["amount_requested"], + stake_amount=data["stake_amount"], + strategy=data["strategy"], + enter_tag=data["enter_tag"], + timeframe=data["timeframe"], + fee_open=data["fee_open"], + fee_open_cost=data["fee_open_cost"], + fee_open_currency=data["fee_open_currency"], + fee_close=data["fee_close"], + fee_close_cost=data["fee_close_cost"], + fee_close_currency=data["fee_close_currency"], + open_date=datetime.fromtimestamp(data["open_timestamp"] // 1000, tz=timezone.utc), + open_rate=data["open_rate"], + open_rate_requested=data["open_rate_requested"], + open_trade_value=data["open_trade_value"], + close_date=(datetime.fromtimestamp(data["close_timestamp"] // 1000, tz=timezone.utc) + if data["close_timestamp"] else None), + realized_profit=data["realized_profit"], + close_rate=data["close_rate"], + close_rate_requested=data["close_rate_requested"], + close_profit=data["close_profit"], + close_profit_abs=data["close_profit_abs"], + exit_reason=data["exit_reason"], + exit_order_status=data["exit_order_status"], + stop_loss=data["stop_loss_abs"], + stop_loss_pct=data["stop_loss_ratio"], + stoploss_order_id=data["stoploss_order_id"], + stoploss_last_update=( + datetime.fromtimestamp(data["stoploss_last_update_timestamp"] // 1000, + tz=timezone.utc) + if data["stoploss_last_update_timestamp"] else None), + initial_stop_loss=data["initial_stop_loss_abs"], + initial_stop_loss_pct=data["initial_stop_loss_ratio"], + min_rate=data["min_rate"], + max_rate=data["max_rate"], + leverage=data["leverage"], + interest_rate=data["interest_rate"], + liquidation_price=data["liquidation_price"], + is_short=data["is_short"], + trading_mode=data["trading_mode"], + funding_fees=data["funding_fees"], + amount_precision=data.get('amount_precision', None), + price_precision=data.get('price_precision', None), + precision_mode=data.get('precision_mode', None), + contract_size=data.get('contract_size', None), + ) + for order in data["orders"]: + + order_obj = Order( + amount=order["amount"], + ft_amount=order["amount"], + ft_order_side=order["ft_order_side"], + ft_pair=order["pair"], + ft_is_open=order["is_open"], + order_id=order["order_id"], + status=order["status"], + average=order["average"], + cost=order["cost"], + filled=order["filled"], + order_date=datetime.strptime(order["order_date"], DATETIME_PRINT_FORMAT), + order_filled_date=(datetime.fromtimestamp( + order["order_filled_timestamp"] // 1000, tz=timezone.utc) + if order["order_filled_timestamp"] else None), + order_type=order["order_type"], + price=order["price"], + ft_price=order["price"], + remaining=order["remaining"], + funding_fee=order.get("funding_fee", None), + ) + trade.orders.append(order_obj) + + return trade + class Trade(ModelBase, LocalTrade): """ @@ -1730,96 +1823,3 @@ class Trade(ModelBase, LocalTrade): Order.status == 'closed' )).scalar_one() return trading_volume - - @classmethod - def from_json(cls, json_str: str) -> Self: - """ - Create a Trade instance from a json string. - - Used for debugging purposes - please keep. - :param json_str: json string to parse - :return: Trade instance - """ - import rapidjson - data = rapidjson.loads(json_str) - trade = cls( - __FROM_JSON=True, - id=data["trade_id"], - pair=data["pair"], - base_currency=data["base_currency"], - stake_currency=data["quote_currency"], - is_open=data["is_open"], - exchange=data["exchange"], - amount=data["amount"], - amount_requested=data["amount_requested"], - stake_amount=data["stake_amount"], - strategy=data["strategy"], - enter_tag=data["enter_tag"], - timeframe=data["timeframe"], - fee_open=data["fee_open"], - fee_open_cost=data["fee_open_cost"], - fee_open_currency=data["fee_open_currency"], - fee_close=data["fee_close"], - fee_close_cost=data["fee_close_cost"], - fee_close_currency=data["fee_close_currency"], - open_date=datetime.fromtimestamp(data["open_timestamp"] // 1000, tz=timezone.utc), - open_rate=data["open_rate"], - open_rate_requested=data["open_rate_requested"], - open_trade_value=data["open_trade_value"], - close_date=(datetime.fromtimestamp(data["close_timestamp"] // 1000, tz=timezone.utc) - if data["close_timestamp"] else None), - realized_profit=data["realized_profit"], - close_rate=data["close_rate"], - close_rate_requested=data["close_rate_requested"], - close_profit=data["close_profit"], - close_profit_abs=data["close_profit_abs"], - exit_reason=data["exit_reason"], - exit_order_status=data["exit_order_status"], - stop_loss=data["stop_loss_abs"], - stop_loss_pct=data["stop_loss_ratio"], - stoploss_order_id=data["stoploss_order_id"], - stoploss_last_update=( - datetime.fromtimestamp(data["stoploss_last_update_timestamp"] // 1000, - tz=timezone.utc) - if data["stoploss_last_update_timestamp"] else None), - initial_stop_loss=data["initial_stop_loss_abs"], - initial_stop_loss_pct=data["initial_stop_loss_ratio"], - min_rate=data["min_rate"], - max_rate=data["max_rate"], - leverage=data["leverage"], - interest_rate=data["interest_rate"], - liquidation_price=data["liquidation_price"], - is_short=data["is_short"], - trading_mode=data["trading_mode"], - funding_fees=data["funding_fees"], - amount_precision=data.get('amount_precision', None), - price_precision=data.get('price_precision', None), - precision_mode=data.get('precision_mode', None), - contract_size=data.get('contract_size', None), - ) - for order in data["orders"]: - - order_obj = Order( - amount=order["amount"], - ft_amount=order["amount"], - ft_order_side=order["ft_order_side"], - ft_pair=order["pair"], - ft_is_open=order["is_open"], - order_id=order["order_id"], - status=order["status"], - average=order["average"], - cost=order["cost"], - filled=order["filled"], - order_date=datetime.strptime(order["order_date"], DATETIME_PRINT_FORMAT), - order_filled_date=(datetime.fromtimestamp( - order["order_filled_timestamp"] // 1000, tz=timezone.utc) - if order["order_filled_timestamp"] else None), - order_type=order["order_type"], - price=order["price"], - ft_price=order["price"], - remaining=order["remaining"], - funding_fee=order.get("funding_fee", None), - ) - trade.orders.append(order_obj) - - return trade From 5a0c15f377ad5633964fd66ec7eb7ff7b5f533cb Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 10 Oct 2023 18:21:52 +0200 Subject: [PATCH 077/145] Update Idem test --- tests/persistence/test_persistence.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index 396d60c18..2a2a53fce 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -2094,11 +2094,10 @@ def test_Trade_object_idem(): 'get_enter_tag_performance', 'get_mix_tag_performance', 'get_trading_volume', - 'from_json', 'validate_string_len', ) EXCLUDES2 = ('trades', 'trades_open', 'bt_trades_open_pp', 'bt_open_open_trade_count', - 'total_profit') + 'total_profit', 'from_json',) # Parent (LocalTrade) should have the same attributes for item in trade: From e547da10defff5286141512a92bcc0f87191d483 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 18:07:34 +0200 Subject: [PATCH 078/145] Move funding fee assignment to update_trade --- freqtrade/persistence/trade_model.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index f7817c7e5..ad91c2c83 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -174,10 +174,6 @@ class Order(ModelBase): self.ft_is_open = True if self.status in NON_OPEN_EXCHANGE_STATES: self.ft_is_open = False - if self.trade: - # Assign funding fee up to this point - # (represents the funding fee since the last order) - self.funding_fee = self.trade.funding_fees if (order.get('filled', 0.0) or 0.0) > 0 and not self.order_filled_date: self.order_filled_date = dt_from_ts( safe_value_fallback(order, 'lastTradeTimestamp', default_value=dt_ts()) @@ -742,6 +738,8 @@ class LocalTrade: return logger.info(f'Updating trade (id={self.id}) ...') + if order.ft_order_side != 'stoploss': + order.funding_fee = self.funding_fees if order.ft_order_side == self.entry_side: # Update open rate and actual amount From db7f9598b02c327002d3901a6f0e09a35015fc7e Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 18:17:39 +0200 Subject: [PATCH 079/145] add set_funding_fees method --- freqtrade/freqtradebot.py | 23 ++++++++++++----------- freqtrade/persistence/trade_model.py | 8 ++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 08c18ee42..d1138e3e1 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -317,13 +317,13 @@ class FreqtradeBot(LoggingMixin): trades: List[Trade] = Trade.get_open_trades() try: for trade in trades: - funding_fees = self.exchange.get_funding_fees( - pair=trade.pair, - amount=trade.amount, - is_short=trade.is_short, - open_date=trade.date_last_filled_utc + trade.set_funding_fees( + self.exchange.get_funding_fees( + pair=trade.pair, + amount=trade.amount, + is_short=trade.is_short, + open_date=trade.date_last_filled_utc) ) - trade.funding_fees = funding_fees except ExchangeError: logger.warning("Could not update funding fees for open trades.") @@ -1695,11 +1695,12 @@ class FreqtradeBot(LoggingMixin): :return: True if it succeeds False """ try: - trade.funding_fees = self.exchange.get_funding_fees( - pair=trade.pair, - amount=trade.amount, - is_short=trade.is_short, - open_date=trade.date_last_filled_utc, + trade.set_funding_fees( + self.exchange.get_funding_fees( + pair=trade.pair, + amount=trade.amount, + is_short=trade.is_short, + open_date=trade.date_last_filled_utc) ) except ExchangeError: logger.warning("Could not update funding fee.") diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index ad91c2c83..d29c73040 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -658,6 +658,14 @@ class LocalTrade: return self.liquidation_price = liquidation_price + def set_funding_fees(self, funding_fee: float) -> None: + """ + Assign funding fees to Trade. + """ + if funding_fee is None: + return + self.funding_fees = funding_fee + def __set_stop_loss(self, stop_loss: float, percent: float): """ Method used internally to set self.stop_loss. From b57821b273897fd093c444e227b1d867f3de16a7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 19:38:58 +0200 Subject: [PATCH 080/145] Add set_funding_fees to backtesting --- freqtrade/optimize/backtesting.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index ab0ce4e3f..38150be37 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -718,12 +718,14 @@ class Backtesting: exit_candle_time: datetime = row[DATE_IDX].to_pydatetime() if self.trading_mode == TradingMode.FUTURES: - trade.funding_fees = self.exchange.calculate_funding_fees( - self.futures_data[trade.pair], - amount=trade.amount, - is_short=trade.is_short, - open_date=trade.date_last_filled_utc, - close_date=exit_candle_time, + trade.set_funding_fees( + self.exchange.calculate_funding_fees( + self.futures_data[trade.pair], + amount=trade.amount, + is_short=trade.is_short, + open_date=trade.date_last_filled_utc, + close_date=exit_candle_time + ) ) # Check if we need to adjust our current positions From b65fa98cee414f0ae7ae753a6093154a66c052a1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 19:45:00 +0200 Subject: [PATCH 081/145] Simplify backtesting by using current_time more consequently --- freqtrade/optimize/backtesting.py | 33 ++++++++++--------- tests/optimize/test_backtesting.py | 4 +-- .../test_backtesting_adjust_position.py | 11 ++++--- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 38150be37..4986f7b55 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -525,10 +525,10 @@ class Backtesting: # This should not be reached... return row[OPEN_IDX] - def _get_adjust_trade_entry_for_candle(self, trade: LocalTrade, row: Tuple - ) -> LocalTrade: + def _get_adjust_trade_entry_for_candle( + self, trade: LocalTrade, row: Tuple, current_time: datetime + ) -> LocalTrade: current_rate = row[OPEN_IDX] - current_date = row[DATE_IDX].to_pydatetime() current_profit = trade.calc_profit_ratio(current_rate) min_stake = self.exchange.get_min_pair_stake_amount(trade.pair, current_rate, -0.1) max_stake = self.exchange.get_max_pair_stake_amount(trade.pair, current_rate) @@ -536,7 +536,7 @@ class Backtesting: stake_amount = strategy_safe_wrapper(self.strategy.adjust_trade_position, default_retval=None, supress_error=True)( trade=trade, # type: ignore[arg-type] - current_time=current_date, current_rate=current_rate, + current_time=current_time, current_rate=current_rate, current_profit=current_profit, min_stake=min_stake, max_stake=min(max_stake, stake_available), current_entry_rate=current_rate, current_exit_rate=current_rate, @@ -569,10 +569,10 @@ class Backtesting: # Remaining stake is too low to be sold. return trade exit_ = ExitCheckTuple(ExitType.PARTIAL_EXIT) - pos_trade = self._get_exit_for_signal(trade, row, exit_, amount) + pos_trade = self._get_exit_for_signal(trade, row, exit_, current_time, amount) if pos_trade is not None: order = pos_trade.orders[-1] - if self._try_close_open_order(order, trade, current_date, row): + if self._try_close_open_order(order, trade, current_time, row): trade.recalc_trade_from_orders() self.wallets.update() return pos_trade @@ -615,11 +615,11 @@ class Backtesting: def _get_exit_for_signal( self, trade: LocalTrade, row: Tuple, exit_: ExitCheckTuple, + current_time: datetime, amount: Optional[float] = None) -> Optional[LocalTrade]: - exit_candle_time: datetime = row[DATE_IDX].to_pydatetime() if exit_.exit_flag: - trade.close_date = exit_candle_time + trade.close_date = current_time exit_reason = exit_.exit_reason amount_ = amount if amount is not None else trade.amount trade_dur = int((trade.close_date_utc - trade.open_date_utc).total_seconds() // 60) @@ -647,7 +647,7 @@ class Backtesting: default_retval=close_rate)( pair=trade.pair, trade=trade, # type: ignore[arg-type] - current_time=exit_candle_time, + current_time=current_time, proposed_rate=close_rate, current_profit=current_profit, exit_tag=exit_reason) if rate != close_rate: @@ -673,7 +673,7 @@ class Backtesting: time_in_force=time_in_force, sell_reason=exit_reason, # deprecated exit_reason=exit_reason, - current_time=exit_candle_time)): + current_time=current_time)): return None trade.exit_reason = exit_reason @@ -714,8 +714,9 @@ class Backtesting: trade.orders.append(order) return trade - def _check_trade_exit(self, trade: LocalTrade, row: Tuple) -> Optional[LocalTrade]: - exit_candle_time: datetime = row[DATE_IDX].to_pydatetime() + def _check_trade_exit( + self, trade: LocalTrade, row: Tuple, current_time: datetime + ) -> Optional[LocalTrade]: if self.trading_mode == TradingMode.FUTURES: trade.set_funding_fees( @@ -724,13 +725,13 @@ class Backtesting: amount=trade.amount, is_short=trade.is_short, open_date=trade.date_last_filled_utc, - close_date=exit_candle_time + close_date=current_time ) ) # Check if we need to adjust our current positions if self.strategy.position_adjustment_enable: - trade = self._get_adjust_trade_entry_for_candle(trade, row) + trade = self._get_adjust_trade_entry_for_candle(trade, row, current_time) enter = row[SHORT_IDX] if trade.is_short else row[LONG_IDX] exit_sig = row[ESHORT_IDX] if trade.is_short else row[ELONG_IDX] @@ -740,7 +741,7 @@ class Backtesting: low=row[LOW_IDX], high=row[HIGH_IDX] ) for exit_ in exits: - t = self._get_exit_for_signal(trade, row, exit_) + t = self._get_exit_for_signal(trade, row, exit_, current_time) if t: return t return None @@ -1147,7 +1148,7 @@ class Backtesting: # 4. Create exit orders (if any) if not trade.has_open_orders: - self._check_trade_exit(trade, row) # Place exit order if necessary + self._check_trade_exit(trade, row, current_time) # Place exit order if necessary # 5. Process exit orders. order = trade.select_order(trade.exit_side, is_open=True) diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index ac409bf71..69fb51505 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -665,7 +665,7 @@ def test_backtest__check_trade_exit(default_conf, fee, mocker) -> None: ] # No data available. - res = backtesting._check_trade_exit(trade, row_sell) + res = backtesting._check_trade_exit(trade, row_sell, row_sell[0].to_pydatetime()) assert res is not None assert res.exit_reason == ExitType.ROI.value assert res.close_date_utc == datetime(2020, 1, 1, 5, 0, tzinfo=timezone.utc) @@ -678,7 +678,7 @@ def test_backtest__check_trade_exit(default_conf, fee, mocker) -> None: [], columns=['date', 'open', 'high', 'low', 'close', 'enter_long', 'exit_long', 'enter_short', 'exit_short', 'long_tag', 'short_tag', 'exit_tag']) - res = backtesting._check_trade_exit(trade, row) + res = backtesting._check_trade_exit(trade, row, row[0].to_pydatetime()) assert res is None diff --git a/tests/optimize/test_backtesting_adjust_position.py b/tests/optimize/test_backtesting_adjust_position.py index 99e1ec812..ad1f31068 100644 --- a/tests/optimize/test_backtesting_adjust_position.py +++ b/tests/optimize/test_backtesting_adjust_position.py @@ -133,6 +133,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera ] backtesting.strategy.leverage = MagicMock(return_value=leverage) trade = backtesting._enter_trade(pair, row=row, direction='long') + current_time = row[0].to_pydatetime() assert trade assert pytest.approx(trade.stake_amount) == 100.0 assert pytest.approx(trade.amount) == 47.61904762 * leverage @@ -140,7 +141,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera backtesting.strategy.adjust_trade_position = MagicMock(return_value=None) assert pytest.approx(trade.liquidation_price) == (0.10278333 if leverage == 1 else 1.2122249) - trade = backtesting._get_adjust_trade_entry_for_candle(trade, row) + trade = backtesting._get_adjust_trade_entry_for_candle(trade, row, current_time) assert trade assert pytest.approx(trade.stake_amount) == 100.0 assert pytest.approx(trade.amount) == 47.61904762 * leverage @@ -148,7 +149,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera # Increase position by 100 backtesting.strategy.adjust_trade_position = MagicMock(return_value=100) - trade = backtesting._get_adjust_trade_entry_for_candle(trade, row) + trade = backtesting._get_adjust_trade_entry_for_candle(trade, row, current_time) assert trade assert pytest.approx(trade.stake_amount) == 200.0 @@ -159,7 +160,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera # Reduce by more than amount - no change to trade. backtesting.strategy.adjust_trade_position = MagicMock(return_value=-500) - trade = backtesting._get_adjust_trade_entry_for_candle(trade, row) + trade = backtesting._get_adjust_trade_entry_for_candle(trade, row, current_time) assert trade assert pytest.approx(trade.stake_amount) == 200.0 @@ -170,7 +171,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera # Reduce position by 50 backtesting.strategy.adjust_trade_position = MagicMock(return_value=-100) - trade = backtesting._get_adjust_trade_entry_for_candle(trade, row) + trade = backtesting._get_adjust_trade_entry_for_candle(trade, row, current_time) assert trade assert pytest.approx(trade.stake_amount) == 100.0 @@ -182,7 +183,7 @@ def test_backtest_position_adjustment_detailed(default_conf, fee, mocker, levera # Adjust below minimum backtesting.strategy.adjust_trade_position = MagicMock(return_value=-99) - trade = backtesting._get_adjust_trade_entry_for_candle(trade, row) + trade = backtesting._get_adjust_trade_entry_for_candle(trade, row, current_time) assert trade assert pytest.approx(trade.stake_amount) == 100.0 From 9e77c93a546fbb9bdf5cc74f8d6d9f9d40e0eb77 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 19:49:33 +0200 Subject: [PATCH 082/145] Tighten funding-fee variance for backtest --- tests/optimize/test_backtesting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 69fb51505..ca4dc73f5 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -1006,7 +1006,7 @@ def test_backtest_one_detail_futures_funding_fees( assert t.nr_of_successful_entries >= 6 # Funding fees will vary depending on the number of adjustment orders # That number is a lot higher with detail data. - assert -20 < t.funding_fees < -0.1 + assert -1.81 < t.funding_fees < -0.1 def test_backtest_timedout_entry_orders(default_conf, fee, mocker, testdatadir) -> None: From 2225f5661bb400bfd9015975d8a481b0f7128455 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 20:27:03 +0200 Subject: [PATCH 083/145] Additional funding fee update after additional entry orders --- freqtrade/freqtradebot.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index d1138e3e1..ffba19356 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -835,14 +835,19 @@ class FreqtradeBot(LoggingMixin): base_currency = self.exchange.get_pair_base_currency(pair) open_date = datetime.now(timezone.utc) + funding_fees = 0.0 + try: + funding_fees = self.exchange.get_funding_fees( + pair=pair, + amount=amount + trade.amount if trade else amount, + is_short=is_short, + open_date=trade.date_last_filled_utc if trade else open_date + ) + except ExchangeError: + logger.warning("Could not find funding fee.") + # This is a new trade if trade is None: - funding_fees = 0.0 - try: - funding_fees = self.exchange.get_funding_fees( - pair=pair, amount=amount, is_short=is_short, open_date=open_date) - except ExchangeError: - logger.warning("Could not find funding fee.") trade = Trade( pair=pair, @@ -878,6 +883,7 @@ class FreqtradeBot(LoggingMixin): trade.is_open = True trade.fee_open_currency = None trade.open_rate_requested = enter_limit_requested + trade.set_funding_fees(funding_fees) trade.orders.append(order_obj) trade.recalc_trade_from_orders() From bfe04464b462dc8fd297a763f815f129b74c988e Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Oct 2023 20:27:54 +0200 Subject: [PATCH 084/145] Handle funding fee errors for regular trades per trade --- freqtrade/freqtradebot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index ffba19356..2e44cc643 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -315,8 +315,8 @@ class FreqtradeBot(LoggingMixin): def update_funding_fees(self) -> None: if self.trading_mode == TradingMode.FUTURES: trades: List[Trade] = Trade.get_open_trades() - try: - for trade in trades: + for trade in trades: + try: trade.set_funding_fees( self.exchange.get_funding_fees( pair=trade.pair, @@ -324,8 +324,8 @@ class FreqtradeBot(LoggingMixin): is_short=trade.is_short, open_date=trade.date_last_filled_utc) ) - except ExchangeError: - logger.warning("Could not update funding fees for open trades.") + except ExchangeError: + logger.warning(f"Could not update funding fees for open trade {trade}.") def startup_backpopulate_precision(self) -> None: From 7344f2080336bc70e72efc7db19193e71e0a7841 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 06:27:29 +0200 Subject: [PATCH 085/145] Handle funding_fee error in exchange class --- freqtrade/exchange/bybit.py | 9 ++++++--- freqtrade/exchange/exchange.py | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/freqtrade/exchange/bybit.py b/freqtrade/exchange/bybit.py index 187830943..e71229cad 100644 --- a/freqtrade/exchange/bybit.py +++ b/freqtrade/exchange/bybit.py @@ -7,7 +7,7 @@ import ccxt from freqtrade.constants import BuySell from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode -from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError +from freqtrade.exceptions import DDosProtection, ExchangeError, OperationalException, TemporaryError from freqtrade.exchange import Exchange from freqtrade.exchange.common import retrier from freqtrade.util.datetime_helpers import dt_now, dt_ts @@ -202,8 +202,11 @@ class Bybit(Exchange): """ # Bybit does not provide "applied" funding fees per position. if self.trading_mode == TradingMode.FUTURES: - return self._fetch_and_calculate_funding_fees( - pair, amount, is_short, open_date) + try: + return self._fetch_and_calculate_funding_fees( + pair, amount, is_short, open_date) + except ExchangeError: + logger.warning(f"Could not update funding fees for {pair}.") return 0.0 def fetch_orders(self, pair: str, since: datetime, params: Optional[Dict] = None) -> List[Dict]: diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index ae8cdaa98..d6a458bf3 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2815,17 +2815,19 @@ class Exchange: :param amount: Trade amount :param open_date: Open date of the trade :return: funding fee since open_date - :raises: ExchangeError if something goes wrong. """ if self.trading_mode == TradingMode.FUTURES: - if self._config['dry_run']: - funding_fees = self._fetch_and_calculate_funding_fees( - pair, amount, is_short, open_date) - else: - funding_fees = self._get_funding_fees_from_exchange(pair, open_date) - return funding_fees - else: - return 0.0 + try: + if self._config['dry_run']: + funding_fees = self._fetch_and_calculate_funding_fees( + pair, amount, is_short, open_date) + else: + funding_fees = self._get_funding_fees_from_exchange(pair, open_date) + return funding_fees + except ExchangeError: + logger.warning(f"Could not update funding fees for {pair}.") + + return 0.0 def get_liquidation_price( self, From 97e9d2dc4258550a9bb07f4805ae3a0a7f00867a Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 06:27:35 +0200 Subject: [PATCH 086/145] Remove get_funding_fee error handling - it's no longer raising this error. --- freqtrade/freqtradebot.py | 50 +++++++++++++++----------------------- tests/test_freqtradebot.py | 4 --- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 2e44cc643..56f0c3d7e 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -316,16 +316,13 @@ class FreqtradeBot(LoggingMixin): if self.trading_mode == TradingMode.FUTURES: trades: List[Trade] = Trade.get_open_trades() for trade in trades: - try: - trade.set_funding_fees( - self.exchange.get_funding_fees( - pair=trade.pair, - amount=trade.amount, - is_short=trade.is_short, - open_date=trade.date_last_filled_utc) - ) - except ExchangeError: - logger.warning(f"Could not update funding fees for open trade {trade}.") + trade.set_funding_fees( + self.exchange.get_funding_fees( + pair=trade.pair, + amount=trade.amount, + is_short=trade.is_short, + open_date=trade.date_last_filled_utc) + ) def startup_backpopulate_precision(self) -> None: @@ -835,16 +832,12 @@ class FreqtradeBot(LoggingMixin): base_currency = self.exchange.get_pair_base_currency(pair) open_date = datetime.now(timezone.utc) - funding_fees = 0.0 - try: - funding_fees = self.exchange.get_funding_fees( - pair=pair, - amount=amount + trade.amount if trade else amount, - is_short=is_short, - open_date=trade.date_last_filled_utc if trade else open_date - ) - except ExchangeError: - logger.warning("Could not find funding fee.") + funding_fees = self.exchange.get_funding_fees( + pair=pair, + amount=amount + trade.amount if trade else amount, + is_short=is_short, + open_date=trade.date_last_filled_utc if trade else open_date + ) # This is a new trade if trade is None: @@ -1700,16 +1693,13 @@ class FreqtradeBot(LoggingMixin): :param exit_check: CheckTuple with signal and reason :return: True if it succeeds False """ - try: - trade.set_funding_fees( - self.exchange.get_funding_fees( - pair=trade.pair, - amount=trade.amount, - is_short=trade.is_short, - open_date=trade.date_last_filled_utc) - ) - except ExchangeError: - logger.warning("Could not update funding fee.") + trade.set_funding_fees( + self.exchange.get_funding_fees( + pair=trade.pair, + amount=trade.amount, + is_short=trade.is_short, + open_date=trade.date_last_filled_utc) + ) exit_type = 'exit' exit_reason = exit_tag or exit_check.exit_reason diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 67a6668d0..790e29179 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -559,7 +559,6 @@ def test_create_trades_preopen(default_conf_usdt, ticker_usdt, fee, mocker, fetch_ticker=ticker_usdt, create_order=MagicMock(return_value=limit_buy_order_usdt_open), get_fee=fee, - get_funding_fees=MagicMock(side_effect=ExchangeError()), ) freqtrade = FreqtradeBot(default_conf_usdt) patch_get_signal(freqtrade) @@ -567,7 +566,6 @@ def test_create_trades_preopen(default_conf_usdt, ticker_usdt, fee, mocker, # Create 2 existing trades freqtrade.execute_entry('ETH/USDT', default_conf_usdt['stake_amount']) freqtrade.execute_entry('NEO/BTC', default_conf_usdt['stake_amount']) - assert log_has("Could not find funding fee.", caplog) assert len(Trade.get_open_trades()) == 2 # Change order_id for new orders @@ -4208,7 +4206,6 @@ def test_execute_trade_exit_market_order( fetch_ticker=ticker_usdt, get_fee=fee, _dry_is_price_crossed=MagicMock(return_value=True), - get_funding_fees=MagicMock(side_effect=ExchangeError()), ) patch_whitelist(mocker, default_conf_usdt) freqtrade = FreqtradeBot(default_conf_usdt) @@ -4234,7 +4231,6 @@ def test_execute_trade_exit_market_order( limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'], exit_check=ExitCheckTuple(exit_type=ExitType.ROI) ) - assert log_has("Could not update funding fee.", caplog) assert not trade.is_open assert pytest.approx(trade.close_profit) == profit_ratio From 2f079711ec67432c6b499dccfd06b7e7d413e8bb Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 06:27:57 +0200 Subject: [PATCH 087/145] Add explicit test for get_funding_fees logic --- tests/exchange/test_exchange.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 297417436..e2b3cc102 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -3737,6 +3737,18 @@ def test_calculate_backoff(retrycount, max_retries, expected): assert calculate_backoff(retrycount, max_retries) == expected +@pytest.mark.parametrize("exchange_name", EXCHANGES) +def test_get_funding_fees(default_conf_usdt, mocker, exchange_name, caplog): + now = datetime.now(timezone.utc) + default_conf_usdt['trading_mode'] = 'futures' + default_conf_usdt['margin_mode'] = 'isolated' + exchange = get_patched_exchange(mocker, default_conf_usdt, id=exchange_name) + exchange._fetch_and_calculate_funding_fees = MagicMock(side_effect=ExchangeError) + assert exchange.get_funding_fees('BTC/USDT:USDT', 1, False, now) == 0.0 + assert exchange._fetch_and_calculate_funding_fees.call_count == 1 + assert log_has("Could not update funding fees for BTC/USDT:USDT.", caplog) + + @pytest.mark.parametrize("exchange_name", ['binance']) def test__get_funding_fees_from_exchange(default_conf, mocker, exchange_name): api_mock = MagicMock() From 813b472c6c031ff89683e26c58a0a68f645763ad Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 06:48:35 +0200 Subject: [PATCH 088/145] Add funding_fee_running column --- freqtrade/persistence/migrations.py | 10 ++++++---- freqtrade/persistence/trade_model.py | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/freqtrade/persistence/migrations.py b/freqtrade/persistence/migrations.py index 717a13f90..bb6c04922 100644 --- a/freqtrade/persistence/migrations.py +++ b/freqtrade/persistence/migrations.py @@ -115,6 +115,7 @@ def migrate_trades_and_orders_table( # Futures Properties interest_rate = get_column_def(cols, 'interest_rate', '0.0') funding_fees = get_column_def(cols, 'funding_fees', '0.0') + funding_fee_running = get_column_def(cols, 'funding_fee_running', 'null') max_stake_amount = get_column_def(cols, 'max_stake_amount', 'stake_amount') # If ticker-interval existed use that, else null. @@ -163,7 +164,7 @@ def migrate_trades_and_orders_table( max_rate, min_rate, exit_reason, exit_order_status, strategy, enter_tag, timeframe, open_trade_value, close_profit_abs, trading_mode, leverage, liquidation_price, is_short, - interest_rate, funding_fees, realized_profit, + interest_rate, funding_fees, funding_fee_running, realized_profit, amount_precision, price_precision, precision_mode, contract_size, max_stake_amount ) @@ -192,7 +193,8 @@ def migrate_trades_and_orders_table( {open_trade_value} open_trade_value, {close_profit_abs} close_profit_abs, {trading_mode} trading_mode, {leverage} leverage, {liquidation_price} liquidation_price, {is_short} is_short, {interest_rate} interest_rate, - {funding_fees} funding_fees, {realized_profit} realized_profit, + {funding_fees} funding_fees, {funding_fee_running} funding_fee_running, + {realized_profit} realized_profit, {amount_precision} amount_precision, {price_precision} price_precision, {precision_mode} precision_mode, {contract_size} contract_size, {max_stake_amount} max_stake_amount @@ -329,8 +331,8 @@ def check_migrate(engine, decl_base, previous_tables) -> None: # if ('orders' not in previous_tables # or not has_column(cols_orders, 'funding_fee')): migrating = False - # if not has_column(cols_trades, 'is_stop_loss_trailing'): - if not has_column(cols_orders, 'ft_cancel_reason'): + # if not has_column(cols_orders, 'ft_cancel_reason'): + if not has_column(cols_trades, 'funding_fee_running'): migrating = True logger.info(f"Running database migration for trades - " f"backup: {table_back_name}, {order_table_bak_name}") diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index d29c73040..f0b936ac7 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -393,6 +393,7 @@ class LocalTrade: # Futures properties funding_fees: Optional[float] = None + funding_fee_running: Optional[float] = None @property def stoploss_or_liquidation(self) -> float: @@ -1489,6 +1490,8 @@ class Trade(ModelBase, LocalTrade): # Futures properties funding_fees: Mapped[Optional[float]] = mapped_column( Float(), nullable=True, default=None) # type: ignore + funding_fee_running: Mapped[Optional[float]] = mapped_column( + Float(), nullable=True, default=None) # type: ignore def __init__(self, **kwargs): from_json = kwargs.pop('__FROM_JSON', None) From 0843b19b6c11f220b5d0c1d86348e502e7142ecd Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 06:49:22 +0200 Subject: [PATCH 089/145] Implement logic around funding_fees runnign --- freqtrade/persistence/trade_model.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index f0b936ac7..228c2505f 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -246,7 +246,8 @@ class Order(ModelBase): self.ft_is_open = False # Assign funding fees to Order. # Assumes backtesting will use date_last_filled_utc to calculate future funding fees. - self.funding_fee = trade.funding_fees + self.funding_fee = trade.funding_fee_running + trade.funding_fee_runnign = 0.0 if (self.ft_order_side == trade.entry_side and self.price): trade.open_rate = self.price @@ -665,7 +666,9 @@ class LocalTrade: """ if funding_fee is None: return - self.funding_fees = funding_fee + self.funding_fee_running = funding_fee + prior_funding_fees = sum([o.funding_fee for o in self.orders if o.funding_fee]) + self.funding_fees = prior_funding_fees + funding_fee def __set_stop_loss(self, stop_loss: float, percent: float): """ @@ -748,7 +751,9 @@ class LocalTrade: logger.info(f'Updating trade (id={self.id}) ...') if order.ft_order_side != 'stoploss': - order.funding_fee = self.funding_fees + order.funding_fee = self.funding_fee_running + # Reset running funding fees + self.funding_fee_running = 0.0 if order.ft_order_side == self.entry_side: # Update open rate and actual amount From e81929bc55dcc4989d2bc7c41269913aa66e958d Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 07:01:43 +0200 Subject: [PATCH 090/145] Have test use funding_fee_running --- tests/persistence/test_persistence.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/persistence/test_persistence.py b/tests/persistence/test_persistence.py index 2a2a53fce..541106ba5 100644 --- a/tests/persistence/test_persistence.py +++ b/tests/persistence/test_persistence.py @@ -583,7 +583,7 @@ def test_calc_open_close_trade_price( oobj.update_from_ccxt_object(entry_order) trade.update_trade(oobj) - trade.funding_fees = funding_fees + trade.funding_fee_running = funding_fees oobj = Order.parse_from_ccxt_object(exit_order, 'ADA/USDT', trade.exit_side) oobj._trade_live = trade @@ -591,7 +591,9 @@ def test_calc_open_close_trade_price( trade.update_trade(oobj) assert trade.is_open is False + # Funding fees transfer from funding_fee_running to funding_Fees assert trade.funding_fees == funding_fees + assert trade.orders[-1].funding_fee == funding_fees assert pytest.approx(trade._calc_open_trade_value(trade.amount, trade.open_rate)) == open_value assert pytest.approx(trade.calc_close_trade_value(trade.close_rate)) == close_value From 69264cc164747cbb395ecc8fe4d9694c12df38b0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 07:13:30 +0200 Subject: [PATCH 091/145] Reduce funding fee update calls Funding fees update every 4-8 hours - calling this every 15 minutes is way overboard. --- freqtrade/freqtradebot.py | 2 +- tests/test_freqtradebot.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 56f0c3d7e..a9bf80456 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -132,7 +132,7 @@ class FreqtradeBot(LoggingMixin): # TODO: This would be more efficient if scheduled in utc time, and performed at each # TODO: funding interval, specified by funding_fee_times on the exchange classes for time_slot in range(0, 24): - for minutes in [0, 15, 30, 45]: + for minutes in [0, 30]: t = str(time(time_slot, minutes, 2)) self._schedule.every().day.at(t).do(update) self.last_process: Optional[datetime] = None diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 790e29179..0e61e169f 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -5917,16 +5917,16 @@ def test_get_valid_price(mocker, default_conf_usdt) -> None: @pytest.mark.parametrize('trading_mode,calls,t1,t2', [ ('spot', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), ('margin', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), - ('futures', 31, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), - ('futures', 32, "2021-08-31 23:59:59", "2021-09-01 08:00:01"), - ('futures', 32, "2021-09-01 00:00:02", "2021-09-01 08:00:02"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:05"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:06"), - ('futures', 33, "2021-08-31 23:59:59", "2021-09-01 08:00:07"), - ('futures', 33, "2021-08-31 23:59:58", "2021-09-01 08:00:07"), + ('futures', 15, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:01"), + ('futures', 16, "2021-09-01 00:00:02", "2021-09-01 08:00:02"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:05"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:06"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:07"), + ('futures', 17, "2021-08-31 23:59:58", "2021-09-01 08:00:07"), ]) def test_update_funding_fees_schedule(mocker, default_conf, trading_mode, calls, time_machine, t1, t2): From fee3c598d0650b42d1aa75caf098f43f61b413e0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 07:16:56 +0200 Subject: [PATCH 092/145] Move schedule to 1 minute after the hour This will avoid congestion at :00, and make sure that the dry-run funding fees are actually already available --- freqtrade/freqtradebot.py | 3 ++- tests/test_freqtradebot.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index a9bf80456..97e3cdb21 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -132,7 +132,7 @@ class FreqtradeBot(LoggingMixin): # TODO: This would be more efficient if scheduled in utc time, and performed at each # TODO: funding interval, specified by funding_fee_times on the exchange classes for time_slot in range(0, 24): - for minutes in [0, 30]: + for minutes in [1, 31]: t = str(time(time_slot, minutes, 2)) self._schedule.every().day.at(t).do(update) self.last_process: Optional[datetime] = None @@ -199,6 +199,7 @@ class FreqtradeBot(LoggingMixin): # Only update open orders on startup # This will update the database after the initial migration self.startup_update_open_orders() + # self.update_funding_fees() def process(self) -> None: """ diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 0e61e169f..40d77ce6c 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -5917,16 +5917,17 @@ def test_get_valid_price(mocker, default_conf_usdt) -> None: @pytest.mark.parametrize('trading_mode,calls,t1,t2', [ ('spot', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), ('margin', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), - ('futures', 15, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), + ('futures', 15, "2021-09-01 00:01:02", "2021-09-01 08:00:01"), + ('futures', 16, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:01"), ('futures', 16, "2021-09-01 00:00:02", "2021-09-01 08:00:02"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:05"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:06"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:07"), - ('futures', 17, "2021-08-31 23:59:58", "2021-09-01 08:00:07"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:05"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:06"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:07"), + ('futures', 17, "2021-08-31 23:59:58", "2021-09-01 08:01:07"), ]) def test_update_funding_fees_schedule(mocker, default_conf, trading_mode, calls, time_machine, t1, t2): From 368bfcf476180d202ddcfdcfff9902b5d89c9095 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 07:25:46 +0200 Subject: [PATCH 093/145] Add comment for funding fees running --- freqtrade/persistence/trade_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 228c2505f..51cf63c87 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -394,6 +394,8 @@ class LocalTrade: # Futures properties funding_fees: Optional[float] = None + # Used to keep running funding fees - between the last filled order and now + # Shall not be used for calculations! funding_fee_running: Optional[float] = None @property From b76513ce336cf38af6f0c1f21070abdfdc5c31ff Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 10:18:34 +0000 Subject: [PATCH 094/145] Fix typo in trade_model --- freqtrade/persistence/trade_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 51cf63c87..9a24556bc 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -247,7 +247,7 @@ class Order(ModelBase): # Assign funding fees to Order. # Assumes backtesting will use date_last_filled_utc to calculate future funding fees. self.funding_fee = trade.funding_fee_running - trade.funding_fee_runnign = 0.0 + trade.funding_fee_running = 0.0 if (self.ft_order_side == trade.entry_side and self.price): trade.open_rate = self.price From 042e35e8d3b3531e4cd57f8d55b2f3c473aaa65d Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 13 Oct 2023 06:45:00 +0200 Subject: [PATCH 095/145] Improve funding fee startup behavior --- freqtrade/freqtradebot.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 97e3cdb21..b6ab24529 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -199,7 +199,7 @@ class FreqtradeBot(LoggingMixin): # Only update open orders on startup # This will update the database after the initial migration self.startup_update_open_orders() - # self.update_funding_fees() + self.update_funding_fees() def process(self) -> None: """ @@ -379,9 +379,6 @@ class FreqtradeBot(LoggingMixin): logger.warning(f"Error updating Order {order.order_id} due to {e}") - if self.trading_mode == TradingMode.FUTURES: - self._schedule.run_pending() - def update_trades_without_assigned_fees(self) -> None: """ Update closed trades without close fees assigned. From 8d2b389e2713a82f5f19683d1693a4797fc9e011 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 10:40:45 +0200 Subject: [PATCH 096/145] Fix wording in log msg --- freqtrade/freqai/prediction_models/ReinforcementLearner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqai/prediction_models/ReinforcementLearner.py b/freqtrade/freqai/prediction_models/ReinforcementLearner.py index a11decc92..d9a11a7a8 100644 --- a/freqtrade/freqai/prediction_models/ReinforcementLearner.py +++ b/freqtrade/freqai/prediction_models/ReinforcementLearner.py @@ -85,7 +85,7 @@ class ReinforcementLearner(BaseReinforcementLearningModel): best_model = self.MODELCLASS.load(dk.data_path / "best_model") return best_model - logger.info('Couldnt find best model, using final model instead.') + logger.info("Couldn't find best model, using final model instead.") return model From 646dd63faf89cbad809905349c56c31678435765 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 10:41:07 +0200 Subject: [PATCH 097/145] Properly close out progressbarCallback based on suggestions provided in https://github.com/DLR-RM/stable-baselines3/issues/1645 --- .../prediction_models/ReinforcementLearner.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/freqtrade/freqai/prediction_models/ReinforcementLearner.py b/freqtrade/freqai/prediction_models/ReinforcementLearner.py index d9a11a7a8..d4c1881a6 100644 --- a/freqtrade/freqai/prediction_models/ReinforcementLearner.py +++ b/freqtrade/freqai/prediction_models/ReinforcementLearner.py @@ -3,6 +3,7 @@ from pathlib import Path from typing import Any, Dict, Type import torch as th +from stable_baselines3.common.callbacks import ProgressBarCallback from freqtrade.freqai.data_kitchen import FreqaiDataKitchen from freqtrade.freqai.RL.Base5ActionRLEnv import Actions, Base5ActionRLEnv, Positions @@ -73,12 +74,19 @@ class ReinforcementLearner(BaseReinforcementLearningModel): 'trained agent.') model = self.dd.model_dictionary[dk.pair] model.set_env(self.train_env) + callbacks = [self.eval_callback, self.tensorboard_callback] + use_progressbar = self.rl_config.get('progress_bar', False) + if use_progressbar: + callbacks.insert(0, ProgressBarCallback()) - model.learn( - total_timesteps=int(total_timesteps), - callback=[self.eval_callback, self.tensorboard_callback], - progress_bar=self.rl_config.get('progress_bar', False) - ) + try: + model.learn( + total_timesteps=int(total_timesteps), + callback=callbacks, + ) + finally: + if use_progressbar: + callbacks[0].on_training_end() if Path(dk.data_path / "best_model.zip").is_file(): logger.info('Callback found a best model.') From 27bae60b68f55e5a38c652e378c46940bf0393b5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 10:51:36 +0200 Subject: [PATCH 098/145] Fix typo --- freqtrade/freqai/RL/BaseEnvironment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqai/RL/BaseEnvironment.py b/freqtrade/freqai/RL/BaseEnvironment.py index 54502c869..b8548dd16 100644 --- a/freqtrade/freqai/RL/BaseEnvironment.py +++ b/freqtrade/freqai/RL/BaseEnvironment.py @@ -159,7 +159,7 @@ class BaseEnvironment(gym.Env): function is designed for tracking incremented objects, events, actions inside the training environment. For example, a user can call this to track the - frequency of occurence of an `is_valid` call in + frequency of occurrence of an `is_valid` call in their `calculate_reward()`: def calculate_reward(self, action: int) -> float: From 58550515ad8006aac75fd09075620d4490b0ef12 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 11:04:05 +0200 Subject: [PATCH 099/145] Fix deprecation warning from tensorboard-callback --- freqtrade/freqai/tensorboard/TensorboardCallback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/freqai/tensorboard/TensorboardCallback.py b/freqtrade/freqai/tensorboard/TensorboardCallback.py index 61652c9c6..4cd49689e 100644 --- a/freqtrade/freqai/tensorboard/TensorboardCallback.py +++ b/freqtrade/freqai/tensorboard/TensorboardCallback.py @@ -49,7 +49,7 @@ class TensorboardCallback(BaseCallback): local_info = self.locals["infos"][0] if self.training_env is None: return True - tensorboard_metrics = self.training_env.get_attr("tensorboard_metrics")[0] + tensorboard_metrics = self.training_env.envs[0].unwrapped.tensorboard_metrics for metric in local_info: if metric not in ["episode", "terminal_observation"]: From ba674fc796e32335566e0c1f2c5551fd5115d444 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 11:20:11 +0200 Subject: [PATCH 100/145] Type-ignore training-envs --- freqtrade/freqai/tensorboard/TensorboardCallback.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/freqai/tensorboard/TensorboardCallback.py b/freqtrade/freqai/tensorboard/TensorboardCallback.py index 4cd49689e..aa65aa199 100644 --- a/freqtrade/freqai/tensorboard/TensorboardCallback.py +++ b/freqtrade/freqai/tensorboard/TensorboardCallback.py @@ -49,7 +49,10 @@ class TensorboardCallback(BaseCallback): local_info = self.locals["infos"][0] if self.training_env is None: return True - tensorboard_metrics = self.training_env.envs[0].unwrapped.tensorboard_metrics + + tensorboard_metrics = ( + self.training_env.envs[0].unwrapped.tensorboard_metrics # type: ignore[attr-defined] + ) for metric in local_info: if metric not in ["episode", "terminal_observation"]: From 2d9d8dc976ef1d242420fd9b84d7a8745ea56e7b Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 11:20:25 +0200 Subject: [PATCH 101/145] Improve logic for progressbarcallback handling --- .../prediction_models/ReinforcementLearner.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/freqtrade/freqai/prediction_models/ReinforcementLearner.py b/freqtrade/freqai/prediction_models/ReinforcementLearner.py index d4c1881a6..fbf12008a 100644 --- a/freqtrade/freqai/prediction_models/ReinforcementLearner.py +++ b/freqtrade/freqai/prediction_models/ReinforcementLearner.py @@ -1,6 +1,6 @@ import logging from pathlib import Path -from typing import Any, Dict, Type +from typing import Any, Dict, List, Optional, Type import torch as th from stable_baselines3.common.callbacks import ProgressBarCallback @@ -74,10 +74,11 @@ class ReinforcementLearner(BaseReinforcementLearningModel): 'trained agent.') model = self.dd.model_dictionary[dk.pair] model.set_env(self.train_env) - callbacks = [self.eval_callback, self.tensorboard_callback] - use_progressbar = self.rl_config.get('progress_bar', False) - if use_progressbar: - callbacks.insert(0, ProgressBarCallback()) + callbacks: List[Any] = [self.eval_callback, self.tensorboard_callback] + progressbar_callback: Optional[ProgressBarCallback] = None + if self.rl_config.get('progress_bar', False): + progressbar_callback = ProgressBarCallback() + callbacks.insert(0, progressbar_callback) try: model.learn( @@ -85,8 +86,8 @@ class ReinforcementLearner(BaseReinforcementLearningModel): callback=callbacks, ) finally: - if use_progressbar: - callbacks[0].on_training_end() + if progressbar_callback: + progressbar_callback.on_training_end() if Path(dk.data_path / "best_model.zip").is_file(): logger.info('Callback found a best model.') From 1e1b8dbe538bba830b6903e1e4b88e63ca8eb6ee Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 Oct 2023 11:52:18 +0200 Subject: [PATCH 102/145] Handle multiproc calls for now --- freqtrade/freqai/tensorboard/TensorboardCallback.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqai/tensorboard/TensorboardCallback.py b/freqtrade/freqai/tensorboard/TensorboardCallback.py index aa65aa199..2be917616 100644 --- a/freqtrade/freqai/tensorboard/TensorboardCallback.py +++ b/freqtrade/freqai/tensorboard/TensorboardCallback.py @@ -50,9 +50,12 @@ class TensorboardCallback(BaseCallback): if self.training_env is None: return True - tensorboard_metrics = ( - self.training_env.envs[0].unwrapped.tensorboard_metrics # type: ignore[attr-defined] - ) + if hasattr(self.training_env, 'envs'): + tensorboard_metrics = self.training_env.envs[0].unwrapped.tensorboard_metrics + + else: + # For RL-multiproc - usage of [0] might need to be evaluated + tensorboard_metrics = self.training_env.get_attr("tensorboard_metrics")[0] for metric in local_info: if metric not in ["episode", "terminal_observation"]: From 9d552d45c2d9bac39883a2a4d0153001be7c9849 Mon Sep 17 00:00:00 2001 From: Stefano Ariestasia Date: Sun, 15 Oct 2023 19:32:03 +0900 Subject: [PATCH 103/145] have to use bitwise operator, otherwise ambiguous error is thrown --- freqtrade/vendor/qtpylib/indicators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/vendor/qtpylib/indicators.py b/freqtrade/vendor/qtpylib/indicators.py index 63797d462..a4d92eed3 100644 --- a/freqtrade/vendor/qtpylib/indicators.py +++ b/freqtrade/vendor/qtpylib/indicators.py @@ -226,7 +226,7 @@ def crossed(series1, series2, direction=None): series1.shift(1) >= series2.shift(1))) if direction is None: - return above or below + return above | below return above if direction == "above" else below From 8cb934849afd6a5581a96f5a59472280301f19cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:47:58 +0000 Subject: [PATCH 104/145] Bump orjson from 3.9.7 to 3.9.9 Bumps [orjson](https://github.com/ijl/orjson) from 3.9.7 to 3.9.9. - [Release notes](https://github.com/ijl/orjson/releases) - [Changelog](https://github.com/ijl/orjson/blob/master/CHANGELOG.md) - [Commits](https://github.com/ijl/orjson/compare/3.9.7...3.9.9) --- updated-dependencies: - dependency-name: orjson dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 802352872..9c94b8a28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,7 +32,7 @@ py_find_1st==1.1.5 # Load ticker files 30% faster python-rapidjson==1.12 # Properly format api responses -orjson==3.9.7 +orjson==3.9.9 # Notify systemd sdnotify==0.3.2 From 4c6e33aa824d8c7b1626c187cac9a03a02114629 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:48:10 +0000 Subject: [PATCH 105/145] Bump psutil from 5.9.5 to 5.9.6 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.9.5 to 5.9.6. - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.9.5...release-5.9.6) --- updated-dependencies: - dependency-name: psutil dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 802352872..0b71a345e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ pydantic==2.4.2 uvicorn==0.23.2 pyjwt==2.8.0 aiofiles==23.2.1 -psutil==5.9.5 +psutil==5.9.6 # Support for colorized terminal output colorama==0.4.6 From dd30df705740190db0d8e92cec9c58cf3ae73a92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:48:44 +0000 Subject: [PATCH 106/145] Bump sqlalchemy from 2.0.21 to 2.0.22 Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.21 to 2.0.22. - [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases) - [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst) - [Commits](https://github.com/sqlalchemy/sqlalchemy/commits) --- updated-dependencies: - dependency-name: sqlalchemy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 802352872..7cc2ac1d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ pandas-ta==0.3.14b ccxt==4.1.8 cryptography==41.0.4 aiohttp==3.8.6 -SQLAlchemy==2.0.21 +SQLAlchemy==2.0.22 python-telegram-bot==20.6 # can't be hard-pinned due to telegram-bot pinning httpx with ~ httpx>=0.24.1 From ec64a182f989e5569feb7b7942fa4d0178ae2019 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:48:51 +0000 Subject: [PATCH 107/145] Bump mkdocs-material from 9.4.4 to 9.4.6 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.4 to 9.4.6. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.4...9.4.6) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index ca44bc753..3f3c05492 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,6 +1,6 @@ markdown==3.5 mkdocs==1.5.3 -mkdocs-material==9.4.4 +mkdocs-material==9.4.6 mdx_truly_sane_lists==1.3 pymdown-extensions==10.3 jinja2==3.1.2 From 27cd54b42c55a17e11762df33c7ca929f2c2ba92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:49:12 +0000 Subject: [PATCH 108/145] Bump ast-comments from 1.1.0 to 1.1.2 Bumps [ast-comments](https://github.com/t3rn0/ast-comments) from 1.1.0 to 1.1.2. - [Release notes](https://github.com/t3rn0/ast-comments/releases) - [Commits](https://github.com/t3rn0/ast-comments/compare/1.1.0...1.1.2) --- updated-dependencies: - dependency-name: ast-comments dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 802352872..b551ed683 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,5 +60,5 @@ schedule==1.2.1 websockets==11.0.3 janus==1.0.0 -ast-comments==1.1.0 +ast-comments==1.1.2 packaging==23.2 From 1e0ce7d47ac312f0933dd10c5e6d46ed341a7133 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 03:49:38 +0000 Subject: [PATCH 109/145] Bump pre-commit from 3.4.0 to 3.5.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.4.0...v3.5.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 146eb2a4e..37355a1e1 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,7 +9,7 @@ coveralls==3.3.1 ruff==0.0.292 mypy==1.5.1 -pre-commit==3.4.0 +pre-commit==3.5.0 pytest==7.4.2 pytest-asyncio==0.21.1 pytest-cov==4.1.0 From 5d9b69cbfe0fa10177d938ea1ad34f22d79a7045 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 Oct 2023 06:33:53 +0200 Subject: [PATCH 110/145] sqlalchemy - precommit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0674fb598..f475e43c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - types-requests==2.31.0.8 - types-tabulate==0.9.0.3 - types-python-dateutil==2.8.19.14 - - SQLAlchemy==2.0.21 + - SQLAlchemy==2.0.22 # stages: [push] - repo: https://github.com/pycqa/isort From 35f6333b67de8f0cdf3879a3c3e8ffce98c1c66c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:01:30 +0000 Subject: [PATCH 111/145] Bump ccxt from 4.1.8 to 4.1.13 Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.1.8 to 4.1.13. - [Release notes](https://github.com/ccxt/ccxt/releases) - [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md) - [Commits](https://github.com/ccxt/ccxt/compare/4.1.8...4.1.13) --- updated-dependencies: - dependency-name: ccxt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 58ed386de..91f53ad46 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ numpy==1.25.2; platform_machine == 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b -ccxt==4.1.8 +ccxt==4.1.13 cryptography==41.0.4 aiohttp==3.8.6 SQLAlchemy==2.0.22 From 5940279f7be60ae32cdec674e17c2daadf8b9b3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:01:34 +0000 Subject: [PATCH 112/145] Bump mypy from 1.5.1 to 1.6.0 Bumps [mypy](https://github.com/python/mypy) from 1.5.1 to 1.6.0. - [Commits](https://github.com/python/mypy/compare/v1.5.1...v1.6.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 37355a1e1..281c1da5a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,7 +8,7 @@ coveralls==3.3.1 ruff==0.0.292 -mypy==1.5.1 +mypy==1.6.0 pre-commit==3.5.0 pytest==7.4.2 pytest-asyncio==0.21.1 From fadc7a2051702af1148d27fe00249f4e000b69f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:59:18 +0000 Subject: [PATCH 113/145] Bump types-requests from 2.31.0.8 to 2.31.0.9 Bumps [types-requests](https://github.com/python/typeshed) from 2.31.0.8 to 2.31.0.9. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-requests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 281c1da5a..6783c0dfc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,6 +25,6 @@ nbconvert==7.9.2 # mypy types types-cachetools==5.3.0.6 types-filelock==3.2.7 -types-requests==2.31.0.8 +types-requests==2.31.0.9 types-tabulate==0.9.0.3 types-python-dateutil==2.8.19.14 From 3264e2c31d615e462ca317b80c6f23a39ed8e1de Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 Oct 2023 13:38:01 +0200 Subject: [PATCH 114/145] pre-commit requests bump --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f475e43c6..ef3b16f21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: additional_dependencies: - types-cachetools==5.3.0.6 - types-filelock==3.2.7 - - types-requests==2.31.0.8 + - types-requests==2.31.0.9 - types-tabulate==0.9.0.3 - types-python-dateutil==2.8.19.14 - SQLAlchemy==2.0.22 From f46fa440f0d2f6ea3ae35aafaf91072ae80a06f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:27:50 +0000 Subject: [PATCH 115/145] Bump numpy from 1.25.2 to 1.26.1 Bumps [numpy](https://github.com/numpy/numpy) from 1.25.2 to 1.26.1. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.25.2...v1.26.1) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 91f53ad46..49e0b11a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ numpy==1.26.0; platform_machine != 'armv7l' -numpy==1.25.2; platform_machine == 'armv7l' +numpy==1.26.1; platform_machine == 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b From 7de415a6a4ff8d5327e7659e4e844ceb92b150c2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 16 Oct 2023 18:28:00 +0200 Subject: [PATCH 116/145] Don't bump numpy for armhf just yet --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 49e0b11a2..0834e26b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -numpy==1.26.0; platform_machine != 'armv7l' -numpy==1.26.1; platform_machine == 'armv7l' +numpy==1.25.2; platform_machine == 'armv7l' +numpy==1.26.1; platform_machine != 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b From e6d0d53e47d78b6c98b8889283fb8c90a2542f46 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Oct 2023 07:03:03 +0200 Subject: [PATCH 117/145] Add further ebug log message for stopping clarity --- freqtrade/exchange/exchange.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d6a458bf3..0aaa1654c 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2279,6 +2279,7 @@ class Exchange: from_id = t[-1][1] else: + logger.debug("Stopping as no more trades were returned.") break except asyncio.CancelledError: logger.debug("Async operation Interrupted, breaking trades DL loop.") From 1a78346cf185952726aff5e5af94482979ca38ff Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Oct 2023 07:11:06 +0200 Subject: [PATCH 118/145] Add further ebug log message for stopping clarity for --dl-data --- freqtrade/exchange/exchange.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 0aaa1654c..3dfd7d3a5 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2313,6 +2313,7 @@ class Exchange: f"Stopping because until was reached. {t[-1][0]} > {until}") break else: + logger.debug("Stopping as no more trades were returned.") break except asyncio.CancelledError: logger.debug("Async operation Interrupted, breaking trades DL loop.") From a8c246ce0d080e8141ab441ef02adeb78ff5ca34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:02:44 +0000 Subject: [PATCH 119/145] Bump urllib3 from 2.0.6 to 2.0.7 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.6 to 2.0.7. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.0.6...2.0.7) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0834e26b7..35670343d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ httpx>=0.24.1 arrow==1.3.0 cachetools==5.3.1 requests==2.31.0 -urllib3==2.0.6 +urllib3==2.0.7 jsonschema==4.19.1 TA-Lib==0.4.28 technical==1.4.0 From a80c9794829721253e04cefe05163fd0bc4a7eba Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 18 Oct 2023 20:23:19 +0200 Subject: [PATCH 120/145] Improve behavior when downloading trades data on time-based pagination closes #9307 --- freqtrade/exchange/exchange.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 3dfd7d3a5..7638dcef1 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2305,6 +2305,11 @@ class Exchange: try: t = await self._async_fetch_trades(pair, since=since) if t: + # No more trades to download available at the exchange, + # So we repeatedly get the same trade over and over again. + if since == t[-1][0] and len(t) == 1: + logger.debug("Stopping because no more trades are available.") + break since = t[-1][0] trades.extend(t) # Reached the end of the defined-download period From 0a5cee6a733c98980994a771b98da5e52f13ee09 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 19 Oct 2023 22:06:21 +0200 Subject: [PATCH 121/145] Ensure we're not erroring on invalid custom_entry / exit prices closes #9323 --- freqtrade/optimize/backtesting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 4986f7b55..04037bc40 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -650,7 +650,7 @@ class Backtesting: current_time=current_time, proposed_rate=close_rate, current_profit=current_profit, exit_tag=exit_reason) - if rate != close_rate: + if rate is not None and rate != close_rate: close_rate = price_to_precision(rate, trade.price_precision, self.precision_mode) # We can't place orders lower than current low. @@ -763,7 +763,7 @@ class Backtesting: ) # default value is the open rate # We can't place orders higher than current high (otherwise it'd be a stop limit entry) # which freqtrade does not support in live. - if new_rate != propose_rate: + if new_rate is not None and new_rate != propose_rate: propose_rate = price_to_precision(new_rate, price_precision, self.precision_mode) if direction == "short": From e69c21c9f56f7f4f35af8b3b73ad971cc3b9dd3f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 22 Oct 2023 08:59:23 +0200 Subject: [PATCH 122/145] Revert "Bump torch from 2.0.1 to 2.1.0" --- requirements-freqai-rl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index 0e6811fd1..c2cca5427 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -2,7 +2,7 @@ -r requirements-freqai.txt # Required for freqai-rl -torch==2.1.0 +torch==2.0.1 #until these branches will be released we can use this gymnasium==0.29.1 stable_baselines3==2.1.0 From bbbc8a760c7ef3e9498153ed29ea8aea36b7feb9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 22 Oct 2023 09:24:28 +0200 Subject: [PATCH 123/145] Fix stop evaluation sequence to have stop before liquidation Adjust test to have liquidation above stop closes #9296 --- freqtrade/strategy/interface.py | 8 ++++---- tests/strategy/test_interface.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 5cdbb6bf6..cbe6afc26 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -1244,10 +1244,6 @@ class IStrategy(ABC, HyperStrategyMixin): and trade.liquidation_price <= (high or current_rate) and trade.is_short) - if (liq_higher_long or liq_lower_short): - logger.debug(f"{trade.pair} - Liquidation price hit. exit_type=ExitType.LIQUIDATION") - return ExitCheckTuple(exit_type=ExitType.LIQUIDATION) - # evaluate if the stoploss was hit if stoploss is not on exchange # in Dry-Run, this handles stoploss logic as well, as the logic will not be different to # regular stoploss handling. @@ -1268,6 +1264,10 @@ class IStrategy(ABC, HyperStrategyMixin): return ExitCheckTuple(exit_type=exit_type) + if (liq_higher_long or liq_lower_short): + logger.debug(f"{trade.pair} - Liquidation price hit. exit_type=ExitType.LIQUIDATION") + return ExitCheckTuple(exit_type=ExitType.LIQUIDATION) + return ExitCheckTuple(exit_type=ExitType.NONE) def min_roi_reached_entry(self, trade_dur: int) -> Tuple[Optional[int], Optional[float]]: diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index e8abcb362..226bbc7ae 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -422,7 +422,7 @@ def test_min_roi_reached3(default_conf, fee) -> None: # enable custom stoploss, expected after 1st call, expected after 2nd call (0.2, 0.9, ExitType.NONE, None, False, False, 0.3, 0.9, ExitType.NONE, None), (0.2, 0.9, ExitType.NONE, None, False, False, -0.2, 0.9, ExitType.STOP_LOSS, None), - (0.2, 0.9, ExitType.NONE, 0.8, False, False, -0.2, 0.9, ExitType.LIQUIDATION, None), + (0.2, 0.9, ExitType.NONE, 0.92, False, False, -0.09, 0.9, ExitType.LIQUIDATION, None), (0.2, 1.14, ExitType.NONE, None, True, False, 0.05, 1.14, ExitType.TRAILING_STOP_LOSS, None), (0.01, 0.96, ExitType.NONE, None, True, False, 0.05, 1, ExitType.NONE, None), From 16dfde22fcc43539744ad0742d2112942f0baed9 Mon Sep 17 00:00:00 2001 From: amargedon Date: Sun, 22 Oct 2023 18:43:35 +0200 Subject: [PATCH 124/145] Add FIAT mapping for USDC --- freqtrade/rpc/fiat_convert.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/rpc/fiat_convert.py b/freqtrade/rpc/fiat_convert.py index d790c4b48..d084725d1 100644 --- a/freqtrade/rpc/fiat_convert.py +++ b/freqtrade/rpc/fiat_convert.py @@ -27,6 +27,7 @@ coingecko_mapping = { 'usdt': 'tether', 'busd': 'binance-usd', 'tusd': 'true-usd', + 'usdc': 'usd-coin', } From 58aaaffe2bc11033c55a50f67670a06172e120d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:02 +0000 Subject: [PATCH 125/145] Bump websockets from 11.0.3 to 12.0 Bumps [websockets](https://github.com/python-websockets/websockets) from 11.0.3 to 12.0. - [Release notes](https://github.com/python-websockets/websockets/releases) - [Commits](https://github.com/python-websockets/websockets/compare/11.0.3...12.0) --- updated-dependencies: - dependency-name: websockets dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 35670343d..7ab1acd1e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -57,7 +57,7 @@ python-dateutil==2.8.2 schedule==1.2.1 #WS Messages -websockets==11.0.3 +websockets==12.0 janus==1.0.0 ast-comments==1.1.2 From e5f0fe288afe575b7de2c73f18f1cc3319909d92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:06 +0000 Subject: [PATCH 126/145] Bump pymdown-extensions from 10.3 to 10.3.1 Bumps [pymdown-extensions](https://github.com/facelessuser/pymdown-extensions) from 10.3 to 10.3.1. - [Release notes](https://github.com/facelessuser/pymdown-extensions/releases) - [Commits](https://github.com/facelessuser/pymdown-extensions/compare/10.3...10.3.1) --- updated-dependencies: - dependency-name: pymdown-extensions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 3f3c05492..029dc4203 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -2,5 +2,5 @@ markdown==3.5 mkdocs==1.5.3 mkdocs-material==9.4.6 mdx_truly_sane_lists==1.3 -pymdown-extensions==10.3 +pymdown-extensions==10.3.1 jinja2==3.1.2 From 7fb3632e7b7ea3a4d93159c53967e13e1a0a92ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:11 +0000 Subject: [PATCH 127/145] Bump mypy from 1.6.0 to 1.6.1 Bumps [mypy](https://github.com/python/mypy) from 1.6.0 to 1.6.1. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.6.0...v1.6.1) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 6783c0dfc..a831b18dc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,7 +8,7 @@ coveralls==3.3.1 ruff==0.0.292 -mypy==1.6.0 +mypy==1.6.1 pre-commit==3.5.0 pytest==7.4.2 pytest-asyncio==0.21.1 From 22b4555926b44e7200d5a01b9bde6337ab21a350 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:46 +0000 Subject: [PATCH 128/145] Bump tensorboard from 2.14.1 to 2.15.0 Bumps [tensorboard](https://github.com/tensorflow/tensorboard) from 2.14.1 to 2.15.0. - [Release notes](https://github.com/tensorflow/tensorboard/releases) - [Changelog](https://github.com/tensorflow/tensorboard/blob/2.15.0/RELEASE.md) - [Commits](https://github.com/tensorflow/tensorboard/compare/2.14.1...2.15.0) --- updated-dependencies: - dependency-name: tensorboard dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-freqai.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-freqai.txt b/requirements-freqai.txt index b79f02e93..67235a1b2 100644 --- a/requirements-freqai.txt +++ b/requirements-freqai.txt @@ -8,5 +8,5 @@ joblib==1.3.2 catboost==1.2.2; 'arm' not in platform_machine lightgbm==4.1.0 xgboost==2.0.0 -tensorboard==2.14.1 +tensorboard==2.15.0 datasieve==0.1.7 From bf96a43efb546cd0934cec39ff890b7616c102a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:50 +0000 Subject: [PATCH 129/145] Bump types-requests from 2.31.0.9 to 2.31.0.10 Bumps [types-requests](https://github.com/python/typeshed) from 2.31.0.9 to 2.31.0.10. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-requests dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 6783c0dfc..fecb96a55 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,6 +25,6 @@ nbconvert==7.9.2 # mypy types types-cachetools==5.3.0.6 types-filelock==3.2.7 -types-requests==2.31.0.9 +types-requests==2.31.0.10 types-tabulate==0.9.0.3 types-python-dateutil==2.8.19.14 From 38cf50830a5fff20be3b104e5c2323ed462d78a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:46:55 +0000 Subject: [PATCH 130/145] Bump fastapi from 0.103.2 to 0.104.0 Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.2 to 0.104.0. - [Release notes](https://github.com/tiangolo/fastapi/releases) - [Commits](https://github.com/tiangolo/fastapi/compare/0.103.2...0.104.0) --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 35670343d..4e1f7f577 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,7 +38,7 @@ orjson==3.9.9 sdnotify==0.3.2 # API Server -fastapi==0.103.2 +fastapi==0.104.0 pydantic==2.4.2 uvicorn==0.23.2 pyjwt==2.8.0 From d2069c1729a019e0ca5d410346520b73b389a1ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:47:01 +0000 Subject: [PATCH 131/145] Bump pytest-mock from 3.11.1 to 3.12.0 Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.11.1 to 3.12.0. - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.11.1...v3.12.0) --- updated-dependencies: - dependency-name: pytest-mock dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 6783c0dfc..454467b82 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -13,7 +13,7 @@ pre-commit==3.5.0 pytest==7.4.2 pytest-asyncio==0.21.1 pytest-cov==4.1.0 -pytest-mock==3.11.1 +pytest-mock==3.12.0 pytest-random-order==1.1.0 isort==5.12.0 # For datetime mocking From 748ac50d831a4f2cdf6ecdc5bc7fd6078222b014 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 03:47:08 +0000 Subject: [PATCH 132/145] Bump ccxt from 4.1.13 to 4.1.22 Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.1.13 to 4.1.22. - [Release notes](https://github.com/ccxt/ccxt/releases) - [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md) - [Commits](https://github.com/ccxt/ccxt/compare/4.1.13...4.1.22) --- updated-dependencies: - dependency-name: ccxt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 35670343d..09d3282a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ numpy==1.26.1; platform_machine != 'armv7l' pandas==2.0.3 pandas-ta==0.3.14b -ccxt==4.1.13 +ccxt==4.1.22 cryptography==41.0.4 aiohttp==3.8.6 SQLAlchemy==2.0.22 From fe5f085ec164e2d3bbf1b813f767ca11f8cd9be0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 23 Oct 2023 06:31:22 +0200 Subject: [PATCH 133/145] types-requests pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef3b16f21..f3fcb0b84 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: additional_dependencies: - types-cachetools==5.3.0.6 - types-filelock==3.2.7 - - types-requests==2.31.0.9 + - types-requests==2.31.0.10 - types-tabulate==0.9.0.3 - types-python-dateutil==2.8.19.14 - SQLAlchemy==2.0.22 From c2905a4522af0b4af9c6b4cee1abdb3965669b5d Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 23 Oct 2023 06:43:50 +0200 Subject: [PATCH 134/145] use --output-format in ruff CI --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e18090f08..912b906d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Run Ruff run: | - ruff check --format=github . + ruff check --output-format=github . - name: Mypy run: | @@ -217,7 +217,7 @@ jobs: - name: Run Ruff run: | - ruff check --format=github . + ruff check --output-format=github . - name: Mypy run: | @@ -287,7 +287,7 @@ jobs: - name: Run Ruff run: | - ruff check --format=github . + ruff check --output-format=github . - name: Mypy run: | From 494fd734bc3398bf81d81fbadf48e06210483780 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 04:47:44 +0000 Subject: [PATCH 135/145] Bump ruff from 0.0.292 to 0.1.1 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.292 to 0.1.1. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.0.292...v0.1.1) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a831b18dc..8b66eac21 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,7 +7,7 @@ -r docs/requirements-docs.txt coveralls==3.3.1 -ruff==0.0.292 +ruff==0.1.1 mypy==1.6.1 pre-commit==3.5.0 pytest==7.4.2 From 9dcf236387fc87fe91a9c62beac407953820516d Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 23 Oct 2023 18:06:31 +0200 Subject: [PATCH 136/145] Align flake and ruff configs further --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index cd0c65916..bcfc1e551 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,11 @@ extend-select = [ # "TCH", # flake8-type-checking "PTH", # flake8-use-pathlib ] +extend-ignore = [ + "E241", # Multiple spaces after comma + "E272", # Multiple spaces before keyword + "E221", # Multiple spaces before operator +] [tool.ruff.mccabe] max-complexity = 12 From 4f4b7c5625e702b99eea1369b18466f6d74714d6 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Mon, 23 Oct 2023 20:31:51 +0200 Subject: [PATCH 137/145] fix: bug in startup candle offset --- freqtrade/freqai/data_drawer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/freqtrade/freqai/data_drawer.py b/freqtrade/freqai/data_drawer.py index 0306282c0..a0c902f48 100644 --- a/freqtrade/freqai/data_drawer.py +++ b/freqtrade/freqai/data_drawer.py @@ -296,8 +296,7 @@ class FreqaiDataDrawer: f"for more than {len(dataframe.index)} candles.") df_concat = pd.concat([hist_preds, new_pred], ignore_index=True, keys=hist_preds.keys()) - # remove last row because we will append that later in append_model_predictions() - df_concat = df_concat.iloc[:-1] + # any missing values will get zeroed out so users can see the exact # downtime in FreqUI df_concat = df_concat.fillna(0) From 5da48d8ffc6956047d692800399b5db0fd4419fc Mon Sep 17 00:00:00 2001 From: robcaulk Date: Wed, 25 Oct 2023 18:38:30 +0200 Subject: [PATCH 138/145] chore: fix tests --- tests/freqai/test_freqai_datadrawer.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/freqai/test_freqai_datadrawer.py b/tests/freqai/test_freqai_datadrawer.py index ca4749747..2d1b1c691 100644 --- a/tests/freqai/test_freqai_datadrawer.py +++ b/tests/freqai/test_freqai_datadrawer.py @@ -179,10 +179,9 @@ def test_set_initial_return_values(mocker, freqai_conf): hist_pred_df = freqai.dd.historic_predictions[pair] model_return_df = freqai.dd.model_return_values[pair] - assert (hist_pred_df['date_pred'].iloc[-1] == - pd.Timestamp(end_x_plus_5) - pd.Timedelta(days=1)) + assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5) assert 'date_pred' in hist_pred_df.columns - assert hist_pred_df.shape[0] == 7 # Total rows: 5 from historic and 2 new zeros + assert hist_pred_df.shape[0] == 8 # compare values in model_return_df with hist_pred_df assert (model_return_df["value"].values == @@ -234,9 +233,9 @@ def test_set_initial_return_values_warning(mocker, freqai_conf): hist_pred_df = freqai.dd.historic_predictions[pair] model_return_df = freqai.dd.model_return_values[pair] - assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5) - pd.Timedelta(days=1) + assert hist_pred_df['date_pred'].iloc[-1] == pd.Timestamp(end_x_plus_5) assert 'date_pred' in hist_pred_df.columns - assert hist_pred_df.shape[0] == 9 # Total rows: 5 from historic and 4 new zeros + assert hist_pred_df.shape[0] == 10 # compare values in model_return_df with hist_pred_df assert (model_return_df["value"].values == hist_pred_df.tail( From 1dccdf05946432a33acb9e4a0e4c87a0d7f57bb9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 26 Oct 2023 19:49:25 +0200 Subject: [PATCH 139/145] bump ruff in pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3fcb0b84..c7f150af3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit # Ruff version. - rev: 'v0.0.270' + rev: 'v0.1.1' hooks: - id: ruff From bb78285661af67811068b69aa37f736b670e7715 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 27 Oct 2023 06:38:09 +0200 Subject: [PATCH 140/145] Add hint about helper commands to common mistakes section --- docs/strategy-customization.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/strategy-customization.md b/docs/strategy-customization.md index e23c3cc41..fa7db8b18 100644 --- a/docs/strategy-customization.md +++ b/docs/strategy-customization.md @@ -1008,6 +1008,10 @@ The following lists some common patterns which should be avoided to prevent frus - don't use `dataframe['volume'].mean()`. This uses the full DataFrame for backtesting, including data from the future. Use `dataframe['volume'].rolling().mean()` instead - don't use `.resample('1h')`. This uses the left border of the interval, so moves data from an hour to the start of the hour. Use `.resample('1h', label='right')` instead. +!!! Hint "Identifying problems" + You may also want to check the 2 helper commands [lookahead-analysis](lookahead-analysis.md) and [recursive-analysis](recursive-analysis.md), which can each help you figure out problems with your strategy in different ways. + Please treat them as what they are - helpers to identify most common problems. A negative result of each does not guarantee that there's none of the above errors included. + ### Colliding signals When conflicting signals collide (e.g. both `'enter_long'` and `'exit_long'` are 1), freqtrade will do nothing and ignore the entry signal. This will avoid trades that enter, and exit immediately. Obviously, this can potentially lead to missed entries. From 1e18b35f229178a82247225d01a62471c9738447 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 27 Oct 2023 07:08:38 +0200 Subject: [PATCH 141/145] Change box type to tip --- docs/strategy-customization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/strategy-customization.md b/docs/strategy-customization.md index fa7db8b18..e2cdad81a 100644 --- a/docs/strategy-customization.md +++ b/docs/strategy-customization.md @@ -1008,7 +1008,7 @@ The following lists some common patterns which should be avoided to prevent frus - don't use `dataframe['volume'].mean()`. This uses the full DataFrame for backtesting, including data from the future. Use `dataframe['volume'].rolling().mean()` instead - don't use `.resample('1h')`. This uses the left border of the interval, so moves data from an hour to the start of the hour. Use `.resample('1h', label='right')` instead. -!!! Hint "Identifying problems" +!!! Tip "Identifying problems" You may also want to check the 2 helper commands [lookahead-analysis](lookahead-analysis.md) and [recursive-analysis](recursive-analysis.md), which can each help you figure out problems with your strategy in different ways. Please treat them as what they are - helpers to identify most common problems. A negative result of each does not guarantee that there's none of the above errors included. From e97d9013d53317da1b1a5ad391a9eb33da15fe0e Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 29 Oct 2023 09:17:07 +0100 Subject: [PATCH 142/145] Avoid having orders leak after multiple "from_json" calls --- tests/persistence/test_trade_fromjson.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/persistence/test_trade_fromjson.py b/tests/persistence/test_trade_fromjson.py index 4d546ec04..bb5e77f22 100644 --- a/tests/persistence/test_trade_fromjson.py +++ b/tests/persistence/test_trade_fromjson.py @@ -3,7 +3,7 @@ from datetime import datetime, timezone import pytest -from freqtrade.persistence.trade_model import Trade +from freqtrade.persistence.trade_model import LocalTrade, Trade from tests.conftest import create_mock_trades_usdt @@ -207,6 +207,7 @@ def test_trade_serialize_load_back(fee): assert t.id == 1 t.funding_fees = 0.025 t.orders[0].funding_fee = 0.0125 + assert len(t.orders) == 2 Trade.commit() tjson = t.to_json(False) @@ -216,6 +217,7 @@ def test_trade_serialize_load_back(fee): assert trade.id == t.id assert trade.funding_fees == t.funding_fees + assert len(trade.orders) == len(t.orders) assert trade.orders[0].funding_fee == t.orders[0].funding_fee excluded = [ 'trade_id', 'quote_currency', 'open_timestamp', 'close_timestamp', @@ -255,5 +257,10 @@ def test_trade_serialize_load_back(fee): failed.append((obj, tattr, value)) assert tjson['orders'][0]['pair'] == order_obj.ft_pair - print(failed) assert not failed + + trade2 = LocalTrade.from_json(trade_string) + assert len(trade2.orders) == len(t.orders) + + trade3 = LocalTrade.from_json(trade_string) + assert len(trade3.orders) == len(t.orders) From 2c20464983307c2cab2012a976aebc1be209da36 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 29 Oct 2023 09:18:00 +0100 Subject: [PATCH 143/145] Reinit orders list on "local" objects to instance variable --- freqtrade/persistence/trade_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 9a24556bc..e66c22372 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -536,6 +536,7 @@ class LocalTrade: for key in kwargs: setattr(self, key, kwargs[key]) self.recalc_open_trade_value() + self.orders = [] if self.trading_mode == TradingMode.MARGIN and self.interest_rate is None: raise OperationalException( f"{self.trading_mode.value} trading requires param interest_rate on trades") From 9a73f7a7b8dbc9b97ab5fc2826b5c9fac8028d25 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 29 Oct 2023 13:51:19 +0100 Subject: [PATCH 144/145] Bump version to 2023.10 --- freqtrade/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index f396cd0dd..6ff32e003 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -1,5 +1,5 @@ """ Freqtrade bot """ -__version__ = '2023.9' +__version__ = '2023.10' if 'dev' in __version__: from pathlib import Path From c98c6c38dc630d81ac8daa9c802bbedad2f2bfdf Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 30 Oct 2023 20:10:01 +0100 Subject: [PATCH 145/145] update binance leverage tiers --- .../exchange/binance_leverage_tiers.json | 4112 +++++++++++++---- 1 file changed, 3087 insertions(+), 1025 deletions(-) diff --git a/freqtrade/exchange/binance_leverage_tiers.json b/freqtrade/exchange/binance_leverage_tiers.json index 80aa06e0c..39d2ea7fc 100644 --- a/freqtrade/exchange/binance_leverage_tiers.json +++ b/freqtrade/exchange/binance_leverage_tiers.json @@ -218,10 +218,10 @@ "minNotional": 0.0, "maxNotional": 5000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", "maintMarginRatio": "0.01", @@ -330,112 +330,128 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 10000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "10000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, + "info": { + "bracket": "2", + "initialLeverage": "25", + "notionalCap": "10000", + "notionalFloor": "5000", + "maintMarginRatio": "0.02", + "cum": "25.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 10000.0, "maxNotional": 50000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "20", "notionalCap": "50000", "notionalFloor": "10000", "maintMarginRatio": "0.025", - "cum": "50.0" + "cum": "75.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 50000.0, "maxNotional": 1200000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "10", "notionalCap": "1200000", "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "1300.0" + "cum": "1325.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 1200000.0, "maxNotional": 3000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "3000000", "notionalFloor": "1200000", "maintMarginRatio": "0.1", - "cum": "61300.0" + "cum": "61325.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 3000000.0, "maxNotional": 3600000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "3600000", "notionalFloor": "3000000", "maintMarginRatio": "0.125", - "cum": "136300.0" + "cum": "136325.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 3600000.0, "maxNotional": 9000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "9000000", "notionalFloor": "3600000", "maintMarginRatio": "0.25", - "cum": "586300.0" + "cum": "586325.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 9000000.0, "maxNotional": 15000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "15000000", "notionalFloor": "9000000", "maintMarginRatio": "0.5", - "cum": "2836300.0" + "cum": "2836325.0" } } ], @@ -901,14 +917,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -925,87 +941,103 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 25000.0, - "maxNotional": 400000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 10.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 15.0, "info": { "bracket": "3", - "initialLeverage": "10", - "notionalCap": "400000", + "initialLeverage": "15", + "notionalCap": "100000", "notionalFloor": "25000", - "maintMarginRatio": "0.05", - "cum": "700.0" + "maintMarginRatio": "0.03", + "cum": "175.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 400000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "4", + "initialLeverage": "10", + "notionalCap": "400000", + "notionalFloor": "100000", + "maintMarginRatio": "0.05", + "cum": "2175.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 400000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "1000000", "notionalFloor": "400000", "maintMarginRatio": "0.1", - "cum": "20700.0" + "cum": "22175.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.125", - "cum": "45700.0" + "cum": "47175.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 6000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "295700.0" + "cum": "297175.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 6000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1795700.0" + "cum": "1797175.0" } } ], @@ -1585,14 +1617,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -1602,14 +1634,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -1625,7 +1657,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -1641,7 +1673,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -1657,7 +1689,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -1673,7 +1705,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -1689,7 +1721,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -1699,14 +1731,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -1716,14 +1748,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -1732,14 +1764,14 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -1755,7 +1787,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -1764,30 +1796,46 @@ "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, - "maxLeverage": 2.0, + "maxLeverage": 4.0, "info": { "bracket": "5", - "initialLeverage": "2", + "initialLeverage": "4", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.25", + "cum": "136925.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 2000000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "5000000", - "notionalFloor": "1000000", + "notionalFloor": "2000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "636925.0" } } ], @@ -1895,14 +1943,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -1919,7 +1967,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -1935,7 +1983,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -1951,7 +1999,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -1967,7 +2015,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -1983,7 +2031,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "398150.0" + "cum": "398175.0" } } ], @@ -2417,14 +2465,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -2434,14 +2482,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -2450,14 +2498,14 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -2473,7 +2521,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5650.0" + "cum": "5675.0" } }, { @@ -2489,7 +2537,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11900.0" + "cum": "11925.0" } }, { @@ -2505,7 +2553,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386900.0" + "cum": "386925.0" } } ], @@ -2759,14 +2807,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -2775,95 +2823,111 @@ "currency": "USDT", "minNotional": 5000.0, "maxNotional": 25000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 10.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", - "maintMarginRatio": "0.05", - "cum": "125.0" + "maintMarginRatio": "0.025", + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 25000.0, - "maxNotional": 500000.0, - "maintenanceMarginRate": 0.06, - "maxLeverage": 8.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", - "notionalCap": "500000", + "initialLeverage": "10", + "notionalCap": "100000", "notionalFloor": "25000", - "maintMarginRatio": "0.06", - "cum": "375.0" + "maintMarginRatio": "0.05", + "cum": "675.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.06, + "maxLeverage": 8.0, + "info": { + "bracket": "4", + "initialLeverage": "8", + "notionalCap": "500000", + "notionalFloor": "100000", + "maintMarginRatio": "0.06", + "cum": "1675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 500000.0, "maxNotional": 1600000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "1600000", "notionalFloor": "500000", "maintMarginRatio": "0.1", - "cum": "20375.0" + "cum": "21675.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1600000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "60375.0" + "cum": "61675.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 3000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "3000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "310375.0" + "cum": "311675.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 3000000.0, "maxNotional": 4000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "4000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "1060375.0" + "cum": "1061675.0" } } ], @@ -3117,14 +3181,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -3141,7 +3205,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -3157,7 +3221,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -3173,7 +3237,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -3189,7 +3253,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -3205,7 +3269,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -3346,10 +3410,10 @@ "minNotional": 0.0, "maxNotional": 10000.0, "maintenanceMarginRate": 0.03, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.03", @@ -3362,10 +3426,10 @@ "minNotional": 10000.0, "maxNotional": 200000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "200000", "notionalFloor": "10000", "maintMarginRatio": "0.05", @@ -3866,13 +3930,13 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 5000.0, + "maxNotional": 10000.0, "maintenanceMarginRate": 0.006, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", - "notionalCap": "5000", + "initialLeverage": "75", + "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.006", "cum": "0.0" @@ -3881,113 +3945,129 @@ { "tier": 2.0, "currency": "USDT", - "minNotional": 5000.0, + "minNotional": 10000.0, "maxNotional": 50000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "50000", - "notionalFloor": "5000", + "notionalFloor": "10000", "maintMarginRatio": "0.01", - "cum": "20.0" + "cum": "40.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 50000.0, - "maxNotional": 600000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 20.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, "info": { "bracket": "3", - "initialLeverage": "20", - "notionalCap": "600000", + "initialLeverage": "25", + "notionalCap": "200000", "notionalFloor": "50000", - "maintMarginRatio": "0.025", - "cum": "770.0" + "maintMarginRatio": "0.02", + "cum": "540.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 600000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "4", + "initialLeverage": "20", + "notionalCap": "600000", + "notionalFloor": "200000", + "maintMarginRatio": "0.025", + "cum": "1540.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 600000.0, "maxNotional": 1200000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "10", "notionalCap": "1200000", "notionalFloor": "600000", "maintMarginRatio": "0.05", - "cum": "15770.0" + "cum": "16540.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1200000.0, "maxNotional": 3200000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "5", "notionalCap": "3200000", "notionalFloor": "1200000", "maintMarginRatio": "0.1", - "cum": "75770.0" + "cum": "76540.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 3200000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "4", "notionalCap": "5000000", "notionalFloor": "3200000", "maintMarginRatio": "0.125", - "cum": "155770.0" + "cum": "156540.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 5000000.0, "maxNotional": 12000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "2", "notionalCap": "12000000", "notionalFloor": "5000000", "maintMarginRatio": "0.25", - "cum": "780770.0" + "cum": "781540.0" } }, { - "tier": 8.0, + "tier": 9.0, "currency": "USDT", "minNotional": 12000000.0, "maxNotional": 20000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "8", + "bracket": "9", "initialLeverage": "1", "notionalCap": "20000000", "notionalFloor": "12000000", "maintMarginRatio": "0.5", - "cum": "3780770.0" + "cum": "3781540.0" } } ], @@ -4308,10 +4388,10 @@ "minNotional": 0.0, "maxNotional": 5000.0, "maintenanceMarginRate": 0.005, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", + "initialLeverage": "75", "notionalCap": "5000", "notionalFloor": "0", "maintMarginRatio": "0.005", @@ -4324,10 +4404,10 @@ "minNotional": 5000.0, "maxNotional": 10000.0, "maintenanceMarginRate": 0.0065, - "maxLeverage": 40.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "40", + "initialLeverage": "50", "notionalCap": "10000", "notionalFloor": "5000", "maintMarginRatio": "0.0065", @@ -4340,10 +4420,10 @@ "minNotional": 10000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.0075, - "maxLeverage": 30.0, + "maxLeverage": 40.0, "info": { "bracket": "3", - "initialLeverage": "30", + "initialLeverage": "40", "notionalCap": "25000", "notionalFloor": "10000", "maintMarginRatio": "0.0075", @@ -4631,14 +4711,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -4648,14 +4728,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -4664,14 +4744,14 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -4687,7 +4767,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5650.0" + "cum": "5675.0" } }, { @@ -4703,7 +4783,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11900.0" + "cum": "11925.0" } }, { @@ -4719,7 +4799,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386900.0" + "cum": "386925.0" } } ], @@ -4827,14 +4907,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -4844,14 +4924,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -4860,14 +4940,14 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -4883,7 +4963,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5650.0" + "cum": "5675.0" } }, { @@ -4899,7 +4979,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11900.0" + "cum": "11925.0" } }, { @@ -4915,7 +4995,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386900.0" + "cum": "386925.0" } } ], @@ -4925,14 +5005,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -4949,7 +5029,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -4965,7 +5045,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -4981,7 +5061,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -4997,7 +5077,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -5013,7 +5093,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -5293,6 +5373,218 @@ } } ], + "BICO/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 20.0, + "info": { + "bracket": "1", + "initialLeverage": "20", + "notionalCap": "10000", + "notionalFloor": "0", + "maintMarginRatio": "0.03", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 10000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "2", + "initialLeverage": "10", + "notionalCap": "200000", + "notionalFloor": "10000", + "maintMarginRatio": "0.05", + "cum": "200.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "3", + "initialLeverage": "5", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.1", + "cum": "10200.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "4", + "initialLeverage": "4", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.125", + "cum": "22700.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "5", + "initialLeverage": "2", + "notionalCap": "3000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.25", + "cum": "147700.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 3000000.0, + "maxNotional": 3500000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "6", + "initialLeverage": "1", + "notionalCap": "3500000", + "notionalFloor": "3000000", + "maintMarginRatio": "0.5", + "cum": "897700.0" + } + } + ], + "BIGTIME/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 150000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "150000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 150000.0, + "maxNotional": 300000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "300000", + "notionalFloor": "150000", + "maintMarginRatio": "0.1", + "cum": "8175.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 300000.0, + "maxNotional": 750000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "750000", + "notionalFloor": "300000", + "maintMarginRatio": "0.125", + "cum": "15675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 750000.0, + "maxNotional": 1500000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1500000", + "notionalFloor": "750000", + "maintMarginRatio": "0.25", + "cum": "109425.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1500000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "3000000", + "notionalFloor": "1500000", + "maintMarginRatio": "0.5", + "cum": "484425.0" + } + } + ], "BLUEBIRD/USDT:USDT": [ { "tier": 1.0, @@ -5397,14 +5689,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -5413,14 +5705,14 @@ "currency": "USDT", "minNotional": 5000.0, "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, "info": { "bracket": "2", - "initialLeverage": "20", + "initialLeverage": "25", "notionalCap": "25000", "notionalFloor": "5000", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.02", "cum": "25.0" } }, @@ -5428,80 +5720,96 @@ "tier": 3.0, "currency": "USDT", "minNotional": 25000.0, - "maxNotional": 600000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 10.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, "info": { "bracket": "3", - "initialLeverage": "10", - "notionalCap": "600000", + "initialLeverage": "20", + "notionalCap": "100000", "notionalFloor": "25000", - "maintMarginRatio": "0.05", - "cum": "650.0" + "maintMarginRatio": "0.025", + "cum": "150.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 600000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "4", + "initialLeverage": "10", + "notionalCap": "600000", + "notionalFloor": "100000", + "maintMarginRatio": "0.05", + "cum": "2650.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 600000.0, "maxNotional": 1600000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "1600000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "30650.0" + "cum": "32650.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1600000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "70650.0" + "cum": "72650.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 6000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "320650.0" + "cum": "322650.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 6000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1820650.0" + "cum": "1822650.0" } } ], @@ -5510,13 +5818,13 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 5000.0, + "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 8.0, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "8", - "notionalCap": "5000", + "initialLeverage": "20", + "notionalCap": "25000", "notionalFloor": "0", "maintMarginRatio": "0.025", "cum": "0.0" @@ -5525,17 +5833,17 @@ { "tier": 2.0, "currency": "USDT", - "minNotional": 5000.0, + "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 6.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "6", + "initialLeverage": "10", "notionalCap": "100000", - "notionalFloor": "5000", + "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "125.0" + "cum": "625.0" } }, { @@ -5551,7 +5859,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5125.0" + "cum": "5625.0" } }, { @@ -5567,23 +5875,23 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11375.0" + "cum": "11875.0" } }, { "tier": 5.0, "currency": "USDT", "minNotional": 1000000.0, - "maxNotional": 1200000.0, + "maxNotional": 3000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { "bracket": "5", "initialLeverage": "1", - "notionalCap": "1200000", + "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386375.0" + "cum": "386875.0" } } ], @@ -5853,14 +6161,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -5870,14 +6178,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -5893,7 +6201,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -5909,7 +6217,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -5925,7 +6233,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -5941,7 +6249,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -5957,7 +6265,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -6059,6 +6367,234 @@ } } ], + "BOND/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "10000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 10000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "10000", + "maintMarginRatio": "0.05", + "cum": "300.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5300.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10300.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "72800.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "322800.0" + } + } + ], + "BSV/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "73175.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "323175.0" + } + } + ], "BTC/BUSD:BUSD": [ { "tier": 1.0, @@ -6201,7 +6737,7 @@ "notionalCap": "600000000", "notionalFloor": "400000000", "maintMarginRatio": "0.25", - "cum": "4.97038E7" + "cum": "49703800.0" } }, { @@ -6217,7 +6753,7 @@ "notionalCap": "1000000000", "notionalFloor": "600000000", "maintMarginRatio": "0.5", - "cum": "1.997038E8" + "cum": "199703800.0" } } ], @@ -6363,7 +6899,7 @@ "notionalCap": "300000000", "notionalFloor": "200000000", "maintMarginRatio": "0.25", - "cum": "2.80463E7" + "cum": "28046300.0" } }, { @@ -6379,7 +6915,7 @@ "notionalCap": "500000000", "notionalFloor": "300000000", "maintMarginRatio": "0.5", - "cum": "1.030463E8" + "cum": "103046300.0" } } ], @@ -6493,7 +7029,7 @@ "notionalCap": "120000000", "notionalFloor": "40000000", "maintMarginRatio": "0.5", - "cum": "1.246125E7" + "cum": "12461250.0" } } ], @@ -6502,112 +7038,258 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 375000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.01, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "375000", + "initialLeverage": "50", + "notionalCap": "50000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.01", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 375000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, + "info": { + "bracket": "2", + "initialLeverage": "25", + "notionalCap": "375000", + "notionalFloor": "50000", + "maintMarginRatio": "0.02", + "cum": "500.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 375000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "10", "notionalCap": "2000000", "notionalFloor": "375000", "maintMarginRatio": "0.05", - "cum": "11250.0" + "cum": "11750.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 4000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "4000000", "notionalFloor": "2000000", "maintMarginRatio": "0.1", - "cum": "111250.0" + "cum": "111750.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 4000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "10000000", "notionalFloor": "4000000", "maintMarginRatio": "0.125", - "cum": "211250.0" + "cum": "211750.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 10000000.0, "maxNotional": 20000000.0, "maintenanceMarginRate": 0.15, "maxLeverage": 3.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "3", "notionalCap": "20000000", "notionalFloor": "10000000", "maintMarginRatio": "0.15", - "cum": "461250.0" + "cum": "461750.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 20000000.0, "maxNotional": 40000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "40000000", "notionalFloor": "20000000", "maintMarginRatio": "0.25", - "cum": "2461250.0" + "cum": "2461750.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 40000000.0, "maxNotional": 120000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "120000000", "notionalFloor": "40000000", "maintMarginRatio": "0.5", - "cum": "1.246125E7" + "cum": "12461750.0" + } + } + ], + "BTC/USDT:USDT-240329": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.01, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "50000", + "notionalFloor": "0", + "maintMarginRatio": "0.01", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 375000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, + "info": { + "bracket": "2", + "initialLeverage": "25", + "notionalCap": "375000", + "notionalFloor": "50000", + "maintMarginRatio": "0.02", + "cum": "500.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 375000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "2000000", + "notionalFloor": "375000", + "maintMarginRatio": "0.05", + "cum": "11750.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 2000000.0, + "maxNotional": 4000000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "4000000", + "notionalFloor": "2000000", + "maintMarginRatio": "0.1", + "cum": "111750.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 4000000.0, + "maxNotional": 10000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "10000000", + "notionalFloor": "4000000", + "maintMarginRatio": "0.125", + "cum": "211750.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 10000000.0, + "maxNotional": 20000000.0, + "maintenanceMarginRate": 0.15, + "maxLeverage": 3.0, + "info": { + "bracket": "6", + "initialLeverage": "3", + "notionalCap": "20000000", + "notionalFloor": "10000000", + "maintMarginRatio": "0.15", + "cum": "461750.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 20000000.0, + "maxNotional": 40000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "7", + "initialLeverage": "2", + "notionalCap": "40000000", + "notionalFloor": "20000000", + "maintMarginRatio": "0.25", + "cum": "2461750.0" + } + }, + { + "tier": 8.0, + "currency": "USDT", + "minNotional": 40000000.0, + "maxNotional": 120000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "8", + "initialLeverage": "1", + "notionalCap": "120000000", + "notionalFloor": "40000000", + "maintMarginRatio": "0.5", + "cum": "12461750.0" } } ], @@ -7025,14 +7707,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -7049,7 +7731,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -7065,7 +7747,7 @@ "notionalCap": "300000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -7081,7 +7763,7 @@ "notionalCap": "800000", "notionalFloor": "300000", "maintMarginRatio": "0.1", - "cum": "15650.0" + "cum": "15675.0" } }, { @@ -7097,7 +7779,7 @@ "notionalCap": "1000000", "notionalFloor": "800000", "maintMarginRatio": "0.125", - "cum": "35650.0" + "cum": "35675.0" } }, { @@ -7113,7 +7795,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "160650.0" + "cum": "160675.0" } }, { @@ -7129,7 +7811,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "910650.0" + "cum": "910675.0" } } ], @@ -7481,14 +8163,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.012, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.012", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -7505,7 +8187,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "65.0" + "cum": "50.0" } }, { @@ -7521,7 +8203,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "690.0" + "cum": "675.0" } }, { @@ -7537,7 +8219,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5690.0" + "cum": "5675.0" } }, { @@ -7553,7 +8235,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11940.0" + "cum": "11925.0" } }, { @@ -7569,7 +8251,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386940.0" + "cum": "386925.0" } } ], @@ -8933,14 +9615,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -8957,7 +9639,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -8973,7 +9655,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -8989,7 +9671,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -9005,7 +9687,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -9021,7 +9703,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -9912,10 +10594,10 @@ "minNotional": 0.0, "maxNotional": 10000.0, "maintenanceMarginRate": 0.0065, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", + "initialLeverage": "75", "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.0065", @@ -9928,10 +10610,10 @@ "minNotional": 10000.0, "maxNotional": 50000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 40.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "40", + "initialLeverage": "50", "notionalCap": "50000", "notionalFloor": "10000", "maintMarginRatio": "0.01", @@ -10047,7 +10729,7 @@ "notionalCap": "100000000", "notionalFloor": "50000000", "maintMarginRatio": "0.5", - "cum": "1.3733035E7" + "cum": "13733035.0" } } ], @@ -10301,14 +10983,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -10318,14 +11000,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -10341,7 +11023,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -10357,7 +11039,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -10373,7 +11055,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -10389,7 +11071,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -10405,7 +11087,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -11169,7 +11851,7 @@ "notionalCap": "50000000", "notionalFloor": "30000000", "maintMarginRatio": "0.5", - "cum": "1.0062545E7" + "cum": "10062545.0" } } ], @@ -11477,7 +12159,7 @@ "notionalCap": "150000000", "notionalFloor": "80000000", "maintMarginRatio": "0.25", - "cum": "1.014055E7" + "cum": "10140550.0" } }, { @@ -11493,7 +12175,7 @@ "notionalCap": "300000000", "notionalFloor": "150000000", "maintMarginRatio": "0.5", - "cum": "4.764055E7" + "cum": "47640550.0" } } ], @@ -11639,7 +12321,7 @@ "notionalCap": "150000000", "notionalFloor": "100000000", "maintMarginRatio": "0.25", - "cum": "1.5471025E7" + "cum": "15471025.0" } }, { @@ -11655,7 +12337,7 @@ "notionalCap": "300000000", "notionalFloor": "150000000", "maintMarginRatio": "0.5", - "cum": "5.2971025E7" + "cum": "52971025.0" } } ], @@ -11769,7 +12451,7 @@ "notionalCap": "120000000", "notionalFloor": "40000000", "maintMarginRatio": "0.5", - "cum": "1.246125E7" + "cum": "12461250.0" } } ], @@ -11778,112 +12460,258 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 375000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.01, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "375000", + "initialLeverage": "50", + "notionalCap": "50000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.01", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 375000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, + "info": { + "bracket": "2", + "initialLeverage": "25", + "notionalCap": "375000", + "notionalFloor": "50000", + "maintMarginRatio": "0.02", + "cum": "500.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 375000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "10", "notionalCap": "2000000", "notionalFloor": "375000", "maintMarginRatio": "0.05", - "cum": "11250.0" + "cum": "11750.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 4000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "4000000", "notionalFloor": "2000000", "maintMarginRatio": "0.1", - "cum": "111250.0" + "cum": "111750.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 4000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "10000000", "notionalFloor": "4000000", "maintMarginRatio": "0.125", - "cum": "211250.0" + "cum": "211750.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 10000000.0, "maxNotional": 20000000.0, "maintenanceMarginRate": 0.15, "maxLeverage": 3.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "3", "notionalCap": "20000000", "notionalFloor": "10000000", "maintMarginRatio": "0.15", - "cum": "461250.0" + "cum": "461750.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 20000000.0, "maxNotional": 40000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "40000000", "notionalFloor": "20000000", "maintMarginRatio": "0.25", - "cum": "2461250.0" + "cum": "2461750.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 40000000.0, "maxNotional": 120000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "120000000", "notionalFloor": "40000000", "maintMarginRatio": "0.5", - "cum": "1.246125E7" + "cum": "12461750.0" + } + } + ], + "ETH/USDT:USDT-240329": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.01, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "50000", + "notionalFloor": "0", + "maintMarginRatio": "0.01", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 375000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, + "info": { + "bracket": "2", + "initialLeverage": "25", + "notionalCap": "375000", + "notionalFloor": "50000", + "maintMarginRatio": "0.02", + "cum": "500.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 375000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "2000000", + "notionalFloor": "375000", + "maintMarginRatio": "0.05", + "cum": "11750.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 2000000.0, + "maxNotional": 4000000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "4000000", + "notionalFloor": "2000000", + "maintMarginRatio": "0.1", + "cum": "111750.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 4000000.0, + "maxNotional": 10000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "10000000", + "notionalFloor": "4000000", + "maintMarginRatio": "0.125", + "cum": "211750.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 10000000.0, + "maxNotional": 20000000.0, + "maintenanceMarginRate": 0.15, + "maxLeverage": 3.0, + "info": { + "bracket": "6", + "initialLeverage": "3", + "notionalCap": "20000000", + "notionalFloor": "10000000", + "maintMarginRatio": "0.15", + "cum": "461750.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 20000000.0, + "maxNotional": 40000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "7", + "initialLeverage": "2", + "notionalCap": "40000000", + "notionalFloor": "20000000", + "maintMarginRatio": "0.25", + "cum": "2461750.0" + } + }, + { + "tier": 8.0, + "currency": "USDT", + "minNotional": 40000000.0, + "maxNotional": 120000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "8", + "initialLeverage": "1", + "notionalCap": "120000000", + "notionalFloor": "40000000", + "maintMarginRatio": "0.5", + "cum": "12461750.0" } } ], @@ -12106,10 +12934,10 @@ "minNotional": 0.0, "maxNotional": 50000.0, "maintenanceMarginRate": 0.006, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", + "initialLeverage": "75", "notionalCap": "50000", "notionalFloor": "0", "maintMarginRatio": "0.006", @@ -12122,10 +12950,10 @@ "minNotional": 50000.0, "maxNotional": 250000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxLeverage": 40.0, "info": { "bracket": "2", - "initialLeverage": "25", + "initialLeverage": "40", "notionalCap": "250000", "notionalFloor": "50000", "maintMarginRatio": "0.01", @@ -12250,80 +13078,96 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 8.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "8", - "notionalCap": "25000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 25000.0, - "maxNotional": 100000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 6.0, + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "6", - "notionalCap": "100000", - "notionalFloor": "25000", - "maintMarginRatio": "0.05", - "cum": "625.0" + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", "minNotional": 100000.0, "maxNotional": 250000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5625.0" + "cum": "5675.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 2.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "2", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11875.0" + "cum": "11925.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, - "maxNotional": 1500000.0, + "maxNotional": 3000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "1", - "notionalCap": "1500000", + "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386875.0" + "cum": "386925.0" } } ], @@ -12528,96 +13372,112 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 10000.0, - "maintenanceMarginRate": 0.03, - "maxLeverage": 10.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "10", - "notionalCap": "10000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.03", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 10000.0, - "maxNotional": 200000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "8", - "notionalCap": "200000", - "notionalFloor": "10000", - "maintMarginRatio": "0.05", - "cum": "200.0" + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "200000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", "minNotional": 200000.0, "maxNotional": 500000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10200.0" + "cum": "10675.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 500000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "22700.0" + "cum": "23175.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 3000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "2", "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "147700.0" + "cum": "148175.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 3000000.0, "maxNotional": 3500000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "3500000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "897700.0" + "cum": "898175.0" } } ], @@ -13567,6 +14427,120 @@ } } ], + "GAS/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "73175.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "323175.0" + } + } + ], "GLMR/USDT:USDT": [ { "tier": 1.0, @@ -13574,10 +14548,10 @@ "minNotional": 0.0, "maxNotional": 10000.0, "maintenanceMarginRate": 0.03, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.03", @@ -13590,10 +14564,10 @@ "minNotional": 10000.0, "maxNotional": 200000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "200000", "notionalFloor": "10000", "maintMarginRatio": "0.05", @@ -13769,14 +14743,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "50000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -13793,7 +14767,7 @@ "notionalCap": "150000", "notionalFloor": "50000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "500.0" } }, { @@ -13809,7 +14783,7 @@ "notionalCap": "600000", "notionalFloor": "150000", "maintMarginRatio": "0.05", - "cum": "4500.0" + "cum": "4250.0" } }, { @@ -13825,7 +14799,7 @@ "notionalCap": "1600000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "34500.0" + "cum": "34250.0" } }, { @@ -13841,7 +14815,7 @@ "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "74500.0" + "cum": "74250.0" } }, { @@ -13857,23 +14831,23 @@ "notionalCap": "4000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "324500.0" + "cum": "324250.0" } }, { "tier": 7.0, "currency": "USDT", "minNotional": 4000000.0, - "maxNotional": 30000000.0, + "maxNotional": 5000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { "bracket": "7", "initialLeverage": "1", - "notionalCap": "30000000", + "notionalCap": "5000000", "notionalFloor": "4000000", "maintMarginRatio": "0.5", - "cum": "1324500.0" + "cum": "1324250.0" } } ], @@ -13997,14 +14971,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -14012,22 +14986,22 @@ "tier": 2.0, "currency": "USDT", "minNotional": 5000.0, - "maxNotional": 25000.0, + "maxNotional": 50000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { "bracket": "2", "initialLeverage": "20", - "notionalCap": "25000", + "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 25000.0, + "minNotional": 50000.0, "maxNotional": 400000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, @@ -14035,9 +15009,9 @@ "bracket": "3", "initialLeverage": "10", "notionalCap": "400000", - "notionalFloor": "25000", + "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "1300.0" } }, { @@ -14053,7 +15027,7 @@ "notionalCap": "1000000", "notionalFloor": "400000", "maintMarginRatio": "0.1", - "cum": "20700.0" + "cum": "21300.0" } }, { @@ -14069,7 +15043,7 @@ "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.125", - "cum": "45700.0" + "cum": "46300.0" } }, { @@ -14085,7 +15059,7 @@ "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "295700.0" + "cum": "296300.0" } }, { @@ -14101,7 +15075,7 @@ "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1795700.0" + "cum": "1796300.0" } } ], @@ -14209,14 +15183,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -14233,7 +15207,7 @@ "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -14249,7 +15223,7 @@ "notionalCap": "200000", "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "1325.0" + "cum": "1300.0" } }, { @@ -14265,7 +15239,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "11325.0" + "cum": "11300.0" } }, { @@ -14281,7 +15255,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23825.0" + "cum": "23800.0" } }, { @@ -14297,7 +15271,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148825.0" + "cum": "148800.0" } }, { @@ -14313,7 +15287,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898825.0" + "cum": "898800.0" } } ], @@ -14436,96 +15410,112 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "15", - "notionalCap": "25000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 25000.0, "maxNotional": 200000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "10", "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "625.0" + "cum": "675.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 200000.0, "maxNotional": 500000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10625.0" + "cum": "10675.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 500000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23125.0" + "cum": "23175.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 3000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "2", "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148125.0" + "cum": "148175.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 3000000.0, "maxNotional": 3500000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "3500000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898125.0" + "cum": "898175.0" } } ], @@ -15398,96 +16388,112 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 20.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", - "notionalCap": "25000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 25000.0, - "maxNotional": 600000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 10.0, + "minNotional": 5000.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", - "notionalCap": "600000", - "notionalFloor": "25000", - "maintMarginRatio": "0.05", - "cum": "625.0" + "initialLeverage": "20", + "notionalCap": "50000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 600000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "600000", + "notionalFloor": "50000", + "maintMarginRatio": "0.05", + "cum": "1300.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", "minNotional": 600000.0, "maxNotional": 1600000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "1600000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "30625.0" + "cum": "31300.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 1600000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "70625.0" + "cum": "71300.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 4000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "2", "notionalCap": "4000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "320625.0" + "cum": "321300.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 4000000.0, "maxNotional": 4500000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "4500000", "notionalFloor": "4000000", "maintMarginRatio": "0.5", - "cum": "1320625.0" + "cum": "1321300.0" } } ], @@ -15611,14 +16617,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -15635,7 +16641,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -15651,7 +16657,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -15667,7 +16673,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -15683,7 +16689,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -15699,7 +16705,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -15715,7 +16721,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -15725,14 +16731,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -15749,7 +16755,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -15765,7 +16771,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -15781,7 +16787,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -15797,7 +16803,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -15813,7 +16819,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -16475,14 +17481,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -16499,7 +17505,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -16515,7 +17521,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -16531,7 +17537,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -16547,7 +17553,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -16563,7 +17569,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -17577,20 +18583,20 @@ } } ], - "LPT/USDT:USDT": [ + "LOOM/USDT:USDT": [ { "tier": 1.0, "currency": "USDT", "minNotional": 0.0, "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.03", "cum": "0.0" } }, @@ -17598,48 +18604,48 @@ "tier": 2.0, "currency": "USDT", "minNotional": 25000.0, - "maxNotional": 100000.0, + "maxNotional": 200000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "8", - "notionalCap": "100000", + "initialLeverage": "10", + "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "625.0" + "cum": "500.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 100000.0, - "maxNotional": 250000.0, + "minNotional": 200000.0, + "maxNotional": 500000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { "bracket": "3", "initialLeverage": "5", - "notionalCap": "250000", - "notionalFloor": "100000", + "notionalCap": "500000", + "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "5625.0" + "cum": "10500.0" } }, { "tier": 4.0, "currency": "USDT", - "minNotional": 250000.0, + "minNotional": 500000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, - "maxLeverage": 2.0, + "maxLeverage": 4.0, "info": { "bracket": "4", - "initialLeverage": "2", + "initialLeverage": "4", "notionalCap": "1000000", - "notionalFloor": "250000", + "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "11875.0" + "cum": "23000.0" } }, { @@ -17647,15 +18653,129 @@ "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "5", + "initialLeverage": "2", + "notionalCap": "3000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.25", + "cum": "148000.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 3000000.0, + "maxNotional": 3500000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, + "info": { + "bracket": "6", + "initialLeverage": "1", + "notionalCap": "3500000", + "notionalFloor": "3000000", + "maintMarginRatio": "0.5", + "cum": "898000.0" + } + } + ], + "LPT/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 250000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "250000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 250000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 2.0, "info": { "bracket": "5", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "250000", + "maintMarginRatio": "0.125", + "cum": "11925.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "6", "initialLeverage": "1", "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386875.0" + "cum": "386925.0" } } ], @@ -17779,14 +18899,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -17803,7 +18923,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -17819,7 +18939,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -17835,7 +18955,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -17851,7 +18971,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -17867,7 +18987,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -18143,7 +19263,7 @@ "notionalCap": "50000000", "notionalFloor": "30000000", "maintMarginRatio": "0.5", - "cum": "1.0223045E7" + "cum": "10223045.0" } } ], @@ -18738,13 +19858,13 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 5000.0, + "maxNotional": 10000.0, "maintenanceMarginRate": 0.006, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", - "notionalCap": "5000", + "initialLeverage": "75", + "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.006", "cum": "0.0" @@ -18753,17 +19873,17 @@ { "tier": 2.0, "currency": "USDT", - "minNotional": 5000.0, + "minNotional": 10000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.007, - "maxLeverage": 40.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "40", + "initialLeverage": "50", "notionalCap": "25000", - "notionalFloor": "5000", + "notionalFloor": "10000", "maintMarginRatio": "0.007", - "cum": "5.0" + "cum": "10.0" } }, { @@ -18779,7 +19899,7 @@ "notionalCap": "600000", "notionalFloor": "25000", "maintMarginRatio": "0.01", - "cum": "80.0" + "cum": "85.0" } }, { @@ -18795,7 +19915,7 @@ "notionalCap": "900000", "notionalFloor": "600000", "maintMarginRatio": "0.025", - "cum": "9080.0" + "cum": "9085.0" } }, { @@ -18811,7 +19931,7 @@ "notionalCap": "1800000", "notionalFloor": "900000", "maintMarginRatio": "0.05", - "cum": "31580.0" + "cum": "31585.0" } }, { @@ -18827,7 +19947,7 @@ "notionalCap": "4800000", "notionalFloor": "1800000", "maintMarginRatio": "0.1", - "cum": "121580.0" + "cum": "121585.0" } }, { @@ -18843,7 +19963,7 @@ "notionalCap": "6000000", "notionalFloor": "4800000", "maintMarginRatio": "0.125", - "cum": "241580.0" + "cum": "241585.0" } }, { @@ -18859,7 +19979,7 @@ "notionalCap": "18000000", "notionalFloor": "6000000", "maintMarginRatio": "0.25", - "cum": "991580.0" + "cum": "991585.0" } }, { @@ -18875,7 +19995,7 @@ "notionalCap": "30000000", "notionalFloor": "18000000", "maintMarginRatio": "0.5", - "cum": "5491580.0" + "cum": "5491585.0" } } ], @@ -19568,22 +20688,22 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "50000", + "initialLeverage": "50", + "notionalCap": "10000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 50000.0, + "minNotional": 10000.0, "maxNotional": 150000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, @@ -19591,89 +20711,105 @@ "bracket": "2", "initialLeverage": "20", "notionalCap": "150000", - "notionalFloor": "50000", + "notionalFloor": "10000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "100.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 150000.0, - "maxNotional": 600000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 10.0, + "maxNotional": 250000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 15.0, "info": { "bracket": "3", - "initialLeverage": "10", - "notionalCap": "600000", + "initialLeverage": "15", + "notionalCap": "250000", "notionalFloor": "150000", - "maintMarginRatio": "0.05", - "cum": "4500.0" + "maintMarginRatio": "0.03", + "cum": "850.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 250000.0, + "maxNotional": 600000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "4", + "initialLeverage": "10", + "notionalCap": "600000", + "notionalFloor": "250000", + "maintMarginRatio": "0.05", + "cum": "5850.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 600000.0, "maxNotional": 1600000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "1600000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "34500.0" + "cum": "35850.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1600000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "74500.0" + "cum": "75850.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 6000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "324500.0" + "cum": "325850.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 6000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1824500.0" + "cum": "1825850.0" } } ], @@ -20221,14 +21357,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -20236,22 +21372,22 @@ "tier": 2.0, "currency": "USDT", "minNotional": 5000.0, - "maxNotional": 25000.0, + "maxNotional": 50000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { "bracket": "2", "initialLeverage": "20", - "notionalCap": "25000", + "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 25000.0, + "minNotional": 50000.0, "maxNotional": 900000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, @@ -20259,9 +21395,9 @@ "bracket": "3", "initialLeverage": "10", "notionalCap": "900000", - "notionalFloor": "25000", + "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "1300.0" } }, { @@ -20277,7 +21413,7 @@ "notionalCap": "2400000", "notionalFloor": "900000", "maintMarginRatio": "0.1", - "cum": "45650.0" + "cum": "46300.0" } }, { @@ -20293,7 +21429,7 @@ "notionalCap": "3000000", "notionalFloor": "2400000", "maintMarginRatio": "0.125", - "cum": "105650.0" + "cum": "106300.0" } }, { @@ -20309,7 +21445,7 @@ "notionalCap": "9000000", "notionalFloor": "3000000", "maintMarginRatio": "0.25", - "cum": "480650.0" + "cum": "481300.0" } }, { @@ -20325,7 +21461,7 @@ "notionalCap": "15000000", "notionalFloor": "9000000", "maintMarginRatio": "0.5", - "cum": "2730650.0" + "cum": "2731300.0" } } ], @@ -20671,6 +21807,120 @@ } } ], + "ORBS/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "73175.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "323175.0" + } + } + ], "OXT/USDT:USDT": [ { "tier": 1.0, @@ -20905,14 +22155,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -20929,7 +22179,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -20945,7 +22195,7 @@ "notionalCap": "300000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -20961,7 +22211,7 @@ "notionalCap": "800000", "notionalFloor": "300000", "maintMarginRatio": "0.1", - "cum": "15650.0" + "cum": "15675.0" } }, { @@ -20977,7 +22227,7 @@ "notionalCap": "1000000", "notionalFloor": "800000", "maintMarginRatio": "0.125", - "cum": "35650.0" + "cum": "35675.0" } }, { @@ -20993,7 +22243,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "160650.0" + "cum": "160675.0" } }, { @@ -21009,7 +22259,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "910650.0" + "cum": "910675.0" } } ], @@ -21018,96 +22268,112 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 25000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 16.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "16", - "notionalCap": "25000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.025", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 25000.0, "maxNotional": 200000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "10", "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "625.0" + "cum": "675.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 200000.0, "maxNotional": 500000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "5", "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10625.0" + "cum": "10675.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 500000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "4", "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23125.0" + "cum": "23175.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 3000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "2", "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148125.0" + "cum": "148175.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 3000000.0, "maxNotional": 3005000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "3005000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898125.0" + "cum": "898175.0" } } ], @@ -21307,6 +22573,234 @@ } } ], + "POLYX/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "73175.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "323175.0" + } + } + ], + "POWR/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 100000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "200000", + "notionalFloor": "100000", + "maintMarginRatio": "0.1", + "cum": "5675.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.125", + "cum": "10675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.25", + "cum": "73175.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.5", + "cum": "323175.0" + } + } + ], "QNT/USDT:USDT": [ { "tier": 1.0, @@ -21737,14 +23231,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -21752,22 +23246,22 @@ "tier": 2.0, "currency": "USDT", "minNotional": 5000.0, - "maxNotional": 25000.0, + "maxNotional": 50000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", - "notionalCap": "25000", + "initialLeverage": "20", + "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 25000.0, + "minNotional": 50000.0, "maxNotional": 600000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, @@ -21775,9 +23269,9 @@ "bracket": "3", "initialLeverage": "10", "notionalCap": "600000", - "notionalFloor": "25000", + "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "1300.0" } }, { @@ -21793,7 +23287,7 @@ "notionalCap": "1600000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "30650.0" + "cum": "31300.0" } }, { @@ -21809,7 +23303,7 @@ "notionalCap": "2000000", "notionalFloor": "1600000", "maintMarginRatio": "0.125", - "cum": "70650.0" + "cum": "71300.0" } }, { @@ -21825,7 +23319,7 @@ "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "320650.0" + "cum": "321300.0" } }, { @@ -21841,7 +23335,7 @@ "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1820650.0" + "cum": "1821300.0" } } ], @@ -21949,14 +23443,128 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "50000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 600000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "600000", + "notionalFloor": "50000", + "maintMarginRatio": "0.05", + "cum": "1300.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 600000.0, + "maxNotional": 1600000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "1600000", + "notionalFloor": "600000", + "maintMarginRatio": "0.1", + "cum": "31300.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 1600000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "2000000", + "notionalFloor": "1600000", + "maintMarginRatio": "0.125", + "cum": "71300.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 2000000.0, + "maxNotional": 6000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "6000000", + "notionalFloor": "2000000", + "maintMarginRatio": "0.25", + "cum": "321300.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 6000000.0, + "maxNotional": 10000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "10000000", + "notionalFloor": "6000000", + "maintMarginRatio": "0.5", + "cum": "1821300.0" + } + } + ], + "RIF/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -21973,87 +23581,87 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 25000.0, - "maxNotional": 600000.0, + "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { "bracket": "3", "initialLeverage": "10", - "notionalCap": "600000", + "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { "tier": 4.0, "currency": "USDT", - "minNotional": 600000.0, - "maxNotional": 1600000.0, + "minNotional": 100000.0, + "maxNotional": 200000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { "bracket": "4", "initialLeverage": "5", - "notionalCap": "1600000", - "notionalFloor": "600000", + "notionalCap": "200000", + "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "30650.0" + "cum": "5675.0" } }, { "tier": 5.0, "currency": "USDT", - "minNotional": 1600000.0, - "maxNotional": 2000000.0, + "minNotional": 200000.0, + "maxNotional": 500000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { "bracket": "5", "initialLeverage": "4", - "notionalCap": "2000000", - "notionalFloor": "1600000", + "notionalCap": "500000", + "notionalFloor": "200000", "maintMarginRatio": "0.125", - "cum": "70650.0" + "cum": "10675.0" } }, { "tier": 6.0, "currency": "USDT", - "minNotional": 2000000.0, - "maxNotional": 6000000.0, + "minNotional": 500000.0, + "maxNotional": 1000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { "bracket": "6", "initialLeverage": "2", - "notionalCap": "6000000", - "notionalFloor": "2000000", + "notionalCap": "1000000", + "notionalFloor": "500000", "maintMarginRatio": "0.25", - "cum": "320650.0" + "cum": "73175.0" } }, { "tier": 7.0, "currency": "USDT", - "minNotional": 6000000.0, - "maxNotional": 10000000.0, + "minNotional": 1000000.0, + "maxNotional": 2000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { "bracket": "7", "initialLeverage": "1", - "notionalCap": "10000000", - "notionalFloor": "6000000", + "notionalCap": "2000000", + "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "1820650.0" + "cum": "323175.0" } } ], @@ -22503,14 +24111,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -22527,7 +24135,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -22543,7 +24151,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -22559,7 +24167,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -22568,30 +24176,46 @@ "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, - "maxLeverage": 2.0, + "maxLeverage": 4.0, "info": { "bracket": "5", - "initialLeverage": "2", + "initialLeverage": "4", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, + "maxNotional": 2000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "2000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.25", + "cum": "136925.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 2000000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "1", "notionalCap": "5000000", - "notionalFloor": "1000000", + "notionalFloor": "2000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "636925.0" } } ], @@ -22601,14 +24225,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -22625,7 +24249,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -22641,7 +24265,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -22657,7 +24281,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -22673,7 +24297,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -22689,7 +24313,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -23041,14 +24665,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -23058,14 +24682,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -23081,7 +24705,7 @@ "notionalCap": "300000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -23097,7 +24721,7 @@ "notionalCap": "700000", "notionalFloor": "300000", "maintMarginRatio": "0.1", - "cum": "15650.0" + "cum": "15675.0" } }, { @@ -23113,7 +24737,7 @@ "notionalCap": "1200000", "notionalFloor": "700000", "maintMarginRatio": "0.125", - "cum": "33150.0" + "cum": "33175.0" } }, { @@ -23129,7 +24753,7 @@ "notionalCap": "3000000", "notionalFloor": "1200000", "maintMarginRatio": "0.25", - "cum": "183150.0" + "cum": "183175.0" } }, { @@ -23145,7 +24769,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "933150.0" + "cum": "933175.0" } } ], @@ -23351,14 +24975,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -23366,22 +24990,22 @@ "tier": 2.0, "currency": "USDT", "minNotional": 5000.0, - "maxNotional": 25000.0, + "maxNotional": 50000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { "bracket": "2", "initialLeverage": "20", - "notionalCap": "25000", + "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 25000.0, + "minNotional": 50000.0, "maxNotional": 400000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, @@ -23389,9 +25013,9 @@ "bracket": "3", "initialLeverage": "10", "notionalCap": "400000", - "notionalFloor": "25000", + "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "1300.0" } }, { @@ -23407,7 +25031,7 @@ "notionalCap": "1000000", "notionalFloor": "400000", "maintMarginRatio": "0.1", - "cum": "20700.0" + "cum": "21300.0" } }, { @@ -23423,7 +25047,7 @@ "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.125", - "cum": "45700.0" + "cum": "46300.0" } }, { @@ -23439,7 +25063,7 @@ "notionalCap": "6000000", "notionalFloor": "2000000", "maintMarginRatio": "0.25", - "cum": "295700.0" + "cum": "296300.0" } }, { @@ -23455,7 +25079,7 @@ "notionalCap": "10000000", "notionalFloor": "6000000", "maintMarginRatio": "0.5", - "cum": "1795700.0" + "cum": "1796300.0" } } ], @@ -23578,144 +25202,160 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 50.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.0065, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", - "notionalCap": "50000", + "initialLeverage": "75", + "notionalCap": "10000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.0065", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", + "minNotional": 10000.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.01, + "maxLeverage": 50.0, + "info": { + "bracket": "2", + "initialLeverage": "50", + "notionalCap": "50000", + "notionalFloor": "10000", + "maintMarginRatio": "0.01", + "cum": "35.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", "minNotional": 50000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.012, "maxLeverage": 40.0, "info": { - "bracket": "2", + "bracket": "3", "initialLeverage": "40", "notionalCap": "100000", "notionalFloor": "50000", "maintMarginRatio": "0.012", - "cum": "100.0" + "cum": "135.0" } }, { - "tier": 3.0, + "tier": 4.0, "currency": "USDT", "minNotional": 100000.0, "maxNotional": 200000.0, "maintenanceMarginRate": 0.02, "maxLeverage": 25.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "25", "notionalCap": "200000", "notionalFloor": "100000", "maintMarginRatio": "0.02", - "cum": "900.0" + "cum": "935.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 200000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "20", "notionalCap": "1000000", "notionalFloor": "200000", "maintMarginRatio": "0.025", - "cum": "1900.0" + "cum": "1935.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "10", "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.05", - "cum": "26900.0" + "cum": "26935.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 4800000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "5", "notionalCap": "4800000", "notionalFloor": "2000000", "maintMarginRatio": "0.1", - "cum": "126900.0" + "cum": "126935.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 4800000.0, "maxNotional": 6000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "4", "notionalCap": "6000000", "notionalFloor": "4800000", "maintMarginRatio": "0.125", - "cum": "246900.0" + "cum": "246935.0" } }, { - "tier": 8.0, + "tier": 9.0, "currency": "USDT", "minNotional": 6000000.0, "maxNotional": 18000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "8", + "bracket": "9", "initialLeverage": "2", "notionalCap": "18000000", "notionalFloor": "6000000", "maintMarginRatio": "0.25", - "cum": "996900.0" + "cum": "996935.0" } }, { - "tier": 9.0, + "tier": 10.0, "currency": "USDT", "minNotional": 18000000.0, "maxNotional": 30000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "9", + "bracket": "10", "initialLeverage": "1", "notionalCap": "30000000", "notionalFloor": "18000000", "maintMarginRatio": "0.5", - "cum": "5496900.0" + "cum": "5496935.0" } } ], @@ -24134,10 +25774,10 @@ "minNotional": 0.0, "maxNotional": 5000.0, "maintenanceMarginRate": 0.02, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "5000", "notionalFloor": "0", "maintMarginRatio": "0.02", @@ -24150,10 +25790,10 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", @@ -24166,10 +25806,10 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 6.0, + "maxLeverage": 8.0, "info": { "bracket": "3", - "initialLeverage": "6", + "initialLeverage": "8", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", @@ -24212,13 +25852,13 @@ "tier": 6.0, "currency": "USDT", "minNotional": 1000000.0, - "maxNotional": 1500000.0, + "maxNotional": 3000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { "bracket": "6", "initialLeverage": "1", - "notionalCap": "1500000", + "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", "cum": "386900.0" @@ -24339,6 +25979,218 @@ } } ], + "STPT/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 150000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "150000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 150000.0, + "maxNotional": 300000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "300000", + "notionalFloor": "150000", + "maintMarginRatio": "0.1", + "cum": "8175.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 300000.0, + "maxNotional": 750000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "750000", + "notionalFloor": "300000", + "maintMarginRatio": "0.125", + "cum": "15675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 750000.0, + "maxNotional": 1500000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1500000", + "notionalFloor": "750000", + "maintMarginRatio": "0.25", + "cum": "109425.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1500000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "3000000", + "notionalFloor": "1500000", + "maintMarginRatio": "0.5", + "cum": "484425.0" + } + } + ], + "STRAX/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 20.0, + "info": { + "bracket": "1", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "0", + "maintMarginRatio": "0.03", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 200000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "2", + "initialLeverage": "10", + "notionalCap": "200000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "500.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 200000.0, + "maxNotional": 500000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "3", + "initialLeverage": "5", + "notionalCap": "500000", + "notionalFloor": "200000", + "maintMarginRatio": "0.1", + "cum": "10500.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 500000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "4", + "initialLeverage": "4", + "notionalCap": "1000000", + "notionalFloor": "500000", + "maintMarginRatio": "0.125", + "cum": "23000.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 1000000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "5", + "initialLeverage": "2", + "notionalCap": "3000000", + "notionalFloor": "1000000", + "maintMarginRatio": "0.25", + "cum": "148000.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 3000000.0, + "maxNotional": 3500000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "6", + "initialLeverage": "1", + "notionalCap": "3500000", + "notionalFloor": "3000000", + "maintMarginRatio": "0.5", + "cum": "898000.0" + } + } + ], "STX/USDT:USDT": [ { "tier": 1.0, @@ -24915,14 +26767,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "50000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -24939,7 +26791,7 @@ "notionalCap": "250000", "notionalFloor": "50000", "maintMarginRatio": "0.02", - "cum": "500.0" + "cum": "250.0" } }, { @@ -24955,7 +26807,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.05", - "cum": "8000.0" + "cum": "7750.0" } }, { @@ -24971,7 +26823,7 @@ "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.1", - "cum": "58000.0" + "cum": "57750.0" } }, { @@ -24987,7 +26839,7 @@ "notionalCap": "5000000", "notionalFloor": "2000000", "maintMarginRatio": "0.125", - "cum": "108000.0" + "cum": "107750.0" } }, { @@ -25003,7 +26855,7 @@ "notionalCap": "10000000", "notionalFloor": "5000000", "maintMarginRatio": "0.1665", - "cum": "315500.0" + "cum": "315250.0" } }, { @@ -25019,7 +26871,7 @@ "notionalCap": "20000000", "notionalFloor": "10000000", "maintMarginRatio": "0.25", - "cum": "1150500.0" + "cum": "1150250.0" } }, { @@ -25035,7 +26887,7 @@ "notionalCap": "30000000", "notionalFloor": "20000000", "maintMarginRatio": "0.5", - "cum": "6150500.0" + "cum": "6150250.0" } } ], @@ -25257,14 +27109,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -25281,7 +27133,7 @@ "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -25297,7 +27149,7 @@ "notionalCap": "600000", "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "1275.0" + "cum": "1300.0" } }, { @@ -25313,7 +27165,7 @@ "notionalCap": "1280000", "notionalFloor": "600000", "maintMarginRatio": "0.1", - "cum": "31275.0" + "cum": "31300.0" } }, { @@ -25329,7 +27181,7 @@ "notionalCap": "1600000", "notionalFloor": "1280000", "maintMarginRatio": "0.125", - "cum": "63275.0" + "cum": "63300.0" } }, { @@ -25345,7 +27197,7 @@ "notionalCap": "4800000", "notionalFloor": "1600000", "maintMarginRatio": "0.25", - "cum": "263275.0" + "cum": "263300.0" } }, { @@ -25361,7 +27213,7 @@ "notionalCap": "8000000", "notionalFloor": "4800000", "maintMarginRatio": "0.5", - "cum": "1463275.0" + "cum": "1463300.0" } } ], @@ -25370,80 +27222,112 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 25000.0, - "maintenanceMarginRate": 0.03, - "maxLeverage": 10.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "10", - "notionalCap": "25000", + "initialLeverage": "50", + "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.03", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 25000.0, - "maxNotional": 100000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, "info": { "bracket": "2", - "initialLeverage": "8", - "notionalCap": "100000", - "notionalFloor": "25000", - "maintMarginRatio": "0.05", - "cum": "500.0" + "initialLeverage": "25", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.02", + "cum": "25.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 50000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "3", + "initialLeverage": "20", + "notionalCap": "50000", + "notionalFloor": "25000", + "maintMarginRatio": "0.025", + "cum": "150.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 50000.0, + "maxNotional": 100000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "4", + "initialLeverage": "10", + "notionalCap": "100000", + "notionalFloor": "50000", + "maintMarginRatio": "0.05", + "cum": "1400.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 100000.0, "maxNotional": 250000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "3", + "bracket": "5", "initialLeverage": "5", "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5500.0" + "cum": "6400.0" } }, { - "tier": 4.0, + "tier": 6.0, "currency": "USDT", "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 2.0, "info": { - "bracket": "4", + "bracket": "6", "initialLeverage": "2", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11750.0" + "cum": "12650.0" } }, { - "tier": 5.0, + "tier": 7.0, "currency": "USDT", "minNotional": 1000000.0, - "maxNotional": 1200000.0, + "maxNotional": 3000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "5", + "bracket": "7", "initialLeverage": "1", - "notionalCap": "1200000", + "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386750.0" + "cum": "387650.0" } } ], @@ -25682,10 +27566,10 @@ "minNotional": 0.0, "maxNotional": 10000.0, "maintenanceMarginRate": 0.0065, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", + "initialLeverage": "75", "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.0065", @@ -25698,10 +27582,10 @@ "minNotional": 10000.0, "maxNotional": 90000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "90000", "notionalFloor": "10000", "maintMarginRatio": "0.01", @@ -25827,14 +27711,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -25844,14 +27728,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -25867,7 +27751,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -25883,7 +27767,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -25899,7 +27783,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -25915,7 +27799,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -25931,7 +27815,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -25942,10 +27826,10 @@ "minNotional": 0.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "1", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "0", "maintMarginRatio": "0.025", @@ -25958,10 +27842,10 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "2", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", @@ -26004,13 +27888,13 @@ "tier": 5.0, "currency": "USDT", "minNotional": 1000000.0, - "maxNotional": 1200000.0, + "maxNotional": 3000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { "bracket": "5", "initialLeverage": "1", - "notionalCap": "1200000", + "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", "cum": "386875.0" @@ -26120,13 +28004,13 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 5000.0, + "maxNotional": 10000.0, "maintenanceMarginRate": 0.006, - "maxLeverage": 50.0, + "maxLeverage": 75.0, "info": { "bracket": "1", - "initialLeverage": "50", - "notionalCap": "5000", + "initialLeverage": "75", + "notionalCap": "10000", "notionalFloor": "0", "maintMarginRatio": "0.006", "cum": "0.0" @@ -26135,113 +28019,129 @@ { "tier": 2.0, "currency": "USDT", - "minNotional": 5000.0, + "minNotional": 10000.0, "maxNotional": 50000.0, "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxLeverage": 50.0, "info": { "bracket": "2", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "50000", - "notionalFloor": "5000", + "notionalFloor": "10000", "maintMarginRatio": "0.01", - "cum": "20.0" + "cum": "40.0" } }, { "tier": 3.0, "currency": "USDT", "minNotional": 50000.0, - "maxNotional": 900000.0, - "maintenanceMarginRate": 0.025, - "maxLeverage": 20.0, + "maxNotional": 300000.0, + "maintenanceMarginRate": 0.02, + "maxLeverage": 25.0, "info": { "bracket": "3", - "initialLeverage": "20", - "notionalCap": "900000", + "initialLeverage": "25", + "notionalCap": "300000", "notionalFloor": "50000", - "maintMarginRatio": "0.025", - "cum": "770.0" + "maintMarginRatio": "0.02", + "cum": "540.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 300000.0, + "maxNotional": 900000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "4", + "initialLeverage": "20", + "notionalCap": "900000", + "notionalFloor": "300000", + "maintMarginRatio": "0.025", + "cum": "2040.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 900000.0, "maxNotional": 1800000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "10", "notionalCap": "1800000", "notionalFloor": "900000", "maintMarginRatio": "0.05", - "cum": "23270.0" + "cum": "24540.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 1800000.0, "maxNotional": 4800000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "5", "notionalCap": "4800000", "notionalFloor": "1800000", "maintMarginRatio": "0.1", - "cum": "113270.0" + "cum": "114540.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 4800000.0, "maxNotional": 6000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "4", "notionalCap": "6000000", "notionalFloor": "4800000", "maintMarginRatio": "0.125", - "cum": "233270.0" + "cum": "234540.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 6000000.0, "maxNotional": 18000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "2", "notionalCap": "18000000", "notionalFloor": "6000000", "maintMarginRatio": "0.25", - "cum": "983270.0" + "cum": "984540.0" } }, { - "tier": 8.0, + "tier": 9.0, "currency": "USDT", "minNotional": 18000000.0, "maxNotional": 30000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "8", + "bracket": "9", "initialLeverage": "1", "notionalCap": "30000000", "notionalFloor": "18000000", "maintMarginRatio": "0.5", - "cum": "5483270.0" + "cum": "5484540.0" } } ], @@ -26609,14 +28509,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -26633,7 +28533,7 @@ "notionalCap": "50000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -26649,7 +28549,7 @@ "notionalCap": "450000", "notionalFloor": "50000", "maintMarginRatio": "0.05", - "cum": "1275.0" + "cum": "1300.0" } }, { @@ -26665,7 +28565,7 @@ "notionalCap": "1200000", "notionalFloor": "450000", "maintMarginRatio": "0.1", - "cum": "23775.0" + "cum": "23800.0" } }, { @@ -26681,7 +28581,7 @@ "notionalCap": "1500000", "notionalFloor": "1200000", "maintMarginRatio": "0.125", - "cum": "53775.0" + "cum": "53800.0" } }, { @@ -26697,7 +28597,7 @@ "notionalCap": "3000000", "notionalFloor": "1500000", "maintMarginRatio": "0.25", - "cum": "241275.0" + "cum": "241300.0" } }, { @@ -26713,7 +28613,121 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "991275.0" + "cum": "991300.0" + } + } + ], + "WAXP/USDT:USDT": [ + { + "tier": 1.0, + "currency": "USDT", + "minNotional": 0.0, + "maxNotional": 5000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, + "info": { + "bracket": "1", + "initialLeverage": "50", + "notionalCap": "5000", + "notionalFloor": "0", + "maintMarginRatio": "0.015", + "cum": "0.0" + } + }, + { + "tier": 2.0, + "currency": "USDT", + "minNotional": 5000.0, + "maxNotional": 25000.0, + "maintenanceMarginRate": 0.025, + "maxLeverage": 20.0, + "info": { + "bracket": "2", + "initialLeverage": "20", + "notionalCap": "25000", + "notionalFloor": "5000", + "maintMarginRatio": "0.025", + "cum": "50.0" + } + }, + { + "tier": 3.0, + "currency": "USDT", + "minNotional": 25000.0, + "maxNotional": 150000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "3", + "initialLeverage": "10", + "notionalCap": "150000", + "notionalFloor": "25000", + "maintMarginRatio": "0.05", + "cum": "675.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", + "minNotional": 150000.0, + "maxNotional": 300000.0, + "maintenanceMarginRate": 0.1, + "maxLeverage": 5.0, + "info": { + "bracket": "4", + "initialLeverage": "5", + "notionalCap": "300000", + "notionalFloor": "150000", + "maintMarginRatio": "0.1", + "cum": "8175.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", + "minNotional": 300000.0, + "maxNotional": 750000.0, + "maintenanceMarginRate": 0.125, + "maxLeverage": 4.0, + "info": { + "bracket": "5", + "initialLeverage": "4", + "notionalCap": "750000", + "notionalFloor": "300000", + "maintMarginRatio": "0.125", + "cum": "15675.0" + } + }, + { + "tier": 6.0, + "currency": "USDT", + "minNotional": 750000.0, + "maxNotional": 1500000.0, + "maintenanceMarginRate": 0.25, + "maxLeverage": 2.0, + "info": { + "bracket": "6", + "initialLeverage": "2", + "notionalCap": "1500000", + "notionalFloor": "750000", + "maintMarginRatio": "0.25", + "cum": "109425.0" + } + }, + { + "tier": 7.0, + "currency": "USDT", + "minNotional": 1500000.0, + "maxNotional": 3000000.0, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1.0, + "info": { + "bracket": "7", + "initialLeverage": "1", + "notionalCap": "3000000", + "notionalFloor": "1500000", + "maintMarginRatio": "0.5", + "cum": "484425.0" } } ], @@ -26853,14 +28867,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -26877,7 +28891,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -26893,7 +28907,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -26909,7 +28923,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -26925,7 +28939,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -26941,7 +28955,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ], @@ -27064,112 +29078,128 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "50000", + "initialLeverage": "50", + "notionalCap": "10000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 50000.0, - "maxNotional": 250000.0, + "minNotional": 10000.0, + "maxNotional": 150000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { "bracket": "2", "initialLeverage": "20", - "notionalCap": "250000", - "notionalFloor": "50000", + "notionalCap": "150000", + "notionalFloor": "10000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "100.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 150000.0, + "maxNotional": 250000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 15.0, + "info": { + "bracket": "3", + "initialLeverage": "15", + "notionalCap": "250000", + "notionalFloor": "150000", + "maintMarginRatio": "0.03", + "cum": "850.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "10", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.05", - "cum": "7000.0" + "cum": "5850.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.1", - "cum": "57000.0" + "cum": "55850.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "5000000", "notionalFloor": "2000000", "maintMarginRatio": "0.125", - "cum": "107000.0" + "cum": "105850.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 5000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "10000000", "notionalFloor": "5000000", "maintMarginRatio": "0.25", - "cum": "732000.0" + "cum": "730850.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 10000000.0, "maxNotional": 20000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "20000000", "notionalFloor": "10000000", "maintMarginRatio": "0.5", - "cum": "3232000.0" + "cum": "3230850.0" } } ], @@ -27178,112 +29208,128 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", - "notionalCap": "50000", + "initialLeverage": "50", + "notionalCap": "10000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 50000.0, - "maxNotional": 250000.0, + "minNotional": 10000.0, + "maxNotional": 150000.0, "maintenanceMarginRate": 0.025, "maxLeverage": 20.0, "info": { "bracket": "2", "initialLeverage": "20", - "notionalCap": "250000", - "notionalFloor": "50000", + "notionalCap": "150000", + "notionalFloor": "10000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "100.0" } }, { "tier": 3.0, "currency": "USDT", + "minNotional": 150000.0, + "maxNotional": 250000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 15.0, + "info": { + "bracket": "3", + "initialLeverage": "15", + "notionalCap": "250000", + "notionalFloor": "150000", + "maintMarginRatio": "0.03", + "cum": "850.0" + } + }, + { + "tier": 4.0, + "currency": "USDT", "minNotional": 250000.0, "maxNotional": 1000000.0, "maintenanceMarginRate": 0.05, "maxLeverage": 10.0, "info": { - "bracket": "3", + "bracket": "4", "initialLeverage": "10", "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.05", - "cum": "7000.0" + "cum": "5850.0" } }, { - "tier": 4.0, + "tier": 5.0, "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.1", - "cum": "57000.0" + "cum": "55850.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "5000000", "notionalFloor": "2000000", "maintMarginRatio": "0.125", - "cum": "107000.0" + "cum": "105850.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 5000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "10000000", "notionalFloor": "5000000", "maintMarginRatio": "0.25", - "cum": "732000.0" + "cum": "730850.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 10000000.0, "maxNotional": 20000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "20000000", "notionalFloor": "10000000", "maintMarginRatio": "0.5", - "cum": "3232000.0" + "cum": "3230850.0" } } ], @@ -27543,7 +29589,7 @@ "notionalCap": "50000000", "notionalFloor": "30000000", "maintMarginRatio": "0.5", - "cum": "1.0223045E7" + "cum": "10223045.0" } } ], @@ -27552,112 +29598,128 @@ "tier": 1.0, "currency": "USDT", "minNotional": 0.0, - "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 20.0, + "maxNotional": 10000.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", - "notionalCap": "50000", + "initialLeverage": "50", + "notionalCap": "10000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, { "tier": 2.0, "currency": "USDT", - "minNotional": 50000.0, - "maxNotional": 250000.0, + "minNotional": 10000.0, + "maxNotional": 150000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", - "notionalCap": "250000", - "notionalFloor": "50000", + "initialLeverage": "20", + "notionalCap": "150000", + "notionalFloor": "10000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "100.0" } }, { "tier": 3.0, "currency": "USDT", - "minNotional": 250000.0, - "maxNotional": 1000000.0, - "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "minNotional": 150000.0, + "maxNotional": 250000.0, + "maintenanceMarginRate": 0.03, + "maxLeverage": 15.0, "info": { "bracket": "3", - "initialLeverage": "8", - "notionalCap": "1000000", - "notionalFloor": "250000", - "maintMarginRatio": "0.05", - "cum": "7000.0" + "initialLeverage": "15", + "notionalCap": "250000", + "notionalFloor": "150000", + "maintMarginRatio": "0.03", + "cum": "850.0" } }, { "tier": 4.0, "currency": "USDT", + "minNotional": 250000.0, + "maxNotional": 1000000.0, + "maintenanceMarginRate": 0.05, + "maxLeverage": 10.0, + "info": { + "bracket": "4", + "initialLeverage": "10", + "notionalCap": "1000000", + "notionalFloor": "250000", + "maintMarginRatio": "0.05", + "cum": "5850.0" + } + }, + { + "tier": 5.0, + "currency": "USDT", "minNotional": 1000000.0, "maxNotional": 2000000.0, "maintenanceMarginRate": 0.1, "maxLeverage": 5.0, "info": { - "bracket": "4", + "bracket": "5", "initialLeverage": "5", "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.1", - "cum": "57000.0" + "cum": "55850.0" } }, { - "tier": 5.0, + "tier": 6.0, "currency": "USDT", "minNotional": 2000000.0, "maxNotional": 5000000.0, "maintenanceMarginRate": 0.125, "maxLeverage": 4.0, "info": { - "bracket": "5", + "bracket": "6", "initialLeverage": "4", "notionalCap": "5000000", "notionalFloor": "2000000", "maintMarginRatio": "0.125", - "cum": "107000.0" + "cum": "105850.0" } }, { - "tier": 6.0, + "tier": 7.0, "currency": "USDT", "minNotional": 5000000.0, "maxNotional": 10000000.0, "maintenanceMarginRate": 0.25, "maxLeverage": 2.0, "info": { - "bracket": "6", + "bracket": "7", "initialLeverage": "2", "notionalCap": "10000000", "notionalFloor": "5000000", "maintMarginRatio": "0.25", - "cum": "732000.0" + "cum": "730850.0" } }, { - "tier": 7.0, + "tier": 8.0, "currency": "USDT", "minNotional": 10000000.0, "maxNotional": 15000000.0, "maintenanceMarginRate": 0.5, "maxLeverage": 1.0, "info": { - "bracket": "7", + "bracket": "8", "initialLeverage": "1", "notionalCap": "15000000", "notionalFloor": "10000000", "maintMarginRatio": "0.5", - "cum": "3232000.0" + "cum": "3230850.0" } } ], @@ -27993,14 +30055,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -28010,14 +30072,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 15.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "15", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -28033,7 +30095,7 @@ "notionalCap": "200000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -28049,7 +30111,7 @@ "notionalCap": "500000", "notionalFloor": "200000", "maintMarginRatio": "0.1", - "cum": "10650.0" + "cum": "10675.0" } }, { @@ -28065,7 +30127,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "23150.0" + "cum": "23175.0" } }, { @@ -28081,7 +30143,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "148150.0" + "cum": "148175.0" } }, { @@ -28097,7 +30159,7 @@ "notionalCap": "5000000", "notionalFloor": "3000000", "maintMarginRatio": "0.5", - "cum": "898150.0" + "cum": "898175.0" } } ], @@ -28107,14 +30169,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 50000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "50000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -28131,7 +30193,7 @@ "notionalCap": "150000", "notionalFloor": "50000", "maintMarginRatio": "0.025", - "cum": "750.0" + "cum": "500.0" } }, { @@ -28147,7 +30209,7 @@ "notionalCap": "250000", "notionalFloor": "150000", "maintMarginRatio": "0.05", - "cum": "4500.0" + "cum": "4250.0" } }, { @@ -28163,7 +30225,7 @@ "notionalCap": "500000", "notionalFloor": "250000", "maintMarginRatio": "0.1", - "cum": "17000.0" + "cum": "16750.0" } }, { @@ -28179,7 +30241,7 @@ "notionalCap": "1000000", "notionalFloor": "500000", "maintMarginRatio": "0.125", - "cum": "29500.0" + "cum": "29250.0" } }, { @@ -28195,7 +30257,7 @@ "notionalCap": "2000000", "notionalFloor": "1000000", "maintMarginRatio": "0.25", - "cum": "154500.0" + "cum": "154250.0" } }, { @@ -28211,7 +30273,7 @@ "notionalCap": "5000000", "notionalFloor": "2000000", "maintMarginRatio": "0.5", - "cum": "654500.0" + "cum": "654250.0" } } ], @@ -28221,14 +30283,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.02, - "maxLeverage": 20.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "20", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.02", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -28238,14 +30300,14 @@ "minNotional": 5000.0, "maxNotional": 25000.0, "maintenanceMarginRate": 0.025, - "maxLeverage": 10.0, + "maxLeverage": 20.0, "info": { "bracket": "2", - "initialLeverage": "10", + "initialLeverage": "20", "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "25.0" + "cum": "50.0" } }, { @@ -28254,14 +30316,14 @@ "minNotional": 25000.0, "maxNotional": 100000.0, "maintenanceMarginRate": 0.05, - "maxLeverage": 8.0, + "maxLeverage": 10.0, "info": { "bracket": "3", - "initialLeverage": "8", + "initialLeverage": "10", "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "650.0" + "cum": "675.0" } }, { @@ -28277,7 +30339,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5650.0" + "cum": "5675.0" } }, { @@ -28293,7 +30355,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11900.0" + "cum": "11925.0" } }, { @@ -28309,7 +30371,7 @@ "notionalCap": "3000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386900.0" + "cum": "386925.0" } } ], @@ -28433,14 +30495,14 @@ "currency": "USDT", "minNotional": 0.0, "maxNotional": 5000.0, - "maintenanceMarginRate": 0.01, - "maxLeverage": 25.0, + "maintenanceMarginRate": 0.015, + "maxLeverage": 50.0, "info": { "bracket": "1", - "initialLeverage": "25", + "initialLeverage": "50", "notionalCap": "5000", "notionalFloor": "0", - "maintMarginRatio": "0.01", + "maintMarginRatio": "0.015", "cum": "0.0" } }, @@ -28457,7 +30519,7 @@ "notionalCap": "25000", "notionalFloor": "5000", "maintMarginRatio": "0.025", - "cum": "75.0" + "cum": "50.0" } }, { @@ -28473,7 +30535,7 @@ "notionalCap": "100000", "notionalFloor": "25000", "maintMarginRatio": "0.05", - "cum": "700.0" + "cum": "675.0" } }, { @@ -28489,7 +30551,7 @@ "notionalCap": "250000", "notionalFloor": "100000", "maintMarginRatio": "0.1", - "cum": "5700.0" + "cum": "5675.0" } }, { @@ -28505,7 +30567,7 @@ "notionalCap": "1000000", "notionalFloor": "250000", "maintMarginRatio": "0.125", - "cum": "11950.0" + "cum": "11925.0" } }, { @@ -28521,7 +30583,7 @@ "notionalCap": "5000000", "notionalFloor": "1000000", "maintMarginRatio": "0.5", - "cum": "386950.0" + "cum": "386925.0" } } ]