Commit Graph

1146 Commits

Author SHA1 Message Date
Matthias 9901decf0d Rename get_positions to fetch_positions to align with ccxt naming 2022-02-24 20:05:56 +01:00
Matthias ed65692257 add get_position exchange wrapper 2022-02-24 20:05:56 +01:00
Sam Germain 9f4f65e457 exchange.get_balances minor fix 2022-02-24 20:05:56 +01:00
Sam Germain f336e7fc5b exchange.get_balances futures shorts taken out 2022-02-24 20:05:56 +01:00
Sam Germain f67e0bd6dd wallet amount for futures 2022-02-24 20:05:56 +01:00
Matthias 8952829adc Merge branch 'develop' into feat/short 2022-02-23 06:28:15 +01:00
Matthias 70f4305dfa don't allow short trades in spot mode 2022-02-21 19:19:12 +01:00
Matthias a32aed2225 Update FTX stoploss code to avoid exception for stoploss-market orders
closes #6430, closes #6392
2022-02-19 10:07:32 +01:00
Sam Germain a37287d9ba test__get_params 2022-02-16 10:06:27 -06:00
Sam Germain 124532a4b7 maintenanceMarginRatio -> maintenanceMarginRate 2022-02-16 09:04:43 -06:00
Sam Germain 88a8ff2f4e Merge branch 'feat/short' into leverage-tiers 2022-02-16 08:05:51 -06:00
Matthias de26844578
Merge pull request #6397 from samgermain/todos
edited todo-lev comments
2022-02-16 13:36:17 +01:00
Sam Germain c70050e750 fixed test_load_leverage_tiers 2022-02-16 05:26:52 -06:00
Sam Germain 3bfd9186f7 gateio.get_max_leverage small fix 2022-02-16 04:05:27 -06:00
Sam Germain dbd2df6406 Merge branch 'leverage-tiers' of https://github.com/samgermain/freqtrade into leverage-tiers 2022-02-16 03:50:24 -06:00
Sam Germain c9da6f480f gateio get_max_leverage and get_maintenance_ratio_and_amt temporary solution 2022-02-16 03:36:08 -06:00
Matthias ff5b3c323a Fix okx trading mode 2022-02-16 09:13:49 +01:00
Matthias 7f7c395b10 Add exception handling for lev_prep in okx 2022-02-15 19:30:02 +01:00
Matthias 33cc5e0ac7 Use kwargs for set_leverage 2022-02-15 18:56:58 +01:00
Matthias c37f03a638 Update static-markets to include futures pair 2022-02-15 08:04:16 +01:00
Matthias 1bae18c60a Update decorator locations 2022-02-15 07:11:07 +01:00
Matthias 324fdcedb1 Attempt test fix 2022-02-15 06:59:10 +01:00
Sam Germain ae249a0f97 Merge branch 'leverage-tiers' of https://github.com/samgermain/freqtrade into leverage-tiers 2022-02-14 17:36:47 -06:00
Sam Germain 3753df26fc fixed tests 2022-02-14 17:34:59 -06:00
Sam Germain f4a57b71e7 Filled in test_load_leverage_tiers_okx 2022-02-14 16:53:29 -06:00
Matthias 513669f834 Be verbose on okex startup to point out delay. 2022-02-14 19:44:05 +01:00
Sam Germain 19783e0d39 edited todos 2022-02-14 09:02:55 -06:00
Matthias 2523c12c71 Small enhancements and notes 2022-02-13 14:33:37 +01:00
Matthias ad801e05f7 Filter loadable leverage tiers to stake-currency pairs 2022-02-13 13:05:57 +01:00
Matthias 7f0cedc769 Use "is_future" to check for futures markets 2022-02-13 12:54:49 +01:00
Matthias eaf13f96f7 Use exchange_has to check for ccxt properties 2022-02-13 12:48:28 +01:00
Sam Germain 8fe3f0c933 fix breaking tests 2022-02-12 23:08:42 -06:00
Sam Germain 7a0f7da128 okex loads all leverage tiers at beginning, removed get tiers for pair 2022-02-12 23:02:16 -06:00
Sam Germain 8657e99c26 trimmed down get_maintenance_ratio_and_amt, now requires fetchLeverageTiers 2022-02-12 23:02:16 -06:00
Sam Germain 03b3756e4b strengthened and fixed leverage_tier tests 2022-02-12 23:02:16 -06:00
Sam Germain 4a1ed01708 get_maintenance_ratio_and_amt tests 2022-02-12 23:02:16 -06:00
Sam Germain 60a45ff394 exchange.get_max_leverage de-complex 2022-02-12 23:02:16 -06:00
Sam Germain 41ab20d949 get_max_leverage checks if the number of tiers is < 1 2022-02-12 23:02:15 -06:00
Sam Germain fa2c9fc51f replaced mmr_key with unified maintenanceMarginRate 2022-02-12 23:02:15 -06:00
Sam Germain e987e0e2a9 exchange minor fixes 2022-02-12 23:02:15 -06:00
Sam Germain f3cb7e90e0 moved get_leverage_tiers_for_pair to be with other leverage_tier methods 2022-02-12 23:02:15 -06:00
Sam Germain 5f07546b86 moved leverage_tier caching to get_leverage_tiers_for_pair 2022-02-12 23:02:15 -06:00
Sam Germain eb72e5cc42 Added some exchange leverage tier tests 2022-02-12 23:02:15 -06:00
Sam Germain 18b4d0be95 fixed error with exchange.fill_leverage_tiers 2022-02-12 23:02:14 -06:00
Sam Germain 41d8330fbc freqtrade.exchange edited load_leverage_tiers 2022-02-12 23:02:14 -06:00
Sam Germain 0b717fbace okex.load_leverage_tiers 2022-02-12 23:02:14 -06:00
Sam Germain 42e36f44f8 replaced "leverage" with "tiers" 2022-02-12 23:02:14 -06:00
Sam Germain 6b9915bc73 moved fill_leverage_brackets and get_max_leverage to base exchange class, wrote parse_leverage_tier and load_leverage_brackets 2022-02-12 23:02:14 -06:00
Sam Germain a99cf2eeed redid get_max_leverage 2022-02-12 23:02:07 -06:00
Sam Germain 720a86778e okex.get_max_pair_stake_amount 2022-02-12 23:01:39 -06:00
Sam Germain a5aba4813d moved get_maintenance_ratio_and_amt to base.exchange. Wrote get_leverage_tiers. Added mmr_key to exchange._ft_has 2022-02-12 23:01:30 -06:00
Sam Germain fc2d3649a1 edited todos 2022-02-12 16:23:14 -06:00
Sam Germain 6ae85f9be1 fixed liq-buffer tests 2022-02-11 19:38:59 +01:00
Sam Germain fb3a6e2ce8 added liquidation_buffer to constants.py 2022-02-11 19:38:59 +01:00
Sam Germain 3c3675ea1a moved liquidation_buffer to exchange class, add check for valid liquidation_buffer values 2022-02-11 19:38:59 +01:00
Matthias 0c6d92a7a6 Merge branch 'develop' into feat/short 2022-02-11 17:02:04 +01:00
Sam Germain 553da850ce binance futures stoploss 2022-02-10 09:43:32 -06:00
Matthias 1d10d2c87c Okex -> okx 2022-02-08 19:45:39 +01:00
Matthias 172e018d2d Add probit to list of non-working exchanges
closes #6379
2022-02-08 19:21:27 +01:00
Sam Germain 33b04b1992 deleted outdated todos 2022-02-07 02:47:18 -06:00
Sam Germain 8b57827676 exchange.get_max_pair_stake_amount hard set leverage to 0 2022-02-04 14:26:15 -06:00
Sam Germain dc6cb445fd Merge branch 'feat/short' into max-amount 2022-02-04 04:42:38 -06:00
Sam Germain a50f4d2c57 Exchange.createOrder added * as second param 2022-02-03 20:33:16 -06:00
Sam Germain 8c680d75b9 moved max_stake_amount check for None to exchange.get_max_pair_stake_amount 2022-02-03 20:33:16 -06:00
Sam Germain 55d91f018f exchange._get_stake_amount_limit (merged min_pair_stake_amount and get_max_tradeable amount) 2022-02-03 20:33:04 -06:00
Sam Germain ff5fffefb4 exchange.get_max_amount_tradable looks at cost also 2022-02-03 20:33:03 -06:00
Sam Germain 6e8420914e removed unnecessary CCXT checks in exchange.get_min_pair_stake_amount 2022-02-03 20:33:03 -06:00
Sam Germain 64ad810445 Revert "moved get_max_leverage to get_min_pair_stake_amount"
This reverts commit 90e48d5b98bcfb1452aa818a3274745eac395712.
2022-02-03 20:33:03 -06:00
Sam Germain 73319a74d3 moved get_max_leverage to get_min_pair_stake_amount 2022-02-03 20:33:03 -06:00
Sam Germain f3b42b0ef3 wrote exchange.get_max_amount_tradable 2022-02-03 20:33:03 -06:00
Sam Germain f58b92bb86 exchange.create_order removed default for leverage 2022-02-03 17:48:08 -06:00
Sam Germain 179947fa72
New config (#6333)
* updated new-config to add trading_mode and margin_mode

* added trading_mode and margin_mode to config examples

* added okex config example

* new file:   config_examples/config_binance_futures.example.json

* removed trading_mode and margin_mode from base_config and binance and okex example

* deleted okex and futures config files

* updated full config file

* updated new-config command to add trading_mode and margin_mode to config

* new file:   config_examples/config_okex_futures.example.json

* removed config_okex_futures.example.json

* added trading_mode to test_start_new_config

* new-config asks exchange before asking futures

* Simplify trading_mode selection

* margin_mode is empty string for spot new configs

* build_config_commands sorted exchanges

* isort

Co-authored-by: Matthias <xmatthias@outlook.com>
2022-02-02 14:46:44 +01:00
Sam Germain a741356d65 okex._lev_prep, removing rounding from default set_leverage 2022-02-02 00:28:57 -06:00
Sam Germain 8e51360f75 exchange._set_leverage rounds leverage 2022-02-02 00:09:58 -06:00
Sam Germain 8a64f6a27f exchange.set_margin_mode param swap 2022-02-02 00:09:53 -06:00
Sam Germain 386be2d889 set reduceOnly for futures exit orders 2022-02-02 00:08:50 -06:00
Sam Germain b3477c4802 _api.fetch_funding_history argument pair->symbol 2022-02-02 00:08:50 -06:00
Sam Germain 30519aa3be Changed name Collateral -> MarginMode, collateral -> margin_mode, and _supported_trading_mode_margin_pairs -> _supported_trading_margin_pairs 2022-02-01 13:05:40 -06:00
Matthias 7dd50f78cf Small finetuning improving a comment 2022-02-01 06:37:13 +01:00
Sam Germain fc15e14707 Merge branch 'feat/short' into isolated-liq 2022-01-31 14:22:01 -06:00
Sam Germain ed320bb2ac exchange.get_liquidation_price check length of positions 2022-01-31 14:01:06 -06:00
Sam Germain 9de63412c1 exchange.get_liquidation_price arguments are not optional 2022-01-31 14:00:52 -06:00
Sam Germain 8190b0d83b binance.get_max_leverage adjustment 2022-01-31 12:49:18 -06:00
Sam Germain a368f8b322 exchange.get_max_leverage changed variable names, made more effecient 2022-01-31 12:21:12 -06:00
Sam Germain 08e4a4a6dd binance.get_max_leverage_fix 2022-01-31 12:21:12 -06:00
Sam Germain 43db4c34d1 added okex back to unsupported exchanges 2022-01-31 12:18:30 -06:00
Sam Germain 2c1497b348 contracts_to_amount no longer in amount_to_precision 2022-01-31 12:18:30 -06:00
Sam Germain b8f4cebce7 exchange.liquidation_price methods combined, dry_run check on exchange for liquidation price 2022-01-31 12:18:25 -06:00
Sam Germain 143c37d36f cleaned up liquidation price methods 2022-01-31 12:17:07 -06:00
Sam Germain ede9012fcc removed TODO-levs about okex liquidation price 2022-01-31 12:17:07 -06:00
Sam Germain d133a7c789 added isolated, futures to okex trading_mode_collateral_pairs 2022-01-31 12:17:07 -06:00
Sam Germain 88ce66650c Okex and Gateio liquidation_price formula are the same, moved liquidation_price to exchange.exchange class 2022-01-31 12:17:07 -06:00
Sam Germain 7f4894d68e okex.liquidation_price formula update 2022-01-31 12:17:07 -06:00
Sam Germain fe037aa971 exchange.liquidation_price combined position and position_assets 2022-01-31 12:17:07 -06:00
Sam Germain 0b5c2e97b3 exchange._get_maintenance_ratio_and_amount 2022-01-31 12:17:07 -06:00
Sam Germain 0c13e387fe moved liquidation_price method to exchange classes 2022-01-31 12:16:43 -06:00
Sam Germain 5a97760bd1 binance.get_max_leverage divide by 0 warning 2022-01-31 12:16:43 -06:00
Sam Germain 1f8111d1c6 exchange.get_max_leverage pair is required 2022-01-31 12:16:43 -06:00
Sam Germain caff7e227f binance.fill_leverage_brackets remove excess bracket 2022-01-31 12:16:43 -06:00
Sam Germain 1f1ac8ce9d test_get_liquidation_price/test_get_maintenance_ratio_and_amt_binance/fill_leverage_brackets/test_validate_trading_mode_and_collateral TODO comments 2022-01-31 12:16:43 -06:00
Sam Germain c2f9201512 Added get_liquidation_price check 2022-01-31 12:16:43 -06:00
Sam Germain bb2b2211d0 exchange.fill_leverage_brackets/get_maintenance_ratio_and_amt docstring and type specification 2022-01-31 12:16:43 -06:00
Sam Germain b4a0611afc exchange.get_liquidation_price removed irrelevant comment 2022-01-31 12:16:43 -06:00
Sam Germain 0c8205ab3b replace single quote docstrings with double quote docstrings 2022-01-31 12:16:43 -06:00
Sam Germain 2d545a2def fixed breaking tests for liquidation price 2022-01-31 12:15:54 -06:00
Sam Germain 1eee5373b9 gateio.get_maintenance_ratio_and_amt 2022-01-31 12:15:54 -06:00
Sam Germain bff53c52af rewrite fill_leverage_brackets 2022-01-31 12:15:54 -06:00
Sam Germain 69a6223ca0 implemented binance.get_maintenance_ratio_and_amt 2022-01-31 12:15:54 -06:00
Sam Germain ba5fc21d84 added isolated futures to supported modes for binance,gateio 2022-01-31 12:15:54 -06:00
Sam Germain e0df7ee72a Changed variable names in binance.get_max_leverage 2022-01-31 12:15:54 -06:00
Sam Germain ba02605d77 Isolated liq branch passes all tests and has the general structure that it is supposed to, but is patchy, and doesnt get the correct maintenance amt and maintenance margin rate yet 2022-01-31 12:15:54 -06:00
Sam Germain eee7271ab8 Added live isolated-liq get 2022-01-31 12:15:54 -06:00
Sam Germain 29c5dfd4ca Removed unnecessary CCXT market checks 2022-01-31 02:40:10 -06:00
Matthias 463714832d Merge branch 'develop' into feat/short 2022-01-29 14:19:30 +01:00
Matthias fdea4fcb1b Remove some todo's 2022-01-28 15:52:12 +01:00
Matthias 138e867a68 Filter tickers on stake-currency for kraken 2022-01-28 07:20:47 +01:00
Matthias 108018b30b
Merge pull request #6231 from freqtrade/funding_rate_backtest
Funding rate backtest
2022-01-27 17:01:28 +01:00
Matthias f7be93aaa6 leverage limits can be None, so we need to check for that 2022-01-25 06:30:03 +01:00
Matthias ad28543d4d Update kraken calculation 2022-01-22 19:46:11 +01:00
Matthias a0c0c4dcbe Update funding_fee formula to correctly calculate fees for long trades 2022-01-22 19:46:10 +01:00
Matthias 82c90c0049 Extract funding and mark mergin to separate method 2022-01-22 19:45:46 +01:00
Matthias 84c6d92d4c calculate_funding_fees is actually a public exchange interface (used in backtesting). 2022-01-22 19:45:46 +01:00
Matthias c6c97efed3 Remove unused method `_get_funding_fee` 2022-01-22 19:44:20 +01:00
Matthias ef3a1ea8f2 Split funding fee calculation from Download 2022-01-22 19:44:20 +01:00
Matthias f090dcc597 Merge branch 'develop' into feat/short 2022-01-22 17:56:01 +01:00
Matthias 56daafd6b7 Use realistic date for dry-run orders 2022-01-22 16:31:59 +01:00
Matthias 6684bff963 Dry-run orders should have filled set correctly 2022-01-15 15:25:16 +01:00
Matthias 46809f08fe Merge branch 'develop' into feat/short 2022-01-07 10:13:16 +01:00
Matthias b77943af0d
Merge pull request #6173 from freqtrade/volume_quote_workaround
Selectively convert quote to base volume in volumepairlist
2022-01-07 09:07:16 +01:00
Matthias 24ec78b11c Quote-volumelist fix for gateio 2022-01-06 19:07:47 +01:00
Matthias 326e3d1f8e Selectively convert quote to base volume in volumepairlist 2022-01-06 19:07:43 +01:00
Matthias 173524ea5b
Merge pull request #6170 from freqtrade/contract_workaround
contractSize is a string coming from ccxt
2022-01-06 16:25:19 +01:00
Carlo Revelli 7451b60501
increase okex candle limit 2022-01-06 05:31:23 -08:00
Matthias 431fcdd76f contractSize is a string comming from ccxt 2022-01-06 13:53:27 +01:00
Matthias 72b2d4ab5f Update FTX to support new standardized futures format 2022-01-06 11:16:26 +01:00
Matthias 33d95d245e Fix unbounderror
closes #6169
2022-01-06 08:48:30 +01:00
Sam Germain b2a1124a26 Merge branch 'feat/short' of https://github.com/freqtrade/freqtrade into feat/short 2022-01-04 00:17:42 -06:00
Matthias e57c2d64a5
Merge pull request #5888 from samgermain/contract-sizes
Convert contract size to underlying asset size
2022-01-03 21:55:19 +01:00
Matthias d8cb61278f Simplify contract conversion code
by reusing "get_contract_size"
2022-01-03 18:12:45 +01:00
Sam Germain 707a6507b5 removed redundant todos 2022-01-02 21:46:06 -06:00
Matthias 7f88f9bf27 Revert unintended double-call of amount conversion 2022-01-02 13:11:29 +01:00
Sam Germain 33ab3c1bea Removed some todo-lev comments 2022-01-01 14:10:24 -06:00
Sam Germain 14ae327459 grouped contract methods 2022-01-01 14:08:10 -06:00
Sam Germain 3e4912979a exchange.py: removed get funding rate history 2022-01-01 14:03:26 -06:00
Sam Germain fcded264e6 removed exchange._get_mark_price_history 2022-01-01 13:53:26 -06:00
Sam Germain f92d47a16b exchange._contracts_to_amount and exchange._amount_to_contracts safe checks 2022-01-01 13:52:06 -06:00
Matthias 8da596f66d Implement PR feedback 2022-01-01 13:52:01 -06:00
Sam Germain 49a6ebb454 exchange class contract methods safe check for symbol 2022-01-01 13:50:50 -06:00
Sam Germain 78d1a267f0 contract-sizes tests 2022-01-01 13:50:50 -06:00
Sam Germain d0a300a2e1 Added TODOs 2022-01-01 13:50:49 -06:00