We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Hyperoptable parameter type: CategoricalParameter is not returning correctly.
## Describe your environment

  * Operating system: MacOS 11.2.3 (20D91)
  * Python Version: using the version shiped freqtradeorg/freqtrade:stable (Image ID 73a48178c043)
  * CCXT version: using the version shiped freqtradeorg/freqtrade:stable (Image ID 73a48178c043)
  * Freqtrade Version: freqtrade 2021.4
  
Note: All issues other than enhancement requests will be closed without further comment if the above template is deleted or not filled out.

## Describe the problem:

Hi! It appears the Hyperoptable parameter type: `CategoricalParameter` is not returning correctly.

If I run the example as per the Freqtrade Docs [here](https://www.freqtrade.io/en/stable/hyperopt/#hyperoptable-parameters), namely setting a  `CategoricalParameter` like so:

```
buy_rsi_enabled = CategoricalParameter([True, False]),
```

...then when running the Hyperopt tool there is an error in the `populate_buy_trend` as below:

```
if self.buy_adx_enabled.value:
AttributeError: 'tuple' object has no attribute 'value'
```

It would appear that the `CategoricalParameter` is not actually returning one of the categories (even a default) but instead returning a Python Tuple.

### Steps to reproduce:

  1. Follow the example in the [Docs](https://www.freqtrade.io/en/stable/hyperopt/#hyperoptable-parameters)
  
### Observed Results:

  * What happened? There was an AttributeError: 'tuple' object has no attribute 'value'. 
  * What did you expect to happen? The 'value' property to exist and be set to either True or False

### Relevant code exceptions or logs

Note: Please copy/paste text of the messages, no screenshots of logs please.

  ```
2021-05-02 09:48:02,421 - freqtrade - ERROR - Fatal exception!
joblib.externals.loky.process_executor._RemoteTraceback:
"""
Traceback (most recent call last):
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
    r = call_item()
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 262, in __call__
    return [func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py", line 262, in <listcomp>
    return [func(*args, **kwargs)
  File "/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/cloudpickle_wrapper.py", line 38, in __call__
    return self._obj(*args, **kwargs)
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 288, in generate_optimizer
    backtesting_results = self.backtesting.backtest(
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 352, in backtest
    data: Dict = self._get_ohlcv_as_lists(processed)
  File "/freqtrade/freqtrade/optimize/backtesting.py", line 196, in _get_ohlcv_as_lists
    self.strategy.advise_buy(pair_data, {'pair': pair}), {'pair': pair})[headers].copy()
  File "/freqtrade/freqtrade/optimize/hyperopt_auto.py", line 31, in populate_buy_trend
    return self.strategy.populate_buy_trend(dataframe, metadata)
  File "/freqtrade/user_data/strategies/Strategy004.py", line 149, in populate_buy_trend
    if self.buy_adx_enabled.value:
AttributeError: 'tuple' object has no attribute 'value'
  ```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `freqtrade/__init__.py`
Content:
```
1 """ Freqtrade bot """
2 __version__ = 'develop'
3 
4 if __version__ == 'develop':
5 
6     try:
7         import subprocess
8 
9         __version__ = 'develop-' + subprocess.check_output(
10             ['git', 'log', '--format="%h"', '-n 1'],
11             stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
12 
13         # from datetime import datetime
14         # last_release = subprocess.check_output(
15         #     ['git', 'tag']
16         # ).decode('utf-8').split()[-1].split(".")
17         # # Releases are in the format "2020.1" - we increment the latest version for dev.
18         # prefix = f"{last_release[0]}.{int(last_release[1]) + 1}"
19         # dev_version = int(datetime.now().timestamp() // 1000)
20         # __version__ = f"{prefix}.dev{dev_version}"
21 
22         #  subprocess.check_output(
23         #     ['git', 'log', '--format="%h"', '-n 1'],
24         #     stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
25     except Exception:
26         # git not available, ignore
27         try:
28             # Try Fallback to freqtrade_commit file (created by CI while building docker image)
29             from pathlib import Path
30             versionfile = Path('./freqtrade_commit')
31             if versionfile.is_file():
32                 __version__ = f"docker-{versionfile.read_text()[:8]}"
33         except Exception:
34             pass
35
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py
--- a/freqtrade/__init__.py
+++ b/freqtrade/__init__.py
@@ -1,5 +1,5 @@
 """ Freqtrade bot """
-__version__ = 'develop'
+__version__ = '2021.8'
 
 if __version__ == 'develop':

{"golden_diff": "diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py\n--- a/freqtrade/__init__.py\n+++ b/freqtrade/__init__.py\n@@ -1,5 +1,5 @@\n \"\"\" Freqtrade bot \"\"\"\n-__version__ = 'develop'\n+__version__ = '2021.8'\n \n if __version__ == 'develop':\n", "issue": "Hyperoptable parameter type: CategoricalParameter is not returning correctly.\n## Describe your environment\r\n\r\n  * Operating system: MacOS 11.2.3 (20D91)\r\n  * Python Version: using the version shiped freqtradeorg/freqtrade:stable (Image ID 73a48178c043)\r\n  * CCXT version: using the version shiped freqtradeorg/freqtrade:stable (Image ID 73a48178c043)\r\n  * Freqtrade Version: freqtrade 2021.4\r\n  \r\nNote: All issues other than enhancement requests will be closed without further comment if the above template is deleted or not filled out.\r\n\r\n## Describe the problem:\r\n\r\nHi! It appears the Hyperoptable parameter type: `CategoricalParameter` is not returning correctly.\r\n\r\nIf I run the example as per the Freqtrade Docs [here](https://www.freqtrade.io/en/stable/hyperopt/#hyperoptable-parameters), namely setting a  `CategoricalParameter` like so:\r\n\r\n```\r\nbuy_rsi_enabled = CategoricalParameter([True, False]),\r\n```\r\n\r\n...then when running the Hyperopt tool there is an error in the `populate_buy_trend` as below:\r\n\r\n```\r\nif self.buy_adx_enabled.value:\r\nAttributeError: 'tuple' object has no attribute 'value'\r\n```\r\n\r\nIt would appear that the `CategoricalParameter` is not actually returning one of the categories (even a default) but instead returning a Python Tuple.\r\n\r\n### Steps to reproduce:\r\n\r\n  1. Follow the example in the [Docs](https://www.freqtrade.io/en/stable/hyperopt/#hyperoptable-parameters)\r\n  \r\n### Observed Results:\r\n\r\n  * What happened? There was an AttributeError: 'tuple' object has no attribute 'value'. \r\n  * What did you expect to happen? The 'value' property to exist and be set to either True or False\r\n\r\n### Relevant code exceptions or logs\r\n\r\nNote: Please copy/paste text of the messages, no screenshots of logs please.\r\n\r\n  ```\r\n2021-05-02 09:48:02,421 - freqtrade - ERROR - Fatal exception!\r\njoblib.externals.loky.process_executor._RemoteTraceback:\r\n\"\"\"\r\nTraceback (most recent call last):\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py\", line 431, in _process_worker\r\n    r = call_item()\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py\", line 285, in __call__\r\n    return self.fn(*self.args, **self.kwargs)\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/_parallel_backends.py\", line 595, in __call__\r\n    return self.func(*args, **kwargs)\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py\", line 262, in __call__\r\n    return [func(*args, **kwargs)\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/parallel.py\", line 262, in <listcomp>\r\n    return [func(*args, **kwargs)\r\n  File \"/home/ftuser/.local/lib/python3.9/site-packages/joblib/externals/loky/cloudpickle_wrapper.py\", line 38, in __call__\r\n    return self._obj(*args, **kwargs)\r\n  File \"/freqtrade/freqtrade/optimize/hyperopt.py\", line 288, in generate_optimizer\r\n    backtesting_results = self.backtesting.backtest(\r\n  File \"/freqtrade/freqtrade/optimize/backtesting.py\", line 352, in backtest\r\n    data: Dict = self._get_ohlcv_as_lists(processed)\r\n  File \"/freqtrade/freqtrade/optimize/backtesting.py\", line 196, in _get_ohlcv_as_lists\r\n    self.strategy.advise_buy(pair_data, {'pair': pair}), {'pair': pair})[headers].copy()\r\n  File \"/freqtrade/freqtrade/optimize/hyperopt_auto.py\", line 31, in populate_buy_trend\r\n    return self.strategy.populate_buy_trend(dataframe, metadata)\r\n  File \"/freqtrade/user_data/strategies/Strategy004.py\", line 149, in populate_buy_trend\r\n    if self.buy_adx_enabled.value:\r\nAttributeError: 'tuple' object has no attribute 'value'\r\n  ```\r\n\n", "before_files": [{"content": "\"\"\" Freqtrade bot \"\"\"\n__version__ = 'develop'\n\nif __version__ == 'develop':\n\n    try:\n        import subprocess\n\n        __version__ = 'develop-' + subprocess.check_output(\n            ['git', 'log', '--format=\"%h\"', '-n 1'],\n            stderr=subprocess.DEVNULL).decode(\"utf-8\").rstrip().strip('\"')\n\n        # from datetime import datetime\n        # last_release = subprocess.check_output(\n        #     ['git', 'tag']\n        # ).decode('utf-8').split()[-1].split(\".\")\n        # # Releases are in the format \"2020.1\" - we increment the latest version for dev.\n        # prefix = f\"{last_release[0]}.{int(last_release[1]) + 1}\"\n        # dev_version = int(datetime.now().timestamp() // 1000)\n        # __version__ = f\"{prefix}.dev{dev_version}\"\n\n        #  subprocess.check_output(\n        #     ['git', 'log', '--format=\"%h\"', '-n 1'],\n        #     stderr=subprocess.DEVNULL).decode(\"utf-8\").rstrip().strip('\"')\n    except Exception:\n        # git not available, ignore\n        try:\n            # Try Fallback to freqtrade_commit file (created by CI while building docker image)\n            from pathlib import Path\n            versionfile = Path('./freqtrade_commit')\n            if versionfile.is_file():\n                __version__ = f\"docker-{versionfile.read_text()[:8]}\"\n        except Exception:\n            pass\n", "path": "freqtrade/__init__.py"}], "after_files": [{"content": "\"\"\" Freqtrade bot \"\"\"\n__version__ = '2021.8'\n\nif __version__ == 'develop':\n\n    try:\n        import subprocess\n\n        __version__ = 'develop-' + subprocess.check_output(\n            ['git', 'log', '--format=\"%h\"', '-n 1'],\n            stderr=subprocess.DEVNULL).decode(\"utf-8\").rstrip().strip('\"')\n\n        # from datetime import datetime\n        # last_release = subprocess.check_output(\n        #     ['git', 'tag']\n        # ).decode('utf-8').split()[-1].split(\".\")\n        # # Releases are in the format \"2020.1\" - we increment the latest version for dev.\n        # prefix = f\"{last_release[0]}.{int(last_release[1]) + 1}\"\n        # dev_version = int(datetime.now().timestamp() // 1000)\n        # __version__ = f\"{prefix}.dev{dev_version}\"\n\n        #  subprocess.check_output(\n        #     ['git', 'log', '--format=\"%h\"', '-n 1'],\n        #     stderr=subprocess.DEVNULL).decode(\"utf-8\").rstrip().strip('\"')\n    except Exception:\n        # git not available, ignore\n        try:\n            # Try Fallback to freqtrade_commit file (created by CI while building docker image)\n            from pathlib import Path\n            versionfile = Path('./freqtrade_commit')\n            if versionfile.is_file():\n                __version__ = f\"docker-{versionfile.read_text()[:8]}\"\n        except Exception:\n            pass\n", "path": "freqtrade/__init__.py"}]}