From b5d2cfecc76ab184faf540836ed61876726766fe Mon Sep 17 00:00:00 2001 From: Stephen Dade Date: Thu, 4 Jan 2018 10:35:57 +1100 Subject: [PATCH] Unfilled Order timeout - better documentation and variable naming --- config.json.example | 2 +- docs/configuration.md | 2 +- freqtrade/main.py | 4 ++-- freqtrade/misc.py | 2 +- freqtrade/tests/conftest.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config.json.example b/config.json.example index 3678ccd8c..c68e854e2 100644 --- a/config.json.example +++ b/config.json.example @@ -11,7 +11,7 @@ "0": 0.04 }, "stoploss": -0.10, - "opentradetimeout": 600, + "unfilledtimeout": 600, "bid_strategy": { "ask_last_balance": 0.0 }, diff --git a/docs/configuration.md b/docs/configuration.md index 6dcb34da7..384775765 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -21,7 +21,7 @@ The table below will list all configuration parameters. | `dry_run` | true | Yes | Define if the bot must be in Dry-run or production mode. | `minimal_roi` | See below | Yes | Set the threshold in percent the bot will use to sell a trade. More information below. | `stoploss` | -0.10 | No | Value of the stoploss in percent used by the bot. More information below. -| `opentradetimeout` | 0 | No | The number of minutes until an open trade will be cancelled. +| `unfilledtimeout` | 0 | No | How long (in minutes) the bot will wait for an unfilled order to complete, after which the order will be cancelled. | `bid_strategy.ask_last_balance` | 0.0 | Yes | Set the bidding price. More information below. | `exchange.name` | bittrex | Yes | Name of the exchange class to use. | `exchange.key` | key | No | API key to use for the exchange. Only required when you are in production mode. diff --git a/freqtrade/main.py b/freqtrade/main.py index cd19af008..ca77f1c93 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -98,7 +98,7 @@ def _process(nb_assets: Optional[int] = 0) -> bool: # Check if we can sell our current pair state_changed = handle_trade(trade) or state_changed - if 'opentradetimeout' in _CONF and trade.open_order_id: + if 'unfilledtimeout' in _CONF and trade.open_order_id: # Check and handle any timed out trades check_handle_timedout(trade) @@ -125,7 +125,7 @@ def check_handle_timedout(trade: Trade) -> bool: :param trade: Trade instance :return: True if the trade is timed out, false otherwise """ - timeoutthreashold = datetime.utcnow() - timedelta(minutes=_CONF['opentradetimeout']) + timeoutthreashold = datetime.utcnow() - timedelta(minutes=_CONF['unfilledtimeout']) order = exchange.get_order(trade.open_order_id) if trade.open_date < timeoutthreashold: diff --git a/freqtrade/misc.py b/freqtrade/misc.py index c8f1dcbcd..9f414a72f 100644 --- a/freqtrade/misc.py +++ b/freqtrade/misc.py @@ -218,7 +218,7 @@ CONF_SCHEMA = { 'minProperties': 1 }, 'stoploss': {'type': 'number', 'maximum': 0, 'exclusiveMaximum': True}, - 'opentradetimeout': {'type': 'integer', 'minimum': 0}, + 'unfilledtimeout': {'type': 'integer', 'minimum': 0}, 'bid_strategy': { 'type': 'object', 'properties': { diff --git a/freqtrade/tests/conftest.py b/freqtrade/tests/conftest.py index 857f46f33..0420b5074 100644 --- a/freqtrade/tests/conftest.py +++ b/freqtrade/tests/conftest.py @@ -25,7 +25,7 @@ def default_conf(): "0": 0.04 }, "stoploss": -0.10, - "opentradetimeout": 600, + "unfilledtimeout": 600, "bid_strategy": { "ask_last_balance": 0.0 },