Repository: freqtrade/freqtrade

Issue:
Unable to use plot_dataframe.py
## Step 1: Have you search for this issue before posting it?
Yes, i am facing similar issue as #1978 
and i am unable to figure out how to get it to work (i am new to freqtrade, any help would be valuable) 

## Step 2: Describe your environment

  * Python Version: 3.6.8
  * CCXT version: 1.18.860
  * Branch: Develop
  * Last Commit ID: bcf2bc6f8cad062020219c6fe3928ccd0fce297c
  * os: ubuntu 16.04
  
## Step 3: Describe the problem:
Unable to plot after backtesting

**Explain the problem you have encountered**

i am unable to obtain graphs after running a backtest

### Steps to reproduce:

  1. python ./freqtrade/main.py -c config.json -s BBRSI backtesting --refresh-pair
  2. python ./scripts/plot_dataframe.py -s BBRSI -p ETH/BTC


  
### Observed Results:

  * What happened?
   i keep running into KeyError, whenever i try to display graphs 
  
* What did you expect to happen?
 i was expecting a plotted graph of performance  

### Relevant code exceptions or logs:

  ```
>>python scripts/plot_dataframe.py -s BBRSI -p ETH/BTC 
2019-07-08 21:27:52,077 - freqtrade.configuration - INFO - Verbosity set to 0
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Dry run is enabled
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using DB: "sqlite://"
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Checking exchange...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using max_open_trades: 15 ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using data directory: user_data/data/binance ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Storing backtest results to user_data/backtest_data/backtest-result.json ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using pairs ETH/BTC
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using indicators1: sma,ema3,ema5
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using indicators2: macd,macdsignal
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Limiting plot to: 750
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using trades from: file
2019-07-08 21:27:52,079 - freqtrade.resolvers.strategy_resolver - INFO - Using resolved strategy BBRSI from '/home/zero/freq/freqtrade/freqtrade/strategy'
2019-07-08 21:27:52,079 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ticker_interval' with value in config file: 1h.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'trailing_stop' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: BTC.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 0.01.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ticker_interval: 1h
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.99
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.0
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'limit', 'sell': 'limit', 'stoploss': 'limit', 'stoploss_on_exchange': False}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: BTC
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 0.01
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
Traceback (most recent call last):
  File "scripts/plot_dataframe.py", line 113, in <module>
    main(sys.argv[1:])
  File "scripts/plot_dataframe.py", line 107, in main
    plot_parse_args(sysargv)
  File "scripts/plot_dataframe.py", line 57, in analyse_and_plot_pairs
    plot_elements = init_plotscript(config)
  File "/home/zero/freq/freqtrade/freqtrade/plot/plotting.py", line 45, in init_plotscript
    timerange = Arguments.parse_timerange(config["timerange"])
KeyError: 'timerange'
  ```

Unable to use plot_dataframe.py
## Step 1: Have you search for this issue before posting it?
Yes, i am facing similar issue as #1978 
and i am unable to figure out how to get it to work (i am new to freqtrade, any help would be valuable) 

## Step 2: Describe your environment

  * Python Version: 3.6.8
  * CCXT version: 1.18.860
  * Branch: Develop
  * Last Commit ID: bcf2bc6f8cad062020219c6fe3928ccd0fce297c
  * os: ubuntu 16.04
  
## Step 3: Describe the problem:
Unable to plot after backtesting

**Explain the problem you have encountered**

i am unable to obtain graphs after running a backtest

### Steps to reproduce:

  1. python ./freqtrade/main.py -c config.json -s BBRSI backtesting --refresh-pair
  2. python ./scripts/plot_dataframe.py -s BBRSI -p ETH/BTC


  
### Observed Results:

  * What happened?
   i keep running into KeyError, whenever i try to display graphs 
  
* What did you expect to happen?
 i was expecting a plotted graph of performance  

### Relevant code exceptions or logs:

  ```
>>python scripts/plot_dataframe.py -s BBRSI -p ETH/BTC 
2019-07-08 21:27:52,077 - freqtrade.configuration - INFO - Verbosity set to 0
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Dry run is enabled
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using DB: "sqlite://"
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Checking exchange...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using max_open_trades: 15 ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using data directory: user_data/data/binance ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Storing backtest results to user_data/backtest_data/backtest-result.json ...
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using pairs ETH/BTC
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using indicators1: sma,ema3,ema5
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using indicators2: macd,macdsignal
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Limiting plot to: 750
2019-07-08 21:27:52,078 - freqtrade.configuration - INFO - Using trades from: file
2019-07-08 21:27:52,079 - freqtrade.resolvers.strategy_resolver - INFO - Using resolved strategy BBRSI from '/home/zero/freq/freqtrade/freqtrade/strategy'
2019-07-08 21:27:52,079 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ticker_interval' with value in config file: 1h.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'trailing_stop' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: BTC.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 0.01.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ticker_interval: 1h
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.99
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.0
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'limit', 'sell': 'limit', 'stoploss': 'limit', 'stoploss_on_exchange': False}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: BTC
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 0.01
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
2019-07-08 21:27:52,080 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
Traceback (most recent call last):
  File "scripts/plot_dataframe.py", line 113, in <module>
    main(sys.argv[1:])
  File "scripts/plot_dataframe.py", line 107, in main
    plot_parse_args(sysargv)
  File "scripts/plot_dataframe.py", line 57, in analyse_and_plot_pairs
    plot_elements = init_plotscript(config)
  File "/home/zero/freq/freqtrade/freqtrade/plot/plotting.py", line 45, in init_plotscript
    timerange = Arguments.parse_timerange(config["timerange"])
KeyError: 'timerange'
  ```



Discussion:

Resolving patch:
diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py
--- a/freqtrade/plot/plotting.py
+++ b/freqtrade/plot/plotting.py
@@ -42,7 +42,7 @@ def init_plotscript(config):
         pairs = config["exchange"]["pair_whitelist"]
 
     # Set timerange to use
-    timerange = Arguments.parse_timerange(config["timerange"])
+    timerange = Arguments.parse_timerange(config.get("timerange"))
 
     tickers = history.load_data(
         datadir=Path(str(config.get("datadir"))),


Test patch: