Merge branch 'develop' of https://github.com/freqtrade/freqtrade into max-open-trades
This commit is contained in:
commit
5e64980319
@ -58,11 +58,12 @@ where `ReinforcementLearner` will use the templated `ReinforcementLearner` from
|
|||||||
Most of the function remains the same as for typical Regressors, however, the function above shows how the strategy must pass the raw price data to the agent so that it has access to raw OHLCV in the training environment:
|
Most of the function remains the same as for typical Regressors, however, the function above shows how the strategy must pass the raw price data to the agent so that it has access to raw OHLCV in the training environment:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
def feature_engineering_standard():
|
||||||
# The following features are necessary for RL models
|
# The following features are necessary for RL models
|
||||||
informative[f"%-{pair}raw_close"] = informative["close"]
|
informative[f"%-raw_close"] = informative["close"]
|
||||||
informative[f"%-{pair}raw_open"] = informative["open"]
|
informative[f"%-raw_open"] = informative["open"]
|
||||||
informative[f"%-{pair}raw_high"] = informative["high"]
|
informative[f"%-raw_high"] = informative["high"]
|
||||||
informative[f"%-{pair}raw_low"] = informative["low"]
|
informative[f"%-raw_low"] = informative["low"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, there is no explicit "label" to make - instead it is necessary to assign the `&-action` column which will contain the agent's actions when accessed in `populate_entry/exit_trends()`. In the present example, the neutral action to 0. This value should align with the environment used. FreqAI provides two environments, both use 0 as the neutral action.
|
Finally, there is no explicit "label" to make - instead it is necessary to assign the `&-action` column which will contain the agent's actions when accessed in `populate_entry/exit_trends()`. In the present example, the neutral action to 0. This value should align with the environment used. FreqAI provides two environments, both use 0 as the neutral action.
|
||||||
|
@ -2,18 +2,19 @@
|
|||||||
__version__ = '2023.1.dev'
|
__version__ = '2023.1.dev'
|
||||||
|
|
||||||
if 'dev' in __version__:
|
if 'dev' in __version__:
|
||||||
|
from pathlib import Path
|
||||||
try:
|
try:
|
||||||
import subprocess
|
import subprocess
|
||||||
|
freqtrade_basedir = Path(__file__).parent
|
||||||
|
|
||||||
__version__ = __version__ + '-' + subprocess.check_output(
|
__version__ = __version__ + '-' + subprocess.check_output(
|
||||||
['git', 'log', '--format="%h"', '-n 1'],
|
['git', 'log', '--format="%h"', '-n 1'],
|
||||||
stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
|
stderr=subprocess.DEVNULL, cwd=freqtrade_basedir).decode("utf-8").rstrip().strip('"')
|
||||||
|
|
||||||
except Exception: # pragma: no cover
|
except Exception: # pragma: no cover
|
||||||
# git not available, ignore
|
# git not available, ignore
|
||||||
try:
|
try:
|
||||||
# Try Fallback to freqtrade_commit file (created by CI while building docker image)
|
# Try Fallback to freqtrade_commit file (created by CI while building docker image)
|
||||||
from pathlib import Path
|
|
||||||
versionfile = Path('./freqtrade_commit')
|
versionfile = Path('./freqtrade_commit')
|
||||||
if versionfile.is_file():
|
if versionfile.is_file():
|
||||||
__version__ = f"docker-{__version__}-{versionfile.read_text()[:8]}"
|
__version__ = f"docker-{__version__}-{versionfile.read_text()[:8]}"
|
||||||
|
@ -269,6 +269,8 @@ def dataframe_to_json(dataframe: pd.DataFrame) -> str:
|
|||||||
def default(z):
|
def default(z):
|
||||||
if isinstance(z, pd.Timestamp):
|
if isinstance(z, pd.Timestamp):
|
||||||
return z.timestamp() * 1e3
|
return z.timestamp() * 1e3
|
||||||
|
if z is pd.NaT:
|
||||||
|
return 'NaT'
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
|
||||||
return str(orjson.dumps(dataframe.to_dict(orient='split'), default=default), 'utf-8')
|
return str(orjson.dumps(dataframe.to_dict(orient='split'), default=default), 'utf-8')
|
||||||
|
@ -5,6 +5,7 @@ from copy import deepcopy
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.misc import (dataframe_to_json, decimals_per_coin, deep_merge_dicts, file_dump_json,
|
from freqtrade.misc import (dataframe_to_json, decimals_per_coin, deep_merge_dicts, file_dump_json,
|
||||||
@ -231,3 +232,7 @@ def test_dataframe_json(ohlcv_history):
|
|||||||
assert len(ohlcv_history) == len(dataframe)
|
assert len(ohlcv_history) == len(dataframe)
|
||||||
|
|
||||||
assert_frame_equal(ohlcv_history, dataframe)
|
assert_frame_equal(ohlcv_history, dataframe)
|
||||||
|
ohlcv_history.at[1, 'date'] = pd.NaT
|
||||||
|
json = dataframe_to_json(ohlcv_history)
|
||||||
|
|
||||||
|
dataframe = json_to_dataframe(json)
|
||||||
|
Loading…
Reference in New Issue
Block a user