Merge pull request #2914 from freqtrade/hroff-1902-patch-1

Docs: Fix checking of runmode
This commit is contained in:
Matthias 2020-02-13 06:28:50 +01:00 committed by GitHub
commit 3e6209def2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,7 +346,7 @@ if self.dp:
``` python ``` python
if self.dp: if self.dp:
if self.dp.runmode in ('live', 'dry_run'): if self.dp.runmode.value in ('live', 'dry_run'):
ob = self.dp.orderbook(metadata['pair'], 1) ob = self.dp.orderbook(metadata['pair'], 1)
dataframe['best_bid'] = ob['bids'][0][0] dataframe['best_bid'] = ob['bids'][0][0]
dataframe['best_ask'] = ob['asks'][0][0] dataframe['best_ask'] = ob['asks'][0][0]
@ -422,7 +422,7 @@ from freqtrade.persistence import Trade
The following example queries for the current pair and trades from today, however other filters can easily be added. The following example queries for the current pair and trades from today, however other filters can easily be added.
``` python ``` python
if self.config['runmode'] in ('live', 'dry_run'): if self.config['runmode'].value in ('live', 'dry_run'):
trades = Trade.get_trades([Trade.pair == metadata['pair'], trades = Trade.get_trades([Trade.pair == metadata['pair'],
Trade.open_date > datetime.utcnow() - timedelta(days=1), Trade.open_date > datetime.utcnow() - timedelta(days=1),
Trade.is_open == False, Trade.is_open == False,
@ -434,7 +434,7 @@ if self.config['runmode'] in ('live', 'dry_run'):
Get amount of stake_currency currently invested in Trades: Get amount of stake_currency currently invested in Trades:
``` python ``` python
if self.config['runmode'] in ('live', 'dry_run'): if self.config['runmode'].value in ('live', 'dry_run'):
total_stakes = Trade.total_open_trades_stakes() total_stakes = Trade.total_open_trades_stakes()
``` ```
@ -442,7 +442,7 @@ Retrieve performance per pair.
Returns a List of dicts per pair. Returns a List of dicts per pair.
``` python ``` python
if self.config['runmode'] in ('live', 'dry_run'): if self.config['runmode'].value in ('live', 'dry_run'):
performance = Trade.get_overall_performance() performance = Trade.get_overall_performance()
``` ```
@ -487,7 +487,7 @@ from datetime import timedelta, datetime, timezone
# -------- # --------
# Within populate indicators (or populate_buy): # Within populate indicators (or populate_buy):
if self.config['runmode'] in ('live', 'dry_run'): if self.config['runmode'].value in ('live', 'dry_run'):
# fetch closed trades for the last 2 days # fetch closed trades for the last 2 days
trades = Trade.get_trades([Trade.pair == metadata['pair'], trades = Trade.get_trades([Trade.pair == metadata['pair'],
Trade.open_date > datetime.utcnow() - timedelta(days=2), Trade.open_date > datetime.utcnow() - timedelta(days=2),