first
This commit is contained in:
parent
38b96f071f
commit
df3c607e57
1
.env/bin/.last_result.json
Normal file
1
.env/bin/.last_result.json
Normal file
@ -0,0 +1 @@
|
||||
{"latest_backtest":"backtest_strg2_ETHUSDT_1m_prod1-2021-02-25_20-07-44.json"}
|
241
.env/bin/Activate.ps1
Normal file
241
.env/bin/Activate.ps1
Normal file
@ -0,0 +1,241 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the Activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
Activate.ps1
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
<# Function declarations --------------------------------------------------- #>
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Remove all shell session elements added by the Activate script, including the
|
||||
addition of the virtual environment's Python executable from the beginning of
|
||||
the PATH variable.
|
||||
|
||||
.Parameter NonDestructive
|
||||
If present, do not remove this function from the global namespace for the
|
||||
session.
|
||||
|
||||
#>
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
|
||||
# The prior prompt:
|
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
# The prior PYTHONHOME:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
# The prior PATH:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
# Just remove the VIRTUAL_ENV altogether:
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
# Leave deactivate function in the global namespace if requested:
|
||||
if (-not $NonDestructive) {
|
||||
Remove-Item -Path function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.Description
|
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
||||
given folder, and returns them in a map.
|
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
||||
then it is considered a `key = value` line. The left hand string is the key,
|
||||
the right hand is the value.
|
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is
|
||||
stripped from the value before being captured.
|
||||
|
||||
.Parameter ConfigDir
|
||||
Path to the directory that contains the `pyvenv.cfg` file.
|
||||
#>
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
# An empty map will be returned if no config file is found.
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
# Remove extraneous quotations around a string value.
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #>
|
||||
|
||||
# Determine the containing directory of this script
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
||||
# First, get the location of the virtual environment, it might not be
|
||||
# VenvExecDir if specified on the command line.
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
||||
# as `prompt`.
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
# Next, set the prompt from the command line, or the config file, or
|
||||
# just use the name of the virtual environment folder.
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt'];
|
||||
}
|
||||
else {
|
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)"
|
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Prompt = '$Prompt'"
|
||||
Write-Verbose "VenvDir='$VenvDir'"
|
||||
|
||||
# Deactivate any currently active virtual environment, but leave the
|
||||
# deactivate function in place.
|
||||
deactivate -nondestructive
|
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
||||
# that there is an activated venv.
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'"
|
||||
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path -Path Env:PYTHONHOME) {
|
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
Remove-Item -Path Env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
76
.env/bin/activate
Normal file
76
.env/bin/activate
Normal file
@ -0,0 +1,76 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/home/yakov/PycharmProjects/freqtrade/.env"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
if [ "x(.env) " != x ] ; then
|
||||
PS1="(.env) ${PS1:-}"
|
||||
else
|
||||
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
|
||||
else
|
||||
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
|
||||
fi
|
||||
fi
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
37
.env/bin/activate.csh
Normal file
37
.env/bin/activate.csh
Normal file
@ -0,0 +1,37 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/home/yakov/PycharmProjects/freqtrade/.env"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
if (".env" != "") then
|
||||
set env_name = ".env"
|
||||
else
|
||||
if (`basename "VIRTUAL_ENV"` == "__") then
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
|
||||
else
|
||||
set env_name = `basename "$VIRTUAL_ENV"`
|
||||
endif
|
||||
endif
|
||||
set prompt = "[$env_name] $prompt"
|
||||
unset env_name
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
75
.env/bin/activate.fish
Normal file
75
.env/bin/activate.fish
Normal file
@ -0,0 +1,75 @@
|
||||
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
|
||||
# you cannot run it directly
|
||||
|
||||
function deactivate -d "Exit virtualenv and return to normal shell environment"
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
functions -e fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/home/yakov/PycharmProjects/freqtrade/.env"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# fish uses a function instead of an env var to generate the prompt.
|
||||
|
||||
# save the current fish_prompt function as the function _old_fish_prompt
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
# with the original prompt function renamed, we can override with our own.
|
||||
function fish_prompt
|
||||
# Save the return status of the last command
|
||||
set -l old_status $status
|
||||
|
||||
# Prompt override?
|
||||
if test -n "(.env) "
|
||||
printf "%s%s" "(.env) " (set_color normal)
|
||||
else
|
||||
# ...Otherwise, prepend env
|
||||
set -l _checkbase (basename "$VIRTUAL_ENV")
|
||||
if test $_checkbase = "__"
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
|
||||
else
|
||||
printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
|
||||
end
|
||||
end
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
8
.env/bin/chardetect
Executable file
8
.env/bin/chardetect
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from chardet.cli.chardetect import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/coverage
Executable file
8
.env/bin/coverage
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from coverage.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/coverage-3.8
Executable file
8
.env/bin/coverage-3.8
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from coverage.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/coverage3
Executable file
8
.env/bin/coverage3
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from coverage.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/coveralls
Executable file
8
.env/bin/coveralls
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from coveralls.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
159
.env/bin/data_analysis.py
Normal file
159
.env/bin/data_analysis.py
Normal file
@ -0,0 +1,159 @@
|
||||
from pathlib import Path
|
||||
from freqtrade.configuration import Configuration
|
||||
from freqtrade.data.dataprovider import DataProvider
|
||||
from freqtrade.data.history import load_pair_history
|
||||
from freqtrade.resolvers import StrategyResolver
|
||||
from freqtrade.data.btanalysis import load_backtest_data, load_backtest_stats
|
||||
from freqtrade.data.btanalysis import load_trades_from_db
|
||||
from freqtrade.data.btanalysis import analyze_trade_parallelism
|
||||
from freqtrade.plot.plotting import generate_candlestick_graph
|
||||
|
||||
import matplotlib
|
||||
|
||||
# # Customize these according to your needs.
|
||||
#
|
||||
# # Initialize empty configuration object
|
||||
from freqtrade.strategy import IStrategy
|
||||
|
||||
config = Configuration.from_files(["user_data/config_ltcusdt_1h.json"])
|
||||
# # Optionally, use existing configuration file
|
||||
# config = Configuration.from_files(["config.json"])
|
||||
#
|
||||
# # Define some constants
|
||||
# config["timeframe"] = "1m"
|
||||
# # Name of the strategy class
|
||||
config["strategy"] = "ltcusdt_1h"
|
||||
# # Location of the data
|
||||
data_location = Path(config['user_data_dir'], 'data', 'binance')
|
||||
# # Pair to analyze - Only use one pair here
|
||||
pair = "LTC/USDT"
|
||||
#
|
||||
# # Load data using values set above
|
||||
#
|
||||
candles = load_pair_history(datadir=data_location,
|
||||
timeframe=config["timeframe"],
|
||||
pair=pair)
|
||||
#
|
||||
# # Confirm success
|
||||
# print("Loaded " + str(len(candles)) + f" rows of data for {pair} from {data_location}")
|
||||
#
|
||||
# # Load strategy using values set above
|
||||
#
|
||||
dataprovider = DataProvider(config, config['exchange'])
|
||||
IStrategy.dp = dataprovider
|
||||
strategy = StrategyResolver.load_strategy(config)
|
||||
#
|
||||
# # Generate buy/sell signals using strategy
|
||||
df = strategy.analyze_ticker(candles, {'pair': pair})
|
||||
#
|
||||
# col = df.columns
|
||||
#
|
||||
# # Report results
|
||||
# print(f"Generated {df['buy'].sum()} buy signals")
|
||||
data = df.set_index('date', drop=False)
|
||||
|
||||
|
||||
# # if backtest_dir points to a directory, it'll automatically load the last backtest file.
|
||||
# stats = load_backtest_stats(backtest_dir)
|
||||
# # You can get the full backtest statistics by using the following command.
|
||||
# # This contains all information used to generate the backtest result.
|
||||
#
|
||||
# strategy = config["strategy"]
|
||||
# # All statistics are available per strategy, so if `--strategy-list` was used during backtest, this will be reflected here as well.
|
||||
# # Example usages:
|
||||
# print(stats['strategy'][strategy]['results_per_pair'])
|
||||
# # Get pairlist used for this backtest
|
||||
# print(stats['strategy'][strategy]['pairlist'])
|
||||
# # Get market change (average change of all pairs from start to end of the backtest period)
|
||||
# print(stats['strategy'][strategy]['market_change'])
|
||||
# # Maximum drawdown ()
|
||||
# print(stats['strategy'][strategy]['max_drawdown'])
|
||||
# # Maximum drawdown start and end
|
||||
# print(stats['strategy'][strategy]['drawdown_start'])
|
||||
# print(stats['strategy'][strategy]['drawdown_end'])
|
||||
#
|
||||
# # Get strategy comparison (only relevant if multiple strategies were compared)
|
||||
# print(stats['strategy_comparison'])
|
||||
#
|
||||
# # Load backtested trades as dataframe
|
||||
# print(f"backtest {backtest_dir}")
|
||||
# trades = load_backtest_data(backtest_dir)
|
||||
|
||||
# # Show value-counts per pair
|
||||
# trades.groupby("pair")["sell_reason"].value_counts()
|
||||
|
||||
# Fetch trades from database
|
||||
|
||||
|
||||
# Display results
|
||||
# trades.groupby("pair")["sell_reason"].value_counts()
|
||||
|
||||
|
||||
def plot_db(path):
|
||||
trades = load_trades_from_db(path)
|
||||
# Analyze the above
|
||||
parallel_trades = analyze_trade_parallelism(trades, '1m')
|
||||
parallel_trades.plot()
|
||||
trades_red = trades.loc[trades['pair'] == pair]
|
||||
# Limit graph period to keep plotly quick and reactive
|
||||
# Filter trades to one pair
|
||||
data_red = data['2021-01-15':'2021-01-23']
|
||||
# Generate candlestick graph
|
||||
graph = generate_candlestick_graph(pair=pair,
|
||||
data=data_red,
|
||||
trades=trades_red,
|
||||
indicators1=['tsf_mid'],
|
||||
indicators2=['correl_tsf_mid_close', 'correl_angle_short_close',
|
||||
'correl_angle_long_close', 'correl_hist_close']
|
||||
)
|
||||
graph.show()
|
||||
|
||||
|
||||
def plot_backtest(start_date, stop_date):
|
||||
backtest_dir = config["user_data_dir"] / "backtest_results"
|
||||
strategy = config["strategy"]
|
||||
|
||||
trades = load_backtest_data(backtest_dir)
|
||||
stats = load_backtest_stats(backtest_dir)
|
||||
parallel_trades = analyze_trade_parallelism(trades, '1h')
|
||||
parallel_trades = parallel_trades[start_date:stop_date]
|
||||
parallel_trades.plot()
|
||||
# All statistics are available per strategy, so if `--strategy-list` was used during backtest, this will be reflected here as well.
|
||||
# Example usages:
|
||||
print(stats['strategy'][strategy]['results_per_pair'])
|
||||
# Get pairlist used for this backtest
|
||||
print(stats['strategy'][strategy]['pairlist'])
|
||||
# Get market change (average change of all pairs from start to end of the backtest period)
|
||||
print(stats['strategy'][strategy]['market_change'])
|
||||
# Maximum drawdown ()
|
||||
print(stats['strategy'][strategy]['max_drawdown'])
|
||||
# Maximum drawdown start and end
|
||||
print(stats['strategy'][strategy]['drawdown_start'])
|
||||
print(stats['strategy'][strategy]['drawdown_end'])
|
||||
|
||||
# Get strategy comparison (only relevant if multiple strategies were compared)
|
||||
print(stats['strategy_comparison'])
|
||||
|
||||
# Load backtested trades as dataframe
|
||||
print(f"backtest {backtest_dir}")
|
||||
# Show value-counts per pair
|
||||
trades.groupby("pair")["sell_reason"].value_counts()
|
||||
|
||||
# trades_red = trades[start_date:stop_date]
|
||||
|
||||
# Limit graph period to keep plotly quick and reactive
|
||||
# Filter trades to one pair
|
||||
data_red = data[start_date:stop_date]
|
||||
# Generate candlestick graph
|
||||
graph = generate_candlestick_graph(pair=pair,
|
||||
data=data_red,
|
||||
trades=trades,
|
||||
indicators1=['sar', 'tsf_mid'],
|
||||
indicators2=['sine', 'leadsine', 'angle_trend_mid', 'inphase', 'quadrature' ]
|
||||
)
|
||||
|
||||
graph.show()
|
||||
|
||||
|
||||
plot_backtest(start_date='2020-01-01', stop_date='2021-03-18')
|
||||
|
8
.env/bin/dmypy
Executable file
8
.env/bin/dmypy
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.dmypy.client import console_entry
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_entry())
|
8
.env/bin/easy_install
Executable file
8
.env/bin/easy_install
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from setuptools.command.easy_install import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/easy_install-3.8
Executable file
8
.env/bin/easy_install-3.8
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from setuptools.command.easy_install import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/f2py
Executable file
8
.env/bin/f2py
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/f2py3
Executable file
8
.env/bin/f2py3
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/f2py3.8
Executable file
8
.env/bin/f2py3.8
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/flake8
Executable file
8
.env/bin/flake8
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from flake8.main.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
12
.env/bin/freqtrade
Executable file
12
.env/bin/freqtrade
Executable file
@ -0,0 +1,12 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'freqtrade','console_scripts','freqtrade'
|
||||
__requires__ = 'freqtrade'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('freqtrade', 'console_scripts', 'freqtrade')()
|
||||
)
|
8
.env/bin/isort
Executable file
8
.env/bin/isort
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from isort.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/isort-identify-imports
Executable file
8
.env/bin/isort-identify-imports
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from isort.main import identify_imports_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(identify_imports_main())
|
8
.env/bin/jsonschema
Executable file
8
.env/bin/jsonschema
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jsonschema.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter
Executable file
8
.env/bin/jupyter
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_core.command import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter-kernel
Executable file
8
.env/bin/jupyter-kernel
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_client.kernelapp import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter-kernelspec
Executable file
8
.env/bin/jupyter-kernelspec
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_client.kernelspecapp import KernelSpecApp
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(KernelSpecApp.launch_instance())
|
8
.env/bin/jupyter-migrate
Executable file
8
.env/bin/jupyter-migrate
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_core.migrate import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter-nbconvert
Executable file
8
.env/bin/jupyter-nbconvert
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from nbconvert.nbconvertapp import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter-run
Executable file
8
.env/bin/jupyter-run
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_client.runapp import RunApp
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(RunApp.launch_instance())
|
8
.env/bin/jupyter-troubleshoot
Executable file
8
.env/bin/jupyter-troubleshoot
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jupyter_core.troubleshoot import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/jupyter-trust
Executable file
8
.env/bin/jupyter-trust
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from nbformat.sign import TrustNotebookApp
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(TrustNotebookApp.launch_instance())
|
8
.env/bin/mypy
Executable file
8
.env/bin/mypy
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.__main__ import console_entry
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_entry())
|
55
.env/bin/mypyc
Executable file
55
.env/bin/mypyc
Executable file
@ -0,0 +1,55 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
"""Mypyc command-line tool.
|
||||
|
||||
Usage:
|
||||
|
||||
$ mypyc foo.py [...]
|
||||
$ python3 -c 'import foo' # Uses compiled 'foo'
|
||||
|
||||
|
||||
This is just a thin wrapper that generates a setup.py file that uses
|
||||
mypycify, suitable for prototyping and testing.
|
||||
"""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
base_path = os.path.join(os.path.dirname(__file__), '..')
|
||||
|
||||
setup_format = """\
|
||||
from distutils.core import setup
|
||||
from mypyc.build import mypycify
|
||||
|
||||
setup(name='mypyc_output',
|
||||
ext_modules=mypycify({}, opt_level="{}"),
|
||||
)
|
||||
"""
|
||||
|
||||
def main() -> None:
|
||||
build_dir = 'build' # can this be overridden??
|
||||
try:
|
||||
os.mkdir(build_dir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
opt_level = os.getenv("MYPYC_OPT_LEVEL", '3')
|
||||
|
||||
setup_file = os.path.join(build_dir, 'setup.py')
|
||||
with open(setup_file, 'w') as f:
|
||||
f.write(setup_format.format(sys.argv[1:], opt_level))
|
||||
|
||||
# We don't use run_setup (like we do in the test suite) because it throws
|
||||
# away the error code from distutils, and we don't care about the slight
|
||||
# performance loss here.
|
||||
env = os.environ.copy()
|
||||
base_path = os.path.join(os.path.dirname(__file__), '..')
|
||||
env['PYTHONPATH'] = base_path + os.pathsep + env.get('PYTHONPATH', '')
|
||||
cmd = subprocess.run([sys.executable, setup_file, 'build_ext', '--inplace'], env=env)
|
||||
sys.exit(cmd.returncode)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
8
.env/bin/pip
Executable file
8
.env/bin/pip
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pip3
Executable file
8
.env/bin/pip3
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pip3.8
Executable file
8
.env/bin/pip3.8
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pt2to3
Executable file
8
.env/bin/pt2to3
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tables.scripts.pt2to3 import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/ptdump
Executable file
8
.env/bin/ptdump
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tables.scripts.ptdump import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/ptrepack
Executable file
8
.env/bin/ptrepack
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tables.scripts.ptrepack import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pttree
Executable file
8
.env/bin/pttree
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tables.scripts.pttree import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/py.test
Executable file
8
.env/bin/py.test
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pytest import console_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_main())
|
8
.env/bin/pycodestyle
Executable file
8
.env/bin/pycodestyle
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pycodestyle import _main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(_main())
|
8
.env/bin/pyflakes
Executable file
8
.env/bin/pyflakes
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyflakes.api import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pygmentize
Executable file
8
.env/bin/pygmentize
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pygments.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/pytest
Executable file
8
.env/bin/pytest
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pytest import console_main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(console_main())
|
1
.env/bin/python
Symbolic link
1
.env/bin/python
Symbolic link
@ -0,0 +1 @@
|
||||
python3.8
|
1
.env/bin/python3
Symbolic link
1
.env/bin/python3
Symbolic link
@ -0,0 +1 @@
|
||||
python3.8
|
1
.env/bin/python3.8
Symbolic link
1
.env/bin/python3.8
Symbolic link
@ -0,0 +1 @@
|
||||
/usr/bin/python3.8
|
8
.env/bin/stubgen
Executable file
8
.env/bin/stubgen
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.stubgen import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/stubtest
Executable file
8
.env/bin/stubtest
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from mypy.stubtest import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
8
.env/bin/tabulate
Executable file
8
.env/bin/tabulate
Executable file
@ -0,0 +1,8 @@
|
||||
#!/home/yakov/PycharmProjects/freqtrade/.env/bin/python3.8
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tabulate import _main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(_main())
|
1
.env/bin/user_data/backtest_results/.last_result.json
Normal file
1
.env/bin/user_data/backtest_results/.last_result.json
Normal file
@ -0,0 +1 @@
|
||||
{"latest_backtest":"ltcusdt_1h-2021-03-19_10-50-25.json"}
|
86
.env/bin/user_data/config_adausdt_1m.json
Normal file
86
.env/bin/user_data/config_adausdt_1m.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 300.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": true,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": true,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": true,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ADA/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "adausdt_strg2_1m",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
84
.env/bin/user_data/config_binance.json
Normal file
84
.env/bin/user_data/config_binance.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "BTC",
|
||||
"stake_amount": 0.05,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/BTC" ],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
91
.env/bin/user_data/config_binance_multiple.json
Normal file
91
.env/bin/user_data/config_binance_multiple.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 0.05,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/USDT",
|
||||
"AAVE/USDT",
|
||||
"XRP/USDT",
|
||||
"DOGE/USDT",
|
||||
"BTC/USDT",
|
||||
"ADA/USDT",
|
||||
"TRX/XRP"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
86
.env/bin/user_data/config_btcusdt_1m.json
Normal file
86
.env/bin/user_data/config_btcusdt_1m.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 1000.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": true,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"BTC/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
86
.env/bin/user_data/config_dogeusdt_1m.json
Normal file
86
.env/bin/user_data/config_dogeusdt_1m.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 600.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": true,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": true,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"DOGE/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
86
.env/bin/user_data/config_ethusdt_1h_high_risk.json
Normal file
86
.env/bin/user_data/config_ethusdt_1h_high_risk.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 100.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": true,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "ethusdt_high_risk",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
86
.env/bin/user_data/config_ethusdt_1m.json
Normal file
86
.env/bin/user_data/config_ethusdt_1m.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 100.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": false,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": true
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "your_telegram_token",
|
||||
"chat_id": "your_telegram_chat_id"
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
91
.env/bin/user_data/config_ethusdt_1m_sellonlyprofit.json
Normal file
91
.env/bin/user_data/config_ethusdt_1m_sellonlyprofit.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 100,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1m",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": true,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": true,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": true,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": true,
|
||||
"ignore_roi_if_buy_signal": false
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": true,
|
||||
"token": "1677121989:AAE5xmC884801M6xDDHu3rz7gPnZdnIqpU0",
|
||||
"chat_id": "1288347675",
|
||||
"keyboard": [
|
||||
["/daily", "/stats", "/balance", "/profit"],
|
||||
["/status table", "/performance", "/trades"],
|
||||
["/reload_config", "/count", "/logs"]
|
||||
]
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "freqtrade",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
91
.env/bin/user_data/config_ethusdt_safe_1h.json
Normal file
91
.env/bin/user_data/config_ethusdt_safe_1h.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 100.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1h",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": false,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": false,
|
||||
"ignore_roi_if_buy_signal": true
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"ETH/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": true,
|
||||
"token": "1661670711:AAEjHFL_wnvc-hN0V8NKe0G53mzrz9rWnzk",
|
||||
"chat_id": "1288347675",
|
||||
"keyboard": [
|
||||
["/daily", "/stats", "/balance", "/profit"],
|
||||
["/status table", "/performance"],
|
||||
["/reload_config", "/count", "/logs", "/status", "/trades"]
|
||||
]
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "ethusdt_2_safe_1h",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
91
.env/bin/user_data/config_ltcusdt_1h.json
Normal file
91
.env/bin/user_data/config_ltcusdt_1h.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"max_open_trades": 3,
|
||||
"stake_currency": "USDT",
|
||||
"stake_amount": 100.0,
|
||||
"tradable_balance_ratio": 0.99,
|
||||
"fiat_display_currency": "USD",
|
||||
"timeframe": "1h",
|
||||
"dry_run": true,
|
||||
"position_stacking": true,
|
||||
"cancel_open_orders_on_exit": false,
|
||||
"unfilledtimeout": {
|
||||
"buy": 10,
|
||||
"sell": 30
|
||||
},
|
||||
"bid_strategy": {
|
||||
"use_order_book": false,
|
||||
"ask_last_balance": 0.0,
|
||||
"order_book_top": 1,
|
||||
"check_depth_of_market": {
|
||||
"enabled": false,
|
||||
"bids_to_ask_delta": 1
|
||||
}
|
||||
},
|
||||
"ask_strategy":{
|
||||
"use_order_book": true,
|
||||
"order_book_min": 1,
|
||||
"order_book_max": 1,
|
||||
"use_sell_signal": true,
|
||||
"sell_profit_only": true,
|
||||
"ignore_roi_if_buy_signal": true
|
||||
},
|
||||
"exchange": {
|
||||
"name": "binance",
|
||||
"key": "your_exchange_key",
|
||||
"secret": "your_exchange_secret",
|
||||
"ccxt_config": {"enableRateLimit": true},
|
||||
"ccxt_async_config": {
|
||||
"enableRateLimit": true,
|
||||
"rateLimit": 200
|
||||
},
|
||||
"pair_whitelist": [
|
||||
"LTC/USDT"
|
||||
],
|
||||
"pair_blacklist": [
|
||||
"BNB/BTC"
|
||||
]
|
||||
},
|
||||
"pairlists": [
|
||||
{"method": "StaticPairList"}
|
||||
],
|
||||
"edge": {
|
||||
"enabled": false,
|
||||
"process_throttle_secs": 3600,
|
||||
"calculate_since_number_of_days": 7,
|
||||
"allowed_risk": 0.01,
|
||||
"stoploss_range_min": -0.01,
|
||||
"stoploss_range_max": -0.1,
|
||||
"stoploss_range_step": -0.01,
|
||||
"minimum_winrate": 0.60,
|
||||
"minimum_expectancy": 0.20,
|
||||
"min_trade_number": 10,
|
||||
"max_trade_duration_minute": 1440,
|
||||
"remove_pumps": false
|
||||
},
|
||||
"telegram": {
|
||||
"enabled": false,
|
||||
"token": "1661670711:AAEjHFL_wnvc-hN0V8NKe0G53mzrz9rWnzk",
|
||||
"chat_id": "1288347675",
|
||||
"keyboard": [
|
||||
["/daily", "/stats", "/balance", "/profit"],
|
||||
["/status table", "/performance"],
|
||||
["/reload_config", "/count", "/logs", "/status", "/trades"]
|
||||
]
|
||||
},
|
||||
"api_server": {
|
||||
"enabled": false,
|
||||
"listen_ip_address": "127.0.0.1",
|
||||
"listen_port": 8080,
|
||||
"verbosity": "error",
|
||||
"jwt_secret_key": "somethingrandom",
|
||||
"CORS_origins": [],
|
||||
"username": "freqtrader",
|
||||
"password": "SuperSecurePassword"
|
||||
},
|
||||
"bot_name": "ethusdt_2_safe_1h",
|
||||
"initial_state": "running",
|
||||
"forcebuy_enable": false,
|
||||
"internals": {
|
||||
"process_throttle_secs": 5
|
||||
}
|
||||
}
|
0
user_data/logs/.gitkeep → .env/bin/user_data/hyperopt.lock
Normal file → Executable file
0
user_data/logs/.gitkeep → .env/bin/user_data/hyperopt.lock
Normal file → Executable file
1
.env/bin/user_data/hyperopt_results/.last_result.json
Normal file
1
.env/bin/user_data/hyperopt_results/.last_result.json
Normal file
@ -0,0 +1 @@
|
||||
{"latest_hyperopt":"hyperopt_results_2021-02-11_22-07-24.pickle"}
|
151
.env/bin/user_data/hyperopt_results/ada2_results.txt
Normal file
151
.env/bin/user_data/hyperopt_results/ada2_results.txt
Normal file
@ -0,0 +1,151 @@
|
||||
(freqtrade-conda) crypto_rahino@fretrade-1:~/freqtrade$ freqtrade hyperopt --config user_data/config_adausdt_1m.json --hyperopt hyper_adausdt2 --hyperopt-loss OnlyProfitHyperOptLoss --strategy strg2_ADAUSDT_1m -e 500 --spaces all -i 1m --eps
|
||||
2021-02-15 21:47:44,613 - freqtrade.configuration.configuration - INFO - Using config: user_data/config_adausdt_1m.json ...
|
||||
2021-02-15 21:47:44,614 - freqtrade.loggers - INFO - Verbosity set to 0
|
||||
2021-02-15 21:47:44,614 - freqtrade.configuration.configuration - INFO - Parameter -i/--timeframe detected ... Using timeframe: 1m ...
|
||||
2021-02-15 21:47:44,614 - freqtrade.configuration.configuration - INFO - Parameter --enable-position-stacking detected ...
|
||||
2021-02-15 21:47:44,614 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 3 ...
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/crypto_rahino/freqtrade/user_data ...
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Using data directory: /home/crypto_rahino/freqtrade/user_data/data/binance ...
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Overriding timeframe with Command line argument
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Using Hyperopt class name: hyper_adausdt2
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Parameter --epochs detected ... Will run Hyperopt with for 500 epochs ...
|
||||
2021-02-15 21:47:44,615 - freqtrade.configuration.configuration - INFO - Parameter -s/--spaces detected: ['all']
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.configuration - INFO - Parameter -j/--job-workers detected: -1
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.configuration - INFO - Parameter --min-trades detected: 1
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.configuration - INFO - Using Hyperopt loss class name: OnlyProfitHyperOptLoss
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
|
||||
2021-02-15 21:47:44,616 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
|
||||
2021-02-15 21:47:44,618 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Hyperopt mode
|
||||
2021-02-15 21:47:44,618 - filelock - INFO - Lock 140464320763024 acquired on /home/crypto_rahino/freqtrade/user_data/hyperopt.lock
|
||||
2021-02-15 21:47:44,618 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
|
||||
2021-02-15 21:47:44,618 - freqtrade.exchange.exchange - INFO - Using CCXT 1.40.99
|
||||
2021-02-15 21:47:44,618 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
|
||||
2021-02-15 21:47:44,624 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 200}
|
||||
2021-02-15 21:47:44,629 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
|
||||
2021-02-15 21:47:45,396 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
|
||||
2021-02-15 21:47:45,408 - freqtrade.resolvers.iresolver - INFO - Using resolved strategy strg2_ADAUSDT_1m from '/home/crypto_rahino/freqtrade/user_data/strategies/strg2_ada_usdt_1m.py'...
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'timeframe' with value in config file: 1m.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: USDT.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 100.0.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'unfilledtimeout' with value in config file: {'buy': 10, 'sell': 30}.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'0': 0.06310332385111853, '38': 0.0689051965930711, '69': 0.029484368494376897, '165': 0}
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using timeframe: 1m
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.21
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: True
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive: 0.05
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.06
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: True
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_custom_stoploss: False
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'limit', 'sell': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': False}
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: USDT
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 100.0
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using startup_candle_count: 30
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using unfilledtimeout: {'buy': 10, 'sell': 30}
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
|
||||
2021-02-15 21:47:45,409 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
|
||||
2021-02-15 21:47:45,410 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
|
||||
2021-02-15 21:47:45,410 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_offset: 0.0
|
||||
2021-02-15 21:47:45,410 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using disable_dataframe_checks: False
|
||||
2021-02-15 21:47:45,410 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_buying_expired_candle_after: 0
|
||||
2021-02-15 21:47:45,410 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
|
||||
2021-02-15 21:47:45,412 - freqtrade.resolvers.iresolver - INFO - Using resolved pairlist StaticPairList from '/home/crypto_rahino/freqtrade/freqtrade/plugins/pairlist/StaticPairList.py'...
|
||||
2021-02-15 21:47:45,417 - freqtrade.resolvers.iresolver - INFO - Using resolved hyperopt hyper_adausdt2 from '/home/crypto_rahino/freqtrade/user_data/hyperopts/hyper_adausdt2.py'...
|
||||
2021-02-15 21:47:45,418 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_indicators() method. Using populate_indicators from the strategy.
|
||||
2021-02-15 21:47:45,418 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_buy_trend() method. Using populate_buy_trend from the strategy.
|
||||
2021-02-15 21:47:45,418 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_sell_trend() method. Using populate_sell_trend from the strategy.
|
||||
2021-02-15 21:47:45,423 - freqtrade.resolvers.iresolver - INFO - Using resolved hyperoptloss OnlyProfitHyperOptLoss from '/home/crypto_rahino/freqtrade/freqtrade/optimize/hyperopt_loss_onlyprofit.py'...
|
||||
2021-02-15 21:47:45,423 - freqtrade.optimize.hyperopt - INFO - Removing `/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_tickerdata.pkl`.
|
||||
2021-02-15 21:47:45,468 - freqtrade.optimize.hyperopt - INFO - Using optimizer random state: 2757
|
||||
2021-02-15 21:47:45,468 - freqtrade.data.history.history_utils - INFO - Using indicator startup period: 30 ...
|
||||
2021-02-15 21:47:49,773 - numexpr.utils - INFO - NumExpr defaulting to 4 threads.
|
||||
2021-02-15 21:47:50,721 - freqtrade.data.converter - INFO - Missing data fillup for ADA/USDT: before: 1486512 - after: 1491400
|
||||
2021-02-15 21:47:50,734 - freqtrade.optimize.backtesting - INFO - Loading data from 2018-04-17 04:02:00 up to 2021-02-15 20:41:00 (1035 days)..
|
||||
2021-02-15 21:47:50,734 - freqtrade.configuration.timerange - WARNING - Moving start-date by 30 candles to account for startup time.
|
||||
2021-02-15 21:47:51,159 - freqtrade.optimize.hyperopt - INFO - Hyperopting with data from 2018-04-17 04:32:00 up to 2021-02-15 20:41:00 (1035 days)..
|
||||
2021-02-15 21:47:51,571 - freqtrade.optimize.hyperopt - INFO - Found 4 CPU cores. Let's make them scream!
|
||||
2021-02-15 21:47:51,571 - freqtrade.optimize.hyperopt - INFO - Number of parallel jobs set as: -1
|
||||
2021-02-15 21:47:51,604 - freqtrade.optimize.hyperopt - INFO - Effective number of parallel workers used: 4
|
||||
+--------+---------+----------+------------------+--------------+-----------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-----------------------------------+----------------+-------------|
|
||||
| * Best | 1/500 | 13083 | 5904 5218 1961 | -0.17% | -2,277.75976620 USDT (-2,275.48%) | 313.5 m | 8.58495 |
|
||||
| * Best | 2/500 | 10 | 0 0 10 | -1.08% | -10.79632666 USDT (-10.79%) | 25.9 m | 1.03595 |
|
||||
| * Best | 4/500 | 3 | 3 0 0 | 2.09% | 6.28261765 USDT (6.28%) | 62.0 m | 0.97908 |
|
||||
| * Best | 5/500 | 192 | 127 52 13 | 0.61% | 118.07243091 USDT (117.95%) | 179.2 m | 0.60682 |
|
||||
/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:688: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
|
||||
warnings.warn(
|
||||
| Best | 39/500 | 714 | 380 266 68 | 0.47% | 336.09087695 USDT (335.76%) | 330.8 m | -0.11918 |
|
||||
| Best | 56/500 | 601 | 395 168 38 | 0.57% | 340.28337587 USDT (339.94%) | 255.5 m | -0.13314 |
|
||||
Exception ignored in: <function Exchange.__del__ at 0x7fc066a0c160>
|
||||
[Epoch 60 of 500 ( 12%)] |████████████/ | [ETA: 4:32:28, Elapsed Time: 0:37:09]2021-02-15 22:28:46,048 - ccxt.base.exchange - WARNING - binance requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
|
||||
2021-02-15 22:28:46,050 - asyncio - ERROR - Unclosed client session
|
||||
client_session: <aiohttp.client.ClientSession object at 0x7fc0471d7d90>
|
||||
2021-02-15 22:28:46,051 - asyncio - ERROR - Unclosed connector
|
||||
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fc04813a2e0>, 632.889510459)]']
|
||||
connector: <aiohttp.connector.TCPConnector object at 0x7fc0471d7dc0>
|
||||
Traceback (most recent call last):
|
||||
File "/home/crypto_rahino/freqtrade/freqtrade/exchange/exchange.py", line 145, in __del__
|
||||
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
||||
File "/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/asyncio/events.py", line 642, in get_event_loop
|
||||
raise RuntimeError('There is no current event loop in thread %r.'
|
||||
RuntimeError: There is no current event loop in thread 'QueueFeederThread'.
|
||||
| Best | 186/500 | 775 | 404 322 49 | 0.48% | 372.14918360 USDT (371.78%) | 289.4 m | -0.23926 |
|
||||
| Best | 241/500 | 580 | 328 233 19 | 0.74% | 429.37941015 USDT (428.95%) | 418.5 m | -0.42984 |
|
||||
[Epoch 500 of 500 (100%)] || | [Time: 5:11:12, Elapsed Time: 5:11:12]
|
||||
2021-02-16 03:02:48,826 - freqtrade.optimize.hyperopt - INFO - 500 epochs saved to '/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_results_2021-02-15_21-47-45.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
241/500: 580 trades. 328/233/19 Wins/Draws/Losses. Avg profit 0.74%. Median profit 0.44%. Total profit 429.37941015 USDT ( 428.95Σ%). Avg duration 418.5 min. Objective: -0.42984
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.65672,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value': -0.00188,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value': 38,
|
||||
'sar-enabled': False,
|
||||
'sar-value': 69,
|
||||
'trigger': 'bol_mid'
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': 0.1749,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value_sell': -0.00354,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value_sell': 55.23156,
|
||||
'sar-enabled': False,
|
||||
'sar-value_sell': 0.44967,
|
||||
'trigger': 'bol_mid'
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.2516,
|
||||
"18": 0.07762,
|
||||
"65": 0.02142,
|
||||
"158": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.17102
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.30581
|
||||
trailing_stop_positive_offset = 0.36224
|
||||
trailing_only_offset_is_reached = True
|
||||
|
38
.env/bin/user_data/hyperopt_results/crypto_rahino
Normal file
38
.env/bin/user_data/hyperopt_results/crypto_rahino
Normal file
@ -0,0 +1,38 @@
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
||||
NhAAAAAwEAAQAAAYEAqCTffWhcv3s+xJhKG4dcX2o1H+Tlth7CY/zpVt8hhLcnfw4fMl+w
|
||||
ekW0JstHV55DWrkyI5B3EWSJwhPIGhRJySn+wBraRdV5/q4fsg7lj3GasWa5QQ1Q5BxdXz
|
||||
2+jDohUmbAZUOglaLkrWHn46WXyRlUvUWKEdDw+Om7eMtN8NSz8xhtgZ7J4eiC3ZN6OEsl
|
||||
klWpOOCOtYcJVzzXxAupQbnJnBsbKWoIbWLw4pT1B/6O1ez6TrB3cAAjTu5G1tx0cXghAH
|
||||
Cjap+BukeAI1feHHr7M6koMQco3EUfO9QAm6KbBywFA+doVJCbptQLKWL/QbyJnkLgp6E4
|
||||
BbUb70JAqdUW22HlHHXw/W9jFN5dWOXsZSm6tQpfof8cuCgFP2xM4R7CwE3GPJ/1BnDngx
|
||||
5HP/V8D4twcI1KLUldC+9P3sv3gfV8l77rhI13sF8RSeE/WmhGzGyn+AGGQx5AAwN+BSKu
|
||||
7h1fDVI7choXGtGEGNP9KcsR3S+ZednWet9AE2PfAAAFiHsWPBN7FjwTAAAAB3NzaC1yc2
|
||||
EAAAGBAKgk331oXL97PsSYShuHXF9qNR/k5bYewmP86VbfIYS3J38OHzJfsHpFtCbLR1ee
|
||||
Q1q5MiOQdxFkicITyBoUSckp/sAa2kXVef6uH7IO5Y9xmrFmuUENUOQcXV89vow6IVJmwG
|
||||
VDoJWi5K1h5+Oll8kZVL1FihHQ8Pjpu3jLTfDUs/MYbYGeyeHogt2TejhLJZJVqTjgjrWH
|
||||
CVc818QLqUG5yZwbGylqCG1i8OKU9Qf+jtXs+k6wd3AAI07uRtbcdHF4IQBwo2qfgbpHgC
|
||||
NX3hx6+zOpKDEHKNxFHzvUAJuimwcsBQPnaFSQm6bUCyli/0G8iZ5C4KehOAW1G+9CQKnV
|
||||
Ftth5Rx18P1vYxTeXVjl7GUpurUKX6H/HLgoBT9sTOEewsBNxjyf9QZw54MeRz/1fA+LcH
|
||||
CNSi1JXQvvT97L94H1fJe+64SNd7BfEUnhP1poRsxsp/gBhkMeQAMDfgUiru4dXw1SO3Ia
|
||||
FxrRhBjT/SnLEd0vmXnZ1nrfQBNj3wAAAAMBAAEAAAGBAIkJzFAkT3sMEmMeD0ASeTmWkQ
|
||||
eWgZWFyj69sNtJbcMBlyIZO1nN3UI6LxJzGIkThqeZSoDry+8T9qaDgtGmeWCHZoXhHMZP
|
||||
r2bfORvgwj2/hClTpGadWLEhYQQviW42LlQ/RE0D6gwqv5+DrP+/RU7z4zmDRH0ywkLMFC
|
||||
vl3ncKlELrRMygwr7oxkeaW8Enlc6HHC0r74OJNBayktPIAUF9DxC4ktGVBptISTUR3AaQ
|
||||
9I7r3jFl52IT6rL4xil1b+sbhXl+mzOClsMchKmCab33jWmAAAPEGwQUJEfFMh5WnLb4FQ
|
||||
0rM144nm0eAkDZ0neV8wjwNZt451uHmC0zD0VmWdb8Nybo8U0Ob2Su7mz3P59N2qUS2cyg
|
||||
LdNkCAjanWo8EzFfzyitkleOG1f0cZD45e+fdHfS28CMkDKDU8Edwe2OztT3HsDoSJQfNF
|
||||
sRYlP02bNB/AkCZMQbnThNOyIgWXV05bKYcQpT6TpDbIjMHLMimFsHVCGJFAPHkvcoaQAA
|
||||
AMEArDL1ncfLLis1qF+KdI3TICAanB7uziX4NkM7v38gMl9+zKkToT/pCKM8giApcsTjo1
|
||||
Xk1GKQZveYq0zEqzSts1vhr2coDjNBAIBWxC2riReQ7tMhHn/DrNr3seSBzon9LwP7MAQX
|
||||
zhfMSWMoh63dkJFeFYD0ASL/RhhF0iGwHnjcGttEHMtDYmG93J0Xj0gA/d/ZixWjjkopU2
|
||||
qd7dr/QtqkeuNpqeg2iHznO+tzHRWGFkxe1ghT9VTX54EraaJ0AAAAwQDbN1IpzCC0Is6h
|
||||
/fQtDxpSzsfbKu+Q/b/maJN8Ow6PII5RqMPiEWCi0d9s5NxdTa+E4iuG0YQiFvEeB3we3I
|
||||
j0yj0g08TWY7Q4M0piitAX6H55qa2wMAzWE1ACAUZXKwRvJH2oquY0TdYd93oH/XNTBLxC
|
||||
ikqfbgqRuLVlTzLhYRAxC09us4wd0VY+/pzQO/Qu7L/2TBYnmXxceSJUF6MzLJEYZFHRUD
|
||||
MrqzyoKuZH92JP2fm1J2L7d9UDBQed95MAAADBAMRbsWkLWh8osbTVogmpTQ2MJiaWiGX3
|
||||
U+FvBKcuMLetD3Kf8vWxWkhTm3zYVp3mKavHZjiEXMb1wKBu0MTktNpu4rHMY6LxEKvpIB
|
||||
2Guq0Vnu3J9OqF/AKkHGiwrUZiH0tr8ca2whC5UysrWk8vBso7ta48w/NWKrfxJAoDFsML
|
||||
CrDF2EVHftKyv6v5n063quBfgS4sWBz0oghsUH4ao/C/j8anB6X8j4aBAr7G9t2kIh0bc3
|
||||
2UvPoF0ohWQ+j6BQAAAA1jcnlwdG9fcmFoaW5vAQIDBA==
|
||||
-----END OPENSSH PRIVATE KEY-----
|
136
.env/bin/user_data/hyperopt_results/ehtusdt3_profit
Normal file
136
.env/bin/user_data/hyperopt_results/ehtusdt3_profit
Normal file
@ -0,0 +1,136 @@
|
||||
|
||||
172/300: 9 trades. 6/3/0 Wins/Draws/Losses. Avg profit 1.45%. Median profit 0.93%. Total profit 0.13055133 USDT ( 13.04Σ%). Avg duration 77.0 min. Objective: 0.95653
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_long-enabled': True,
|
||||
'angle_long-value': -8,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value': -27,
|
||||
'angle_short-enabled': True,
|
||||
'angle_short-value': 10,
|
||||
'cci-enabled': False,
|
||||
'cci-value': -59,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value': 0.21787,
|
||||
'correl_angle_mid_close-enabled': True,
|
||||
'correl_angle_mid_close-value': 0.44494,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value': -0.9378,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value': 0.06954,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.75227,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value': 0.59611,
|
||||
'correl_ht_sine_close-enabled': False,
|
||||
'correl_ht_sine_close-value': 0.64922,
|
||||
'correl_mfi_close-enabled': True,
|
||||
'correl_mfi_close-value': -0.97597,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value': 0.0799,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value': 0.46867,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value': 0.27662,
|
||||
'ema-enabled': False,
|
||||
'ema-value': 15,
|
||||
'ema_bol-enabled': False,
|
||||
'ema_bol-value': 9,
|
||||
'ht_phase-enabled': False,
|
||||
'ht_phase1-value': -36,
|
||||
'ht_phase2-value': 255,
|
||||
'ht_trendline-enabled': False,
|
||||
'ht_trendline-value': -0.02648,
|
||||
'ht_trendmode-enabled': False,
|
||||
'ht_trendmode-value': 0,
|
||||
'inphase-enabled': True,
|
||||
'inphase-value': -0.03953,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value': 0.23545,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value': 57,
|
||||
'trigger': 'cci',
|
||||
'tsf_long-enabled': True,
|
||||
'tsf_long-value': -3,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value': -98,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value': -22
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_long-enabled': True,
|
||||
'angle_long-value_sell': -19,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value_sell': 30,
|
||||
'angle_short-enabled': True,
|
||||
'angle_short-value_sell': -9,
|
||||
'cci-enabled': False,
|
||||
'cci-value_sell': -83,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value_sell': 0.2552,
|
||||
'correl_angle_mid_close-enabled': True,
|
||||
'correl_angle_mid_close-value_sell': 0.46789,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value_sell': 0.57124,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value_sell': 0.65996,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': 0.41353,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value_sell': -0.98429,
|
||||
'correl_ht_sine_close-enabled': False,
|
||||
'correl_ht_sine_close-value_sell': 0.66294,
|
||||
'correl_mfi_close-enabled': True,
|
||||
'correl_mfi_close-value_sell': -0.4065,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value_sell': -0.99299,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value_sell': 0.5597,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value_sell': -0.9004,
|
||||
'ema-enabled': False,
|
||||
'ema-value_sell': 24,
|
||||
'ema_bol-enabled': False,
|
||||
'ema_bol-value_sell': 19,
|
||||
'ht_phase-enabled': False,
|
||||
'ht_phase1-value_sell': 228,
|
||||
'ht_phase2-value_sell': -19,
|
||||
'ht_trendline-enabled': False,
|
||||
'ht_trendline-value_sell': -0.01794,
|
||||
'ht_trendmode-enabled': False,
|
||||
'ht_trendmode-value_sell': 0,
|
||||
'inphase-enabled': True,
|
||||
'inphase-value_sell': 0.00585,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value_sell': -6.78881,
|
||||
'mfi-value_sell': 67,
|
||||
'trigger': 'cci',
|
||||
'tsf_long-enabled': True,
|
||||
'tsf_long-value_sell': 66,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value_sell': -3,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value_sell': 1
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.19091,
|
||||
"17": 0.07922,
|
||||
"45": 0.01411,
|
||||
"59": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.05668
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.27147
|
||||
trailing_stop_positive_offset = 0.31663
|
||||
trailing_only_offset_is_reached = False
|
||||
|
128
.env/bin/user_data/hyperopt_results/eth2_safe_1h_sharpe.txt
Normal file
128
.env/bin/user_data/hyperopt_results/eth2_safe_1h_sharpe.txt
Normal file
@ -0,0 +1,128 @@
|
||||
(freqtrade-conda) crypto_rahino@fretrade-1:~/freqtrade$ freqtrade hyperopt --config user_data/config_ethusdt_safe_1h.json --hyperopt hyper_ethusdt2 --hyperopt-loss SharpeHyperOptLoss --strategy strg2_ETHUSDT_1h_prod1 -e 300 --spaces all --timerange 20190101-
|
||||
2021-02-28 20:54:23,663 - freqtrade.configuration.configuration - INFO - Using config: user_data/config_ethusdt_safe_1h.json ...
|
||||
2021-02-28 20:54:23,663 - freqtrade.loggers - INFO - Verbosity set to 0
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 3 ...
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20190101- ...
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Using user-data directory: /home/crypto_rahino/freqtrade/user_data ...
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Using data directory: /home/crypto_rahino/freqtrade/user_data/data/binance ...
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Using Hyperopt class name: hyper_ethusdt2
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Parameter --epochs detected ... Will run Hyperopt with for 300 epochs ...
|
||||
2021-02-28 20:54:23,664 - freqtrade.configuration.configuration - INFO - Parameter -s/--spaces detected: ['all']
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.configuration - INFO - Parameter -j/--job-workers detected: -1
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.configuration - INFO - Parameter --min-trades detected: 1
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.configuration - INFO - Using Hyperopt loss class name: SharpeHyperOptLoss
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.check_exchange - INFO - Checking exchange...
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.check_exchange - INFO - Exchange "binance" is officially supported by the Freqtrade development team.
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
|
||||
2021-02-28 20:54:23,665 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
|
||||
2021-02-28 20:54:23,667 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Hyperopt mode
|
||||
2021-02-28 20:54:23,667 - filelock - INFO - Lock 140536302744960 acquired on /home/crypto_rahino/freqtrade/user_data/hyperopt.lock
|
||||
2021-02-28 20:54:23,667 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
|
||||
2021-02-28 20:54:23,667 - freqtrade.exchange.exchange - INFO - Using CCXT 1.40.99
|
||||
2021-02-28 20:54:23,667 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True}
|
||||
2021-02-28 20:54:23,673 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'enableRateLimit': True, 'rateLimit': 200}
|
||||
2021-02-28 20:54:23,678 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
|
||||
2021-02-28 20:54:24,878 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Binance'...
|
||||
2021-02-28 20:54:24,884 - freqtrade.resolvers.iresolver - INFO - Using resolved strategy strg2_ETHUSDT_1h_prod1 from '/home/crypto_rahino/freqtrade/user_data/strategies/ethusdt2_safe_prod1.py'...
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'timeframe' with value in config file: 1h.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_currency' with value in config file: USDT.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'stake_amount' with value in config file: 100.0.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'unfilledtimeout' with value in config file: {'buy': 10, 'sell': 30}.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'use_sell_signal' with value in config file: True.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'sell_profit_only' with value in config file: False.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Override strategy 'ignore_roi_if_buy_signal' with value in config file: False.
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using minimal_roi: {'0': 0.14918562374415067, '500': 0.058385372968253246, '2000': 0.02650295809826818, '1500': 0}
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using timeframe: 1h
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stoploss: -0.23
|
||||
2021-02-28 20:54:24,885 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop: True
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive: 0.04
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_stop_positive_offset: 0.07
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using trailing_only_offset_is_reached: True
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_custom_stoploss: False
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using process_only_new_candles: False
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_types: {'buy': 'market', 'sell': 'market', 'stoploss': 'market', 'stoploss_on_exchange': False}
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using order_time_in_force: {'buy': 'gtc', 'sell': 'gtc'}
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_currency: USDT
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using stake_amount: 100.0
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using startup_candle_count: 0
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using unfilledtimeout: {'buy': 10, 'sell': 30}
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using use_sell_signal: True
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_only: False
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_roi_if_buy_signal: False
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using sell_profit_offset: 0.0
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using disable_dataframe_checks: False
|
||||
2021-02-28 20:54:24,886 - freqtrade.resolvers.strategy_resolver - INFO - Strategy using ignore_buying_expired_candle_after: 0
|
||||
2021-02-28 20:54:24,887 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
|
||||
2021-02-28 20:54:24,889 - freqtrade.resolvers.iresolver - INFO - Using resolved pairlist StaticPairList from '/home/crypto_rahino/freqtrade/freqtrade/plugins/pairlist/StaticPairList.py'...
|
||||
2021-02-28 20:54:24,898 - freqtrade.resolvers.iresolver - INFO - Using resolved hyperopt hyper_ethusdt2 from '/home/crypto_rahino/freqtrade/user_data/hyperopts/hyper_ethusdt2.py'...
|
||||
2021-02-28 20:54:24,898 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_indicators() method. Using populate_indicators from the strategy.
|
||||
2021-02-28 20:54:24,898 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_buy_trend() method. Using populate_buy_trend from the strategy.
|
||||
2021-02-28 20:54:24,898 - freqtrade.resolvers.hyperopt_resolver - INFO - Hyperopt class does not provide populate_sell_trend() method. Using populate_sell_trend from the strategy.
|
||||
2021-02-28 20:54:24,907 - freqtrade.resolvers.iresolver - INFO - Using resolved hyperoptloss SharpeHyperOptLoss from '/home/crypto_rahino/freqtrade/freqtrade/optimize/hyperopt_loss_sharpe.py'...
|
||||
2021-02-28 20:54:24,908 - freqtrade.optimize.hyperopt - INFO - Using optimizer random state: 32325
|
||||
2021-02-28 20:54:24,966 - numexpr.utils - INFO - NumExpr defaulting to 4 threads.
|
||||
2021-02-28 20:54:25,041 - freqtrade.data.converter - INFO - Missing data fillup for ETH/USDT: before: 18908 - after: 18954
|
||||
2021-02-28 20:54:25,042 - freqtrade.optimize.backtesting - INFO - Loading data from 2019-01-01 00:00:00 up to 2021-02-28 17:00:00 (789 days)..
|
||||
2021-02-28 20:54:25,133 - freqtrade.optimize.hyperopt - INFO - Hyperopting with data from 2019-01-01 00:00:00 up to 2021-02-28 17:00:00 (789 days)..
|
||||
2021-02-28 20:54:25,139 - freqtrade.optimize.hyperopt - INFO - Found 4 CPU cores. Let's make them scream!
|
||||
2021-02-28 20:54:25,139 - freqtrade.optimize.hyperopt - INFO - Number of parallel jobs set as: -1
|
||||
2021-02-28 20:54:25,184 - freqtrade.optimize.hyperopt - INFO - Effective number of parallel workers used: 4
|
||||
+--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------|
|
||||
| * Best | 2/300 | 2235 | 895 120 1220 | -0.20% | -441.54732382 USDT (-441.11%) | 790.9 m | 5.51805 |
|
||||
| * Best | 6/300 | 788 | 341 389 58 | 0.20% | 155.51998858 USDT (155.36%) | 3,753.7 m | -0.4659 |
|
||||
| * Best | 13/300 | 738 | 382 232 124 | 0.50% | 372.56940254 USDT (372.20%) | 3,831.4 m | -1.16905 |
|
||||
| * Best | 19/300 | 1044 | 474 105 465 | 0.33% | 341.31744129 USDT (340.98%) | 1,497.9 m | -1.68198 |
|
||||
| * Best | 25/300 | 709 | 360 308 41 | 0.94% | 668.46193419 USDT (667.79%) | 4,734.6 m | -2.16973 |
|
||||
| Best | 207/300 | 782 | 427 304 51 | 0.82% | 638.26843226 USDT (637.63%) | 3,986.9 m | -2.28832 |
|
||||
[Epoch 300 of 300 (100%)] || | [Time: 0:12:33, Elapsed Time: 0:12:33]
|
||||
2021-02-28 21:07:07,336 - freqtrade.optimize.hyperopt - INFO - 300 epochs saved to '/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_results_2021-02-28_20-54-24.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
207/300: 782 trades. 427/304/51 Wins/Draws/Losses. Avg profit 0.82%. Median profit 1.26%. Total profit 638.26843226 USDT ( 637.63Σ%). Avg duration 3986.9 min. Objective: -2.28832
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_tsf_mid-enabled': True,
|
||||
'angle_tsf_mid-value': 31,
|
||||
'ao-enabled': False,
|
||||
'ao1-value': 49,
|
||||
'ao2-value': 37,
|
||||
'rsi-enabled': False,
|
||||
'rsi1-value': 9,
|
||||
'rsi2-value': 79,
|
||||
'trigger': 'ao_cross_dw'
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_tsf_mid-enabled': True,
|
||||
'angle_tsf_mid-value_sell': 83,
|
||||
'ao-enabled': False,
|
||||
'ao1-value_sell': -11,
|
||||
'ao2-value_sell': 20,
|
||||
'rsi-enabled': False,
|
||||
'rsi1-value_sell': 16,
|
||||
'rsi2-value_sell': 77,
|
||||
'trigger': 'ao_cross_dw'
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.0681,
|
||||
"976": 0.05144,
|
||||
"1656": 0.01257,
|
||||
"1963": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.22706
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.27174
|
||||
trailing_stop_positive_offset = 0.29437
|
||||
trailing_only_offset_is_reached = Fals
|
119
.env/bin/user_data/hyperopt_results/ethusdt2_360_results
Normal file
119
.env/bin/user_data/hyperopt_results/ethusdt2_360_results
Normal file
@ -0,0 +1,119 @@
|
||||
+--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------|
|
||||
| * Best | 1/300 | 1 | 1 0 0 | 1.87% | 0.01873046 USDT (1.87%) | 79.0 m | 0.99376 |
|
||||
| * Best | 10/300 | 1 | 1 0 0 | 8.07% | 0.08076779 USDT (8.07%) | 43.0 m | 0.9731 |
|
||||
/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:688: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
|
||||
warnings.warn(
|
||||
| * Best | 14/300 | 64 | 26 36 2 | 0.35% | 0.22444174 USDT (22.42%) | 562.1 m | 0.92526 |
|
||||
/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:688: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
|
||||
warnings.warn(
|
||||
| * Best | 18/300 | 34 | 23 11 0 | 1.66% | 0.56510634 USDT (56.45%) | 95.7 m | 0.81182 |
|
||||
/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/site-packages/joblib/externals/loky/process_executor.py:688: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
|
||||
warnings.warn(
|
||||
Exception ignored in: <function Exchange.__del__ at 0x7fda640b90d0>
|
||||
[Epoch 68 of 300 ( 22%)] |████████████████████████/ | [ETA: 0:59:50, Elapsed Time: 0:17:32]2021-02-19 14:13:21,283 - ccxt.base.exchange - WARNING - binance requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
|
||||
2021-02-19 14:13:21,285 - asyncio - ERROR - Unclosed client session
|
||||
client_session: <aiohttp.client.ClientSession object at 0x7fda44883f40>
|
||||
2021-02-19 14:13:21,286 - asyncio - ERROR - Unclosed connector
|
||||
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fda457e62e0>, 18883.246767892)]']
|
||||
connector: <aiohttp.connector.TCPConnector object at 0x7fda44883f70>
|
||||
Traceback (most recent call last):
|
||||
File "/home/crypto_rahino/freqtrade/freqtrade/exchange/exchange.py", line 145, in __del__
|
||||
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
||||
File "/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/asyncio/events.py", line 642, in get_event_loop
|
||||
raise RuntimeError('There is no current event loop in thread %r.'
|
||||
RuntimeError: There is no current event loop in thread 'QueueFeederThread'.
|
||||
| Best | 70/300 | 110 | 68 35 7 | 0.56% | 0.61298127 USDT (61.24%) | 245.8 m | 0.79588 |
|
||||
| Best | 149/300 | 474 | 248 206 20 | 0.39% | 1.86796545 USDT (186.61%) | 393.6 m | 0.37797 |
|
||||
[Epoch 300 of 300 (100%)] || | [Time: 2:00:50, Elapsed Time: 2:00:50]
|
||||
2021-02-19 15:56:39,657 - freqtrade.optimize.hyperopt - INFO - 300 epochs saved to '/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_results_2021-02-19_13-55-11.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
149/300: 474 trades. 248/206/20 Wins/Draws/Losses. Avg profit 0.39%. Median profit 0.20%. Total profit 1.86796545 USDT ( 186.61Σ%). Avg duration 393.6 min. Objective: 0.37797
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value': -11,
|
||||
'angle_short-enabled': True,
|
||||
'angle_short-value': -40,
|
||||
'correl_angle_long_close-enabled': False,
|
||||
'correl_angle_long_close-value': 0.80594,
|
||||
'correl_angle_short_close-enabled': True,
|
||||
'correl_angle_short_close-value': -0.23132,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value': 0.00945,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.42804,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value': 0.12126,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value': 0.54723,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value': 0.6971,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value': -0.52876,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value': 1,
|
||||
'mfi-enabled': False,
|
||||
'mfi-value': 32,
|
||||
'trigger': 'bol_high',
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value': -67,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value': 2
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value_sell': 31,
|
||||
'angle_short-enabled': True,
|
||||
'angle_short-value_sell': 36,
|
||||
'correl_angle_long_close-enabled': False,
|
||||
'correl_angle_long_close-value_sell': -0.82504,
|
||||
'correl_angle_short_close-enabled': True,
|
||||
'correl_angle_short_close-value_sell': 0.72362,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value_sell': -0.57569,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': 0.40219,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value_sell': 0.36141,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value_sell': -0.6346,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value_sell': -0.72611,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value_sell': -0.74928,
|
||||
'macd-enabled': True,
|
||||
'macdhist-value_sell': -4,
|
||||
'mfi-enabled': False,
|
||||
'mfi-value_sell': 78,
|
||||
'trigger': 'bol_high',
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value_sell': 90,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value_sell': -71
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.14689,
|
||||
"23": 0.07987,
|
||||
"40": 0.03243,
|
||||
"136": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.18934
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.02891
|
||||
trailing_stop_positive_offset = 0.05001
|
||||
trailing_only_offset_is_reached = True
|
||||
|
@ -0,0 +1,121 @@
|
||||
+--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------|
|
||||
| * Best | 30/300 | 527 | 287 186 54 | 0.18% | 0.95172018 USDT (95.08%) | 820.9 m | -0.7889 |
|
||||
| Best | 43/300 | 386 | 225 130 31 | 0.32% | 1.25468221 USDT (125.34%) | 399.1 m | -1.50724 |
|
||||
| Best | 92/300 | 132 | 91 37 4 | 1.45% | 1.91635024 USDT (191.44%) | 158.7 m | -1.796 |
|
||||
| Best | 100/300 | 684 | 372 291 21 | 0.26% | 1.76455458 USDT (176.28%) | 679.4 m | -1.91233 |
|
||||
| Best | 131/300 | 1936 | 1108 692 136 | 0.25% | 4.85130056 USDT (484.65%) | 1,201.8 m | -2.79078 |
|
||||
| Best | 270/300 | 8 | 6 2 0 | 0.28% | 0.02219733 USDT (2.22%) | 2,454.4 m | -9,004.65032 |
|
||||
[Epoch 300 of 300 (100%)] || | [Time: 1:23:04, Elapsed Time: 1:23:04]
|
||||
2021-02-08 01:20:27,607 - freqtrade.optimize.hyperopt - INFO - 300 epochs saved to '/home/yakov/PycharmProjects/freqtrade/.env/bin/user_data/hyperopt_results/hyperopt_results_2021-02-07_23-57-04.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
270/300: 8 trades. 6/2/0 Wins/Draws/Losses. Avg profit 0.28%. Median profit 0.16%. Total profit 0.02219733 USDT ( 2.22Σ%). Avg duration 2454.4 min. Objective: -9004.65032
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value': 69,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value': -30,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value': -51,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value': 0.01945,
|
||||
'correl_angle_mid_close-enabled': True,
|
||||
'correl_angle_mid_close-value': 0.80691,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value': 0.79822,
|
||||
'correl_close_last_close-enabled': True,
|
||||
'correl_close_last_close-value': 0.13071,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.99955,
|
||||
'correl_hist_close-enabled': True,
|
||||
'correl_hist_close-value': -0.4257,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value': -0.05654,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value': 0.08529,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value': 0.98883,
|
||||
'correl_tsf_short_close-enabled': True,
|
||||
'correl_tsf_short_close-value': -0.74093,
|
||||
'ema-enabled': True,
|
||||
'ema-value': -0.22445,
|
||||
'macd-enabled': False,
|
||||
'macd-value': 0.31501,
|
||||
'macdhist-value': 0.4072,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value': 0.8919,
|
||||
'trigger': 'ma_cross',
|
||||
'tsf_long-enabled': False,
|
||||
'tsf_long-value': 46,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value': -50,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value': 68
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value_sell': -74,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value_sell': -29,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value_sell': 89,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value_sell': -0.31549,
|
||||
'correl_angle_mid_close-enabled': True,
|
||||
'correl_angle_mid_close-value_sell': 0.12343,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value_sell': 0.75309,
|
||||
'correl_close_last_close-enabled': True,
|
||||
'correl_close_last_close-value_sell': 0.895,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': -0.90613,
|
||||
'correl_hist_close-enabled': True,
|
||||
'correl_hist_close-value_sell': 0.4866,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value_sell': 0.50188,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value_sell': 0.04306,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value_sell': -0.33186,
|
||||
'correl_tsf_short_close-enabled': True,
|
||||
'correl_tsf_short_close-value_sell': -0.25287,
|
||||
'ema-enabled': True,
|
||||
'ema-value_sell': 0.88304,
|
||||
'macd-enabled': False,
|
||||
'macd-value_sell': -0.49075,
|
||||
'macdhist-value_sell': -0.19491,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value_sell': 0.63614,
|
||||
'trigger': 'ma_cross',
|
||||
'tsf_long-enabled': False,
|
||||
'tsf_long-value_sell': -52,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value_sell': 12,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value_sell': 84
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.21377,
|
||||
"22": 0.08011,
|
||||
"72": 0.01195,
|
||||
"150": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.23077
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.26744
|
||||
trailing_stop_positive_offset = 0.31499
|
||||
trailing_only_offset_is_reached = True
|
@ -0,0 +1,122 @@
|
||||
+--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------|
|
||||
| * Best | 9/500 | 1 | 1 0 0 | 3.20% | 0.03207524 USDT
|
||||
| * Best | 11/500 | 10 | 8 1 1 | 1.91% | 0.19162864 USDT (19.14%) | 96.1 m | -0.04427 |
|
||||
| Best | 34/500 | 3 | 3 0 0 | 7.38% | 0.22165792 USDT (22.14%) | 25.7 m | -0.12983 |
|
||||
| Best | 40/500 | 27 | 19 1 7 | 1.60% | 0.43147803 USDT (43.10%) | 82.6 m | -0.14711 |
|
||||
| Best | 85/500 | 28 | 22 6 0 | 3.83% | 1.07257599 USDT (107.15%) | 88.2 m | -0.67739 |
|
||||
| Best | 465/500 | 29 | 28 1 0 | 3.68% | 1.06848739 USDT (106.74%) | 50.7 m | -0.88123 |
|
||||
[Epoch 500 of 500 (100%)] || | [Time: 2:33:04, Elapsed Time: 2:33:04]
|
||||
2021-02-06 20:14:22,295 - freqtrade.optimize.hyperopt - INFO - 500 epochs saved to '/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_results_2021-02-06_17-40-43.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
465/500: 29 trades. 28/1/0 Wins/Draws/Losses. Avg profit 3.68%. Median profit 2.96%. Total profit 1.06848739 USDT ( 106.74Σ%). Avg duration 50.7 min. Objective: -0.88123
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value': 48,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value': -81,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value': 81,
|
||||
'correl_angle_long_close-enabled': False,
|
||||
'correl_angle_long_close-value': 0.48169,
|
||||
'correl_angle_mid_close-enabled': False,
|
||||
'correl_angle_mid_close-value': 0.43412,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value': -0.81921,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value': -0.5165,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.3266,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value': 0.10357,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value': -0.09038,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value': 0.63061,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value': 0.88061,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value': 0.54129,
|
||||
'ema-enabled': True,
|
||||
'ema-value': 0.77515,
|
||||
'macd-enabled': False,
|
||||
'macd-value': -0.99604,
|
||||
'macdhist-value': -0.64655,
|
||||
'mfi-enabled': False,
|
||||
'mfi-value': -0.80583,
|
||||
'trigger': 'bol_low',
|
||||
'tsf_long-enabled': False,
|
||||
'tsf_long-value': 13,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value': -5,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value': -78
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value_sell': -62,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value_sell': -32,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value_sell': -88,
|
||||
'correl_angle_long_close-enabled': False,
|
||||
'correl_angle_long_close-value_sell': -0.79045,
|
||||
'correl_angle_mid_close-enabled': False,
|
||||
'correl_angle_mid_close-value_sell': -0.54329,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value_sell': -0.72088,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value_sell': 0.77057,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': -0.51244,
|
||||
'correl_hist_close-enabled': False,
|
||||
'correl_hist_close-value_sell': 0.32559,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value_sell': 0.54261,
|
||||
'correl_tsf_long_close-enabled': False,
|
||||
'correl_tsf_long_close-value_sell': 0.97774,
|
||||
'correl_tsf_mid_close-enabled': False,
|
||||
'correl_tsf_mid_close-value_sell': -0.12538,
|
||||
'correl_tsf_short_close-enabled': False,
|
||||
'correl_tsf_short_close-value_sell': -0.02653,
|
||||
'ema-enabled': True,
|
||||
'ema-value_sell': 0.85393,
|
||||
'macd-enabled': False,
|
||||
'macd-value_sell': 0.60307,
|
||||
'macdhist-value_sell': 0.66489,
|
||||
'mfi-enabled': False,
|
||||
'mfi-value_sell': 0.04703,
|
||||
'trigger': 'bol_low',
|
||||
'tsf_long-enabled': False,
|
||||
'tsf_long-value_sell': -44,
|
||||
'tsf_mid-enabled': False,
|
||||
'tsf_mid-value_sell': 41,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value_sell': 25
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.17601,
|
||||
"15": 0.05004,
|
||||
"39": 0.02337,
|
||||
"158": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.19269
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.3265
|
||||
trailing_stop_positive_offset = 0.34828
|
||||
trailing_only_offset_is_reached = True
|
||||
|
@ -0,0 +1,138 @@
|
||||
|
||||
+--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------+
|
||||
| Best | Epoch | Trades | Win Draw Loss | Avg profit | Profit | Avg duration | Objective |
|
||||
|--------+---------+----------+------------------+--------------+-------------------------------+----------------+-------------|
|
||||
| * Best | 3/500 | 1 | 0 1 0 | 0.00% | -- | 419.0 m | 20 |
|
||||
| * Best | 4/500 | 3754 | 1384 399 1971 | -0.18% | -6.72272549 USDT (-671.60%) | 121.9 m | 10.8055 |
|
||||
Exception ignored in: <function Exchange.__del__ at 0x7fb607d270d0>
|
||||
[Epoch 4 of 500 ( 0%)] |\ | [ETA: 0:00:26, Elapsed Time: 0:00:00]2021-02-06 14:40:46,035 - ccxt.base.exchange - WARNING - binance requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add exchange.close() to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).
|
||||
2021-02-06 14:40:46,036 - asyncio - ERROR - Unclosed client session
|
||||
client_session: <aiohttp.client.ClientSession object at 0x7fb5e8568a90>
|
||||
2021-02-06 14:40:46,037 - asyncio - ERROR - Unclosed connector
|
||||
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fb5e93dd700>, 628.93462627)]']
|
||||
connector: <aiohttp.connector.TCPConnector object at 0x7fb5e85685e0>
|
||||
Traceback (most recent call last):
|
||||
File "/home/crypto_rahino/freqtrade/freqtrade/exchange/exchange.py", line 145, in __del__
|
||||
asyncio.get_event_loop().run_until_complete(self._api_async.close())
|
||||
File "/home/crypto_rahino/anaconda3/envs/freqtrade-conda/lib/python3.9/asyncio/events.py", line 642, in get_event_loop
|
||||
raise RuntimeError('There is no current event loop in thread %r.'
|
||||
RuntimeError: There is no current event loop in thread 'QueueFeederThread'.
|
||||
| * Best | 6/500 | 58 | 27 6 25 | 0.07% | 0.03832727 USDT (3.83%) | 92.8 m | -0.01122 |
|
||||
| Best | 36/500 | 509 | 259 178 72 | 0.06% | 0.31490048 USDT (31.46%) | 277.4 m | -0.02974 |
|
||||
| Best | 46/500 | 4 | 3 0 1 | 3.65% | 0.14631439 USDT (14.62%) | 14.5 m | -0.06469 |
|
||||
| Best | 50/500 | 755 | 385 220 150 | 0.09% | 0.71414894 USDT (71.34%) | 62.6 m | -0.29416 |
|
||||
| Best | 53/500 | 10 | 7 1 2 | 1.23% | 0.12302166 USDT (12.29%) | 61.3 m | -0.33487 |
|
||||
[Epoch 81 of 500 ( 16%)] |█████████████████- | [ETA: 1:19:36, Elapsed Time: 0:15:2 [E [Epoch 93 of 500 ( 18%)] |███████████████████/ | [ETA: 1:25:44, Elapsed Time: 0:1| Best | 146/500 | 12 | 10 1 1 | 2.37% | 0.28436729 USDT (28.41%) | 69.3 m | -0.9252 |
|
||||
[Epoch 500 of 500 (100%)] || | [Time: 2:47:19, Elapsed Time: 2:47:19]
|
||||
2021-02-06 17:28:05,529 - freqtrade.optimize.hyperopt - INFO - 500 epochs saved to '/home/crypto_rahino/freqtrade/user_data/hyperopt_results/hyperopt_results_2021-02-06_14-39-46.pickle'.
|
||||
|
||||
Best result:
|
||||
|
||||
146/500: 12 trades. 10/1/1 Wins/Draws/Losses. Avg profit 2.37%. Median profit 3.13%. Total profit 0.28436729 USDT ( 28.41Σ%). Avg duration 69.3 min. Objective: -0.92520
|
||||
|
||||
|
||||
# Buy hyperspace params:
|
||||
buy_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value': 35,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value': -90,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value': 40,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value': 0.62864,
|
||||
'correl_angle_mid_close-enabled': False,
|
||||
'correl_angle_mid_close-value': 0.53883,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value': -0.64865,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value': -0.70565,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value': 0.2461,
|
||||
'correl_hist_close-enabled': True,
|
||||
'correl_hist_close-value': -0.47549,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value': 0.24276,
|
||||
'correl_tsf_long_close-enabled': True,
|
||||
'correl_tsf_long_close-value': 0.04288,
|
||||
'correl_tsf_mid_close-enabled': True,
|
||||
'correl_tsf_mid_close-value': 0.85552,
|
||||
'correl_tsf_short_close-enabled': True,
|
||||
'correl_tsf_short_close-value': -0.03676,
|
||||
'ema-enabled': False,
|
||||
'ema-value': -0.81462,
|
||||
'macd-enabled': True,
|
||||
'macd-value': -0.24225,
|
||||
'macdhist-value': 0.18187,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value': -0.10135,
|
||||
'trigger': 'mfi',
|
||||
'tsf_long-enabled': True,
|
||||
'tsf_long-value': 26,
|
||||
'tsf_mid-enabled': True,
|
||||
'tsf_mid-value': -28,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value': 41
|
||||
}
|
||||
|
||||
# Sell hyperspace params:
|
||||
sell_params = {
|
||||
'angle_long-enabled': False,
|
||||
'angle_long-value_sell': -79,
|
||||
'angle_mid-enabled': True,
|
||||
'angle_mid-value_sell': -43,
|
||||
'angle_short-enabled': False,
|
||||
'angle_short-value_sell': -32,
|
||||
'correl_angle_long_close-enabled': True,
|
||||
'correl_angle_long_close-value_sell': -0.95367,
|
||||
'correl_angle_mid_close-enabled': False,
|
||||
'correl_angle_mid_close-value_sell': -0.49912,
|
||||
'correl_angle_short_close-enabled': False,
|
||||
'correl_angle_short_close-value_sell': -0.48721,
|
||||
'correl_close_last_close-enabled': False,
|
||||
'correl_close_last_close-value_sell': 0.39565,
|
||||
'correl_h_l-enabled': True,
|
||||
'correl_h_l-value_sell': 0.00872,
|
||||
'correl_hist_close-enabled': True,
|
||||
'correl_hist_close-value_sell': -0.78322,
|
||||
'correl_mfi_close-enabled': False,
|
||||
'correl_mfi_close-value_sell': -0.49244,
|
||||
'correl_tsf_long_close-enabled': True,
|
||||
'correl_tsf_long_close-value_sell': -0.23956,
|
||||
'correl_tsf_mid_close-enabled': True,
|
||||
'correl_tsf_mid_close-value_sell': 0.13165,
|
||||
'correl_tsf_short_close-enabled': True,
|
||||
'correl_tsf_short_close-value_sell': 0.55515,
|
||||
'ema-enabled': False,
|
||||
'ema-value_sell': 0.13069,
|
||||
'macd-enabled': True,
|
||||
'macd-value_sell': 0.41516,
|
||||
'macdhist-value_sell': -0.21624,
|
||||
'mfi-enabled': True,
|
||||
'mfi-value_sell': 0.76911,
|
||||
'trigger': 'mfi',
|
||||
'tsf_long-enabled': True,
|
||||
'tsf_long-value_sell': -56,
|
||||
'tsf_mid-enabled': True,
|
||||
'tsf_mid-value_sell': 4,
|
||||
'tsf_short-enabled': False,
|
||||
'tsf_short-value_sell': -78
|
||||
}
|
||||
|
||||
# ROI table:
|
||||
minimal_roi = {
|
||||
"0": 0.06009,
|
||||
"10": 0.04274,
|
||||
"42": 0.03274,
|
||||
"90": 0
|
||||
}
|
||||
|
||||
# Stoploss:
|
||||
stoploss = -0.12967
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.17644
|
||||
trailing_stop_positive_offset = 0.19954
|
||||
trailing_only_offset_is_reached = False
|
||||
|
168
.env/bin/user_data/hyperopts/advanced.py
Normal file
168
.env/bin/user_data/hyperopts/advanced.py
Normal file
@ -0,0 +1,168 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class advanced(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(dataframe['mfi'] < params['mfi-value'])
|
||||
if params.get('fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] < params['fastd-value'])
|
||||
if params.get('adx-enabled'):
|
||||
conditions.append(dataframe['adx'] > params['adx-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] < params['rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'bb_lower':
|
||||
conditions.append(dataframe['close'] < dataframe['bb_lowerband'])
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['sar']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 25, name='mfi-value'),
|
||||
Integer(15, 45, name='fastd-value'),
|
||||
Integer(20, 50, name='adx-value'),
|
||||
Integer(20, 40, name='rsi-value'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='fastd-enabled'),
|
||||
Categorical([True, False], name='adx-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['bb_lower', 'macd_cross_signal', 'sar_reversal'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('sell-mfi-enabled'):
|
||||
conditions.append(dataframe['mfi'] > params['sell-mfi-value'])
|
||||
if params.get('sell-fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] > params['sell-fastd-value'])
|
||||
if params.get('sell-adx-enabled'):
|
||||
conditions.append(dataframe['adx'] < params['sell-adx-value'])
|
||||
if params.get('sell-rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] > params['sell-rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['sell-trigger'] == 'sell-bb_upper':
|
||||
conditions.append(dataframe['close'] > dataframe['bb_upperband'])
|
||||
if params['sell-trigger'] == 'sell-macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macdsignal'], dataframe['macd']
|
||||
))
|
||||
if params['sell-trigger'] == 'sell-sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(75, 100, name='sell-mfi-value'),
|
||||
Integer(50, 100, name='sell-fastd-value'),
|
||||
Integer(50, 100, name='sell-adx-value'),
|
||||
Integer(60, 100, name='sell-rsi-value'),
|
||||
Categorical([True, False], name='sell-mfi-enabled'),
|
||||
Categorical([True, False], name='sell-fastd-enabled'),
|
||||
Categorical([True, False], name='sell-adx-enabled'),
|
||||
Categorical([True, False], name='sell-rsi-enabled'),
|
||||
Categorical(['sell-bb_upper',
|
||||
'sell-macd_cross_signal',
|
||||
'sell-sar_reversal'], name='sell-trigger')
|
||||
]
|
304
.env/bin/user_data/hyperopts/advanced_hyper.py
Normal file
304
.env/bin/user_data/hyperopts/advanced_hyper.py
Normal file
@ -0,0 +1,304 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
# isort: skip_file
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class AdvancedSampleHyperOpt(IHyperOpt):
|
||||
"""
|
||||
This is a sample hyperopt to inspire you.
|
||||
Feel free to customize it.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Rename the class name to some unique name.
|
||||
- Add any methods you want to build your hyperopt.
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need the
|
||||
'roi' and the 'stoploss' spaces that differ from the defaults offered by Freqtrade.
|
||||
|
||||
This sample illustrates how to override these methods.
|
||||
"""
|
||||
# @staticmethod
|
||||
# def populate_indicators(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
# """
|
||||
# This method can also be loaded from the strategy, if it doesn't exist in the hyperopt class.
|
||||
# """
|
||||
# dataframe['adx'] = ta.ADX(dataframe)
|
||||
# macd = ta.MACD(dataframe)
|
||||
# dataframe['macd'] = macd['macd']
|
||||
# dataframe['macdsignal'] = macd['macdsignal']
|
||||
# dataframe['mfi'] = ta.MFI(dataframe)
|
||||
# dataframe['rsi'] = ta.RSI(dataframe)
|
||||
# stoch_fast = ta.STOCHF(dataframe)
|
||||
# dataframe['fastd'] = stoch_fast['fastd']
|
||||
# dataframe['minus_di'] = ta.MINUS_DI(dataframe)
|
||||
# # Bollinger bands
|
||||
# bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
|
||||
# dataframe['bb_lowerband'] = bollinger['lower']
|
||||
# dataframe['bb_upperband'] = bollinger['upper']
|
||||
# dataframe['sar'] = ta.SAR(dataframe)
|
||||
# return dataframe
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by hyperopt
|
||||
"""
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use
|
||||
"""
|
||||
conditions = []
|
||||
# GUARDS AND TRENDS
|
||||
if 'mfi-enabled' in params and params['mfi-enabled']:
|
||||
conditions.append(dataframe['mfi'] < params['mfi-value'])
|
||||
if 'fastd-enabled' in params and params['fastd-enabled']:
|
||||
conditions.append(dataframe['fastd'] < params['fastd-value'])
|
||||
if 'adx-enabled' in params and params['adx-enabled']:
|
||||
conditions.append(dataframe['adx'] > params['adx-value'])
|
||||
if 'rsi-enabled' in params and params['rsi-enabled']:
|
||||
conditions.append(dataframe['rsi'] < params['rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'bb_midd':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['close'], dataframe['bb_middleband']))
|
||||
if params['trigger'] == 'bb_low':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['close'], dataframe['bb_lowerband']))
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
|
||||
# Check that volume is not 0
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching strategy parameters
|
||||
"""
|
||||
return [
|
||||
Integer(10, 25, name='mfi-value'),
|
||||
Integer(15, 45, name='fastd-value'),
|
||||
Integer(20, 50, name='adx-value'),
|
||||
Integer(20, 40, name='rsi-value'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='fastd-enabled'),
|
||||
Categorical([True, False], name='adx-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['bb_lower', 'macd_cross_signal', 'sar_reversal'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by hyperopt
|
||||
"""
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use
|
||||
"""
|
||||
# print(params)
|
||||
conditions = []
|
||||
# GUARDS AND TRENDS
|
||||
if 'sell-mfi-enabled' in params and params['sell-mfi-enabled']:
|
||||
conditions.append(dataframe['mfi'] > params['sell-mfi-value'])
|
||||
if 'sell-fastd-enabled' in params and params['sell-fastd-enabled']:
|
||||
conditions.append(dataframe['fastd'] > params['sell-fastd-value'])
|
||||
if 'sell-adx-enabled' in params and params['sell-adx-enabled']:
|
||||
conditions.append(dataframe['adx'] < params['sell-adx-value'])
|
||||
if 'sell-rsi-enabled' in params and params['sell-rsi-enabled']:
|
||||
conditions.append(dataframe['rsi'] > params['sell-rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['sell-trigger'] == 'sell-bb_upper':
|
||||
conditions.append(dataframe['close'] > dataframe['bb_upperband'])
|
||||
if params['sell-trigger'] == 'sell-macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macdsignal'], dataframe['macd']
|
||||
))
|
||||
if params['sell-trigger'] == 'sell-sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
|
||||
# Check that volume is not 0
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters
|
||||
"""
|
||||
return [
|
||||
Integer(75, 100, name='sell-mfi-value'),
|
||||
Integer(50, 100, name='sell-fastd-value'),
|
||||
Integer(50, 100, name='sell-adx-value'),
|
||||
Integer(60, 100, name='sell-rsi-value'),
|
||||
Categorical([True, False], name='sell-mfi-enabled'),
|
||||
Categorical([True, False], name='sell-fastd-enabled'),
|
||||
Categorical([True, False], name='sell-adx-enabled'),
|
||||
Categorical([True, False], name='sell-rsi-enabled'),
|
||||
Categorical(['sell-bb_upper',
|
||||
'sell-macd_cross_signal',
|
||||
'sell-sar_reversal'], name='sell-trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.35, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators.
|
||||
Can be a copy of the corresponding method from the strategy,
|
||||
or will be loaded from the strategy.
|
||||
Must align to populate_indicators used (either from this File, or from the strategy)
|
||||
Only used when --spaces does not include buy
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(dataframe['close'] < dataframe['bb_lowerband']) &
|
||||
(dataframe['mfi'] < 16) &
|
||||
(dataframe['adx'] > 25) &
|
||||
(dataframe['rsi'] < 21)
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators.
|
||||
Can be a copy of the corresponding method from the strategy,
|
||||
or will be loaded from the strategy.
|
||||
Must align to populate_indicators used (either from this File, or from the strategy)
|
||||
Only used when --spaces does not include sell
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(
|
||||
dataframe['macdsignal'], dataframe['macd']
|
||||
)) &
|
||||
(dataframe['fastd'] > 54)
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
168
.env/bin/user_data/hyperopts/full_hyper.py
Normal file
168
.env/bin/user_data/hyperopts/full_hyper.py
Normal file
@ -0,0 +1,168 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class full_hyper(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(dataframe['mfi'] < params['mfi-value'])
|
||||
if params.get('fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] < params['fastd-value'])
|
||||
if params.get('adx-enabled'):
|
||||
conditions.append(dataframe['adx'] > params['adx-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] < params['rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'bb_lower':
|
||||
conditions.append(dataframe['close'] < dataframe['bb_lowerband'])
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['sar']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 25, name='mfi-value'),
|
||||
Integer(15, 45, name='fastd-value'),
|
||||
Integer(20, 50, name='adx-value'),
|
||||
Integer(20, 40, name='rsi-value'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='fastd-enabled'),
|
||||
Categorical([True, False], name='adx-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['bb_lower', 'macd_cross_signal', 'sar_reversal'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('sell-mfi-enabled'):
|
||||
conditions.append(dataframe['mfi'] > params['sell-mfi-value'])
|
||||
if params.get('sell-fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] > params['sell-fastd-value'])
|
||||
if params.get('sell-adx-enabled'):
|
||||
conditions.append(dataframe['adx'] < params['sell-adx-value'])
|
||||
if params.get('sell-rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] > params['sell-rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['sell-trigger'] == 'sell-bb_upper':
|
||||
conditions.append(dataframe['close'] > dataframe['bb_upperband'])
|
||||
if params['sell-trigger'] == 'sell-macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macdsignal'], dataframe['macd']
|
||||
))
|
||||
if params['sell-trigger'] == 'sell-sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(75, 100, name='sell-mfi-value'),
|
||||
Integer(50, 100, name='sell-fastd-value'),
|
||||
Integer(50, 100, name='sell-adx-value'),
|
||||
Integer(60, 100, name='sell-rsi-value'),
|
||||
Categorical([True, False], name='sell-mfi-enabled'),
|
||||
Categorical([True, False], name='sell-fastd-enabled'),
|
||||
Categorical([True, False], name='sell-adx-enabled'),
|
||||
Categorical([True, False], name='sell-rsi-enabled'),
|
||||
Categorical(['sell-bb_upper',
|
||||
'sell-macd_cross_signal',
|
||||
'sell-sar_reversal'], name='sell-trigger')
|
||||
]
|
393
.env/bin/user_data/hyperopts/hyper1.py
Normal file
393
.env/bin/user_data/hyperopts/hyper1.py
Normal file
@ -0,0 +1,393 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper1(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_long']) > params['tsf_long-value'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value'] < dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value'] < (dataframe['close'] - dataframe['ema']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value'] < (dataframe['ema'] - dataframe['middleband']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value'] < dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_low':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['lowerband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ma'], dataframe['ema']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['mfi'], 25))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='tsf_long-value'),
|
||||
Integer(-100, 100, name='tsf_mid-value'),
|
||||
Integer(-100, 100, name='tsf_short-value'),
|
||||
Integer(-50, 50, name='angle_short-value'),
|
||||
Integer(-50, 50, name='angle_long-value'),
|
||||
Integer(-50, 50, name='angle_mid-value'),
|
||||
Real(0, 1, name='correl_h_l-value'),
|
||||
Real(-1, 1, name='correl_close_last_close-value'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value'),
|
||||
Real(0, 1, name='correl_angle_long_close-value'),
|
||||
Real(-1, 1, name='correl_hist_close-value'),
|
||||
Real(-1, 1, name='correl_mfi_close-value'),
|
||||
Integer(10, 60, name='mfi-value'),
|
||||
Integer(-50, 50, name='ema-value'),
|
||||
Integer(-50, 50, name='ema_bol-value'),
|
||||
Integer(-1, 5, name='macdhist-value'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_low', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['tsf_long'] - dataframe['close']) > params['tsf_long-value_sell'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value_sell'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value_sell'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value_sell'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value_sell'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value_sell'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value_sell'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value_sell'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value_sell'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value_sell'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value_sell'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value_sell'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value_sell'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value_sell'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value_sell'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value_sell'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value_sell'] > dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value_sell'] < (dataframe['ema'] - dataframe['close']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value_sell'] < (dataframe['middleband'] - dataframe['ema']))
|
||||
conditions.append(params['macdhist-value_sell'] > dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_high':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['upperband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ema'], dataframe['middleband']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['mfi'], 60))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='tsf_long-value_sell'),
|
||||
Integer(-100, 100, name='tsf_mid-value_sell'),
|
||||
Integer(-100, 100, name='tsf_short-value_sell'),
|
||||
Integer(-50, 50, name='angle_short-value_sell'),
|
||||
Integer(-50, 50, name='angle_long-value_sell'),
|
||||
Integer(-50, 50, name='angle_mid-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l-value_sell'),
|
||||
Real(-1, 1, name='correl_close_last_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_hist_close-value_sell'),
|
||||
Real(-1, 1, name='correl_mfi_close-value_sell'),
|
||||
Integer(40, 100, name='mfi-value_sell'),
|
||||
Integer(-5, 50, name='ema-value_sell'),
|
||||
Integer(-5, 50, name='ema_bol-value_sell'),
|
||||
Integer(-10, 20, name='macdhist-value_sell'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_high', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
393
.env/bin/user_data/hyperopts/hyper1_1.py
Normal file
393
.env/bin/user_data/hyperopts/hyper1_1.py
Normal file
@ -0,0 +1,393 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper1(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_long']) > params['tsf_long-value'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value'] < dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value'] < (dataframe['close'] - dataframe['ema']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value'] < (dataframe['ema'] - dataframe['middleband']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value'] < dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_low':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['lowerband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ma'], dataframe['ema']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['mfi'], 25))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='tsf_long-value'),
|
||||
Integer(-100, 100, name='tsf_mid-value'),
|
||||
Integer(-100, 100, name='tsf_short-value'),
|
||||
Integer(-50, 50, name='angle_short-value'),
|
||||
Integer(-50, 50, name='angle_long-value'),
|
||||
Integer(-50, 50, name='angle_mid-value'),
|
||||
Real(0, 1, name='correl_h_l-value'),
|
||||
Real(-1, 1, name='correl_close_last_close-value'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value'),
|
||||
Real(0, 1, name='correl_angle_long_close-value'),
|
||||
Real(-1, 1, name='correl_hist_close-value'),
|
||||
Real(-1, 1, name='correl_mfi_close-value'),
|
||||
Integer(10, 60, name='mfi-value'),
|
||||
Integer(-50, 50, name='ema-value'),
|
||||
Integer(-50, 50, name='ema_bol-value'),
|
||||
Integer(-1, 5, name='macdhist-value'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_low', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['tsf_long'] - dataframe['close']) > params['tsf_long-value_sell'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value_sell'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value_sell'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value_sell'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value_sell'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value_sell'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value_sell'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value_sell'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value_sell'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value_sell'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value_sell'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value_sell'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value_sell'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value_sell'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value_sell'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value_sell'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value_sell'] > dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value_sell'] < (dataframe['ema'] - dataframe['close']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value_sell'] < (dataframe['middleband'] - dataframe['ema']))
|
||||
conditions.append(params['macdhist-value_sell'] > dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_high':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['upperband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ema'], dataframe['middleband']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['mfi'], 60))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='tsf_long-value_sell'),
|
||||
Integer(-100, 100, name='tsf_mid-value_sell'),
|
||||
Integer(-100, 100, name='tsf_short-value_sell'),
|
||||
Integer(-50, 50, name='angle_short-value_sell'),
|
||||
Integer(-50, 50, name='angle_long-value_sell'),
|
||||
Integer(-50, 50, name='angle_mid-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l-value_sell'),
|
||||
Real(-1, 1, name='correl_close_last_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_hist_close-value_sell'),
|
||||
Real(-1, 1, name='correl_mfi_close-value_sell'),
|
||||
Integer(40, 100, name='mfi-value_sell'),
|
||||
Integer(-5, 50, name='ema-value_sell'),
|
||||
Integer(-5, 50, name='ema_bol-value_sell'),
|
||||
Integer(-10, 20, name='macdhist-value_sell'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_high', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
176
.env/bin/user_data/hyperopts/hyper2.py
Normal file
176
.env/bin/user_data/hyperopts/hyper2.py
Normal file
@ -0,0 +1,176 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper2(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('uo-enabled'):
|
||||
conditions.append(dataframe['uo'] > params['uo_h'])
|
||||
if params.get('angle-enabled'):
|
||||
conditions.append(dataframe['angle'] > params['angle_h'])
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar_ratio'] < (dataframe['sar'] - dataframe['close']))
|
||||
conditions.append(params['sar_shift'] > (dataframe['sar'] - dataframe['sar'].shift(3)))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macd_value'] > dataframe['macd'])
|
||||
conditions.append(params['macdhist_value'] > dataframe['macdhist'])
|
||||
conditions.append(params['macdhist_shift'] < (dataframe['macdhist'] - dataframe['macdhist'].shift(3)))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['sar']
|
||||
))
|
||||
if params['trigger'] == 'angle':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['angle'], 0
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
conditions.append(dataframe['angle'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(0, 100, name='uo_h'),
|
||||
Real(-1, 1, name='angle_h'),
|
||||
Real(0, 1, name='sar_ratio'),
|
||||
Real(0, 1, name='sar_shift'),
|
||||
Real(-1, 1, name='macd_value'),
|
||||
Real(-1, 1, name='macdhist_value'),
|
||||
Real(-1, 1, name='macdhist_shift'),
|
||||
Categorical([True, False], name='angle-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical(['sar'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('sell-uo-enabled'):
|
||||
conditions.append(dataframe['uo'] > params['uo_l_s'])
|
||||
if params.get('angle-enabled'):
|
||||
conditions.append(params['angle_h_s'] < dataframe['angle'])
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar_ratio_s'] < (dataframe['sar'] - dataframe['close']))
|
||||
conditions.append(params['sar_shift_s'] < (dataframe['sar'] - dataframe['sar'].shift(3)))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macd_value_s'] > dataframe['macd'])
|
||||
conditions.append(params['macdhist_value_s'] > dataframe['macdhist'])
|
||||
conditions.append(params['macdhist_shift_s'] > (dataframe['macdhist'] - dataframe['macdhist'].shift(3)))
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['sell-trigger'] == 'sell-sar_reversal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(0, 100, name='uo_l_s'),
|
||||
Real(-1, 1, name='angle_h_s'),
|
||||
Real(0, 1, name='sar_ratio_s'),
|
||||
Real(0, 1, name='sar_shift_s'),
|
||||
Real(-1, 1, name='macd_value_s'),
|
||||
Real(-1, 1, name='macdhist_value_s'),
|
||||
Real(-1, 1, name='macdhist_shift_s'),
|
||||
Categorical([True, False], name='sell-uo-enabled'),
|
||||
Categorical([True, False], name='sell-angle-enabled'),
|
||||
Categorical([True, False], name='sell-sar-enabled'),
|
||||
Categorical([True, False], name='sell-macd-enabled'),
|
||||
Categorical(['sell-angle', 'sell-macd_cross_signal', 'sell-sar_reversal'], name='trigger')
|
||||
]
|
388
.env/bin/user_data/hyperopts/hyper_adausdt.py
Normal file
388
.env/bin/user_data/hyperopts/hyper_adausdt.py
Normal file
@ -0,0 +1,388 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_adausdt(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_long']) < params['tsf_long-value'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_mid']) < params['tsf_mid-value'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_short']) < params['tsf_short-value'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value'] < dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value'] < (dataframe['close'] - dataframe['ema']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value'] < (dataframe['ema'] - dataframe['middleband']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value'] < dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_low':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['lowerband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['mfi'], 25))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.019, 0.7, name='tsf_long-value'),
|
||||
Real(0.019, 0.7, name='tsf_mid-value'),
|
||||
Real(0.17, 0.7, name='tsf_short-value'),
|
||||
Real(-0.26, 0.23, name='angle_short-value'),
|
||||
Real(-0.018, 0.023, name='angle_long-value'),
|
||||
Real(-0.026, 0.028, name='angle_mid-value'),
|
||||
Real(0, 1, name='correl_h_l-value'),
|
||||
Real(-1, 1, name='correl_close_last_close-value'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value'),
|
||||
Real(0, 1, name='correl_angle_long_close-value'),
|
||||
Real(-1, 1, name='correl_hist_close-value'),
|
||||
Real(-1, 1, name='correl_mfi_close-value'),
|
||||
Integer(10, 60, name='mfi-value'),
|
||||
Real(0.18, 0.7, name='ema-value'),
|
||||
Real(-0.018, 0.015, name='ema_bol-value'),
|
||||
Real(-0.0042, 0.003, name='macdhist-value'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['sar', 'mfi', 'macd_cross_signal', 'bol_low', 'bol_mid'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['tsf_long'] - dataframe['close']) > params['tsf_long-value_sell'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value_sell'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value_sell'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value_sell'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value_sell'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value_sell'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value_sell'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value_sell'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value_sell'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value_sell'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value_sell'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value_sell'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value_sell'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value_sell'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value_sell'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value_sell'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value_sell'] > dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value_sell'] < (dataframe['ema'] - dataframe['close']))
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar-value_sell'] < (dataframe['close'] - dataframe['sar']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value_sell'] < (dataframe['middleband'] - dataframe['ema']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value_sell'] > dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_high':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['upperband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.019, 0.7, name='tsf_long-value_sell'),
|
||||
Real(0.019, 0.7, name='tsf_mid-value_sell'),
|
||||
Real(0.17, 0.7, name='tsf_short-value_sell'),
|
||||
Real(-0.26, 0.23, name='angle_short-value_sell'),
|
||||
Real(-0.018, 0.023, name='angle_long-value_sell'),
|
||||
Real(-0.026, 0.028, name='angle_mid-value_sell'),
|
||||
Real(0, 1, name='correl_h_l-value_sell'),
|
||||
Real(-1, 1, name='correl_close_last_close-value_sell'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value_sell'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value_sell'),
|
||||
Real(0, 1, name='correl_angle_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_hist_close-value_sell'),
|
||||
Real(-1, 1, name='correl_mfi_close-value_sell'),
|
||||
Real(10, 60, name='mfi-value_sell'),
|
||||
Real(0.018, 0.7, name='ema-value_sell'),
|
||||
Real(0.017, 0.7, name='sar-value_sell'),
|
||||
Real(-0.018, 0.015, name='ema_bol-value_sell'),
|
||||
Real(-0.0042, 0.003, name='macdhist-value_sell'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['sar', 'macd_cross_signal', 'bol_low', 'bol_mid'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
256
.env/bin/user_data/hyperopts/hyper_adausdt2.py
Normal file
256
.env/bin/user_data/hyperopts/hyper_adausdt2.py
Normal file
@ -0,0 +1,256 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_adausdt2(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value'] < dataframe['correl_h_l'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value'] < dataframe['mfi'])
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar-value'] < (dataframe['close'] - dataframe['sar']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value'] < dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_low':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['lowerband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['mfi'], 25))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(-1, 1, name='correl_h_l-value'),
|
||||
Integer(10, 60, name='mfi-value'),
|
||||
Integer(-112, 158, name='sar-value'),
|
||||
Real(-0.0042, 0.003, name='macdhist-value'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical(['sar', 'mfi', 'macd_cross_signal', 'bol_low', 'bol_mid'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value_sell'] < dataframe['correl_h_l'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value_sell'] > dataframe['mfi'])
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar-value_sell'] < (dataframe['close'] - dataframe['sar']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value_sell'] > dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_high':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['upperband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0, 1, name='correl_h_l-value_sell'),
|
||||
Real(10, 60, name='mfi-value_sell'),
|
||||
Real(0.017, 0.7, name='sar-value_sell'),
|
||||
Real(-0.0042, 0.003, name='macdhist-value_sell'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical(['sar', 'macd_cross_signal', 'bol_low', 'bol_mid'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
356
.env/bin/user_data/hyperopts/hyper_adausdt3.py
Normal file
356
.env/bin/user_data/hyperopts/hyper_adausdt3.py
Normal file
@ -0,0 +1,356 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_adausdt3(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('aroon-enabled'):
|
||||
conditions.append((dataframe['aroon_up'] - dataframe['aroon_down']) > params['aroon-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] > params['rsi-value'])
|
||||
if params.get('ul-enabled'):
|
||||
conditions.append(dataframe['ul'] > params['ul-value'])
|
||||
if params.get('stoch_ratio-enabled'):
|
||||
conditions.append((dataframe['slowk'] - dataframe['slowd']) > params['stoch_ratio-value'])
|
||||
if params.get('stoch-enabled'):
|
||||
conditions.append(dataframe['slowk'] > params['stoch-value'])
|
||||
if params.get('ht_phase-enabled'):
|
||||
conditions.append(dataframe['ht_phase'] < params['ht_phase-value'])
|
||||
if params.get('inphase-enabled'):
|
||||
conditions.append(dataframe['inphase'] > params['inphase-value'])
|
||||
if params.get('quadrature-enabled'):
|
||||
conditions.append(dataframe['quadrature'] > params['quadrature-value'])
|
||||
if params.get('ht_trendmode-enabled'):
|
||||
conditions.append(dataframe['ht_trendmode'] > params['ht_trendmode-value'])
|
||||
if params.get('correl_sine_trend-enabled'):
|
||||
conditions.append(params['correl_sine_trend-value'] < dataframe['correl_sine_trend'])
|
||||
if params.get('ht_trendline-enabled'):
|
||||
conditions.append(params['ht_trendline-value'] < (dataframe['ht_trendline'] - dataframe['close']))
|
||||
if params.get('ht_sine-enabled'):
|
||||
conditions.append(params['ht_sine-value'] < (dataframe['ht_sine'] - dataframe['leadsine']))
|
||||
if params.get('correl_sine_trend-enabled'):
|
||||
conditions.append(params['correl_sine_trend-value'] < dataframe['correl_sine_trend'])
|
||||
if params.get('correl_ht_sine_trend-enabled'):
|
||||
conditions.append(params['correl_ht_sine_trend-value'] < dataframe['correl_ht_sine_trend'])
|
||||
if params.get('correl_ht_sine_close-enabled'):
|
||||
conditions.append(params['correl_ht_sine_close-value'] < dataframe['correl_ht_sine_close'])
|
||||
if params.get('cci-enabled'):
|
||||
conditions.append(params['cci-value'] < dataframe['cci'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'phasor':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['quadrature'], dataframe['inphase']
|
||||
))
|
||||
if params['trigger'] == 'ht_trendmode':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ht_trendmode'], 0
|
||||
))
|
||||
if params['trigger'] == 'ht_sine':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['leadsine'], dataframe['ht_sine']
|
||||
))
|
||||
if params['trigger'] == 'aroon_osc':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['aroonosc'], 0))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='aroon-value'),
|
||||
Real(2.4, 100, name='rsi-value'),
|
||||
Real(0, 100, name='ul-value'),
|
||||
Real(-42, 42, name='stoch_ratio-value'),
|
||||
Integer(0, 100, name='stoch-value'),
|
||||
Real(-0.025, 0.0238, name='inphase-value'),
|
||||
Real(-0.0741, 0.047, name='quadrature-value'),
|
||||
Integer(0, 1, name='ht_trendmode-value'),
|
||||
Real(-1, 1, name='correl_sine_trend-value'),
|
||||
Real(-1, 1, name='ht_trendline-value'),
|
||||
Real(-0.76, 0.76, name='ht_sine-value'),
|
||||
Real(-1, 1, name='correl_sine_trend-value'),
|
||||
Real(-1, 1, name='correl_ht_sine_trend-value'),
|
||||
Real(-1, 1, name='correl_ht_sine_close-value'),
|
||||
Integer(-1000, 1000, name='cci-value'),
|
||||
Integer(-44, 310, name='ht_phase-value'),
|
||||
|
||||
Categorical([True, False], name='aroon-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical([True, False], name='ul-enabled'),
|
||||
Categorical([True, False], name='stoch_ratio-enabled'),
|
||||
Categorical([True, False], name='stoch-enabled'),
|
||||
Categorical([True, False], name='inphase-enabled'),
|
||||
Categorical([True, False], name='ht_phase-enabled'),
|
||||
Categorical([True, False], name='correl_sine_trend-enabled'),
|
||||
Categorical([True, False], name='quadrature-enabled'),
|
||||
Categorical([True, False], name='ht_trendline-enabled'),
|
||||
Categorical([True, False], name='correl_sine_trend-enabled'),
|
||||
Categorical([True, False], name='correl_ht_sine_trend-enabled'),
|
||||
Categorical([True, False], name='cci-enabled'),
|
||||
Categorical(['ht_sine', 'phasor', 'macd_cross_signal', 'aroon_osc', 'ht_trendmode'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('aroon-enabled'):
|
||||
conditions.append((dataframe['aroon_down'] - dataframe['aroon_up']) > params['aroon-value_sell'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] < params['rsi-value_sell'])
|
||||
if params.get('ul-enabled'):
|
||||
conditions.append(dataframe['ul'] < params['ul-value_sell'])
|
||||
if params.get('stoch_ratio-enabled'):
|
||||
conditions.append((dataframe['slowd'] - dataframe['slowk']) > params['stoch_ratio-value_sell'])
|
||||
if params.get('stoch-enabled'):
|
||||
conditions.append(dataframe['slowk'] < params['stoch-value_sell'])
|
||||
if params.get('ht_phase-enabled'):
|
||||
conditions.append(dataframe['ht_phase'] < params['ht_phase-value_sell'])
|
||||
if params.get('inphase-enabled'):
|
||||
conditions.append(dataframe['inphase'] > params['inphase-value_sell'])
|
||||
if params.get('quadrature-enabled'):
|
||||
conditions.append(dataframe['quadrature'] > params['quadrature-value_sell'])
|
||||
if params.get('ht_trendmode-enabled'):
|
||||
conditions.append(dataframe['ht_trendmode'] < params['ht_trendmode-value'])
|
||||
if params.get('correl_sine_trend-enabled'):
|
||||
conditions.append(params['correl_sine_trend-value_sell'] < dataframe['correl_sine_trend'])
|
||||
if params.get('ht_trendline-enabled'):
|
||||
conditions.append(params['ht_trendline-value_sell'] > (dataframe['close'] - dataframe['ht_trendline']))
|
||||
if params.get('ht_sine-enabled'):
|
||||
conditions.append(params['ht_sine-value_sell'] < (dataframe['ht_trendline'] - dataframe['ht_sine']))
|
||||
if params.get('correl_sine_trend-enabled'):
|
||||
conditions.append(params['correl_sine_trend-value_sell'] < dataframe['correl_sine_trend'])
|
||||
if params.get('correl_ht_sine_trend-enabled'):
|
||||
conditions.append(params['correl_ht_sine_trend-value_sell'] < dataframe['correl_ht_sine_trend'])
|
||||
if params.get('correl_ht_sine_close-enabled'):
|
||||
conditions.append(params['correl_ht_sine_close-value_sell'] < dataframe['correl_ht_sine_close'])
|
||||
if params.get('cci-enabled'):
|
||||
conditions.append(params['cci-value'] < dataframe['cci'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'phasor':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['quadrature'], dataframe['inphase']
|
||||
))
|
||||
if params['trigger'] == 'ht_trendmode':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ht_trendmode'], 1
|
||||
))
|
||||
if params['trigger'] == 'ht_sine':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['leadsine'], dataframe['ht_sine']
|
||||
))
|
||||
if params['trigger'] == 'aroon_osc':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['aroonosc'], 0))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-100, 100, name='aroon-value_sell'),
|
||||
Real(2.4, 100, name='rsi-value_sell'),
|
||||
Real(0, 100, name='ul-value_sell'),
|
||||
Real(-42, 42, name='stoch_ratio-value_sell'),
|
||||
Integer(0, 100, name='stoch-value_sell'),
|
||||
Real(-0.025, 0.0238, name='inphase-value_sell'),
|
||||
Real(-0.0741, 0.047, name='quadrature-value_sell'),
|
||||
Real(-1, 1, name='correl_sine_trend-value_sell'),
|
||||
Real(-1, 1, name='ht_trendline-value_sell'),
|
||||
Real(-0.76, 0.76, name='ht_sine-value_sell'),
|
||||
Real(-1, 1, name='correl_sine_trend-value_sell'),
|
||||
Real(-1, 1, name='correl_ht_sine_trend-value_sell'),
|
||||
Real(-1, 1, name='correl_ht_sine_close-value_sell'),
|
||||
Integer(-1000, 1000, name='cci-value_sell'),
|
||||
Integer(-44, 310, name='ht_phase-value_sell'),
|
||||
Integer(0, 1, name='ht_trendmode-value_sell'),
|
||||
|
||||
Categorical([True, False], name='aroon-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical([True, False], name='ul-enabled'),
|
||||
Categorical([True, False], name='stoch_ratio-enabled'),
|
||||
Categorical([True, False], name='stoch-enabled'),
|
||||
Categorical([True, False], name='inphase-enabled'),
|
||||
Categorical([True, False], name='ht_phase-enabled'),
|
||||
Categorical([True, False], name='correl_sine_trend-enabled'),
|
||||
Categorical([True, False], name='quadrature-enabled'),
|
||||
Categorical([True, False], name='ht_trendline-enabled'),
|
||||
Categorical([True, False], name='correl_sine_trend-enabled'),
|
||||
Categorical([True, False], name='correl_ht_sine_trend-enabled'),
|
||||
Categorical([True, False], name='cci-enabled'),
|
||||
Categorical(
|
||||
['ht_sine', 'aroon_osc', 'ht_trendmode', 'phasor', 'macd_cross_signal'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
402
.env/bin/user_data/hyperopts/hyper_dogeusdt.py
Normal file
402
.env/bin/user_data/hyperopts/hyper_dogeusdt.py
Normal file
@ -0,0 +1,402 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_dogeusdt(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_long']) < params['tsf_long-value'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_mid']) < params['tsf_mid-value'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['close'] - dataframe['tsf_short']) < params['tsf_short-value'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value'] < dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value'] < (dataframe['close'] - dataframe['ema']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value'] < (dataframe['ema'] - dataframe['middleband']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value'] < dataframe['macdhist'])
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar-value_sell'] < (dataframe['close'] - dataframe['sar']))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_low':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['lowerband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ma'], dataframe['ema']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'mfi':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['mfi'], 25))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(-0.03, 0.027, name='tsf_long-value'),
|
||||
Real(-0.023, 0.026, name='tsf_mid-value'),
|
||||
Real(-0.0102, 0.009, name='tsf_short-value'),
|
||||
Real(-0.136, 0.143, name='angle_short-value'),
|
||||
Real(-0.0069, 0.009, name='angle_long-value'),
|
||||
Real(-0.0154, 0.02, name='angle_mid-value'),
|
||||
Real(0, 1, name='correl_h_l-value'),
|
||||
Real(-1, 1, name='correl_close_last_close-value'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value'),
|
||||
Real(0, 1, name='correl_angle_long_close-value'),
|
||||
Real(-1, 1, name='correl_hist_close-value'),
|
||||
Real(-1, 1, name='correl_mfi_close-value'),
|
||||
Integer(10, 60, name='mfi-value'),
|
||||
Real(0.0012, 0.08, name='ema-value'),
|
||||
Real(-0.0087, 0.009, name='ema_bol-value'),
|
||||
Real(-0.02, 0.02, name='sar-value'),
|
||||
Real(-0.0021, 0.00163, name='macdhist-value'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_low', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('tsf_long-enabled'):
|
||||
conditions.append((dataframe['tsf_long'] - dataframe['close']) > params['tsf_long-value_sell'])
|
||||
if params.get('tsf_mid-enabled'):
|
||||
conditions.append((dataframe['tsf_mid'] - dataframe['close']) > params['tsf_mid-value_sell'])
|
||||
if params.get('tsf_short-enabled'):
|
||||
conditions.append((dataframe['tsf_short'] - dataframe['close']) > params['tsf_short-value_sell'])
|
||||
if params.get('angle_short-enabled'):
|
||||
conditions.append(dataframe['angle_short'] > params['angle_short-value_sell'])
|
||||
if params.get('angle_mid-enabled'):
|
||||
conditions.append(dataframe['angle_mid'] > params['angle_mid-value_sell'])
|
||||
if params.get('angle_long-enabled'):
|
||||
conditions.append(dataframe['angle_long'] > params['angle_long-value_sell'])
|
||||
if params.get('correl_h_l-enabled'):
|
||||
conditions.append(params['correl_h_l-value_sell'] < dataframe['correl_h_l'])
|
||||
if params.get('correl_close_last_close-enabled'):
|
||||
conditions.append(params['correl_close_last_close-value_sell'] < dataframe['correl_close_last_close'])
|
||||
if params.get('correl_tsf_long_close-enabled'):
|
||||
conditions.append(params['correl_tsf_long_close-value_sell'] < dataframe['correl_tsf_long_close'])
|
||||
if params.get('correl_tsf_mid_close-enabled'):
|
||||
conditions.append(params['correl_tsf_mid_close-value_sell'] < dataframe['correl_tsf_mid_close'])
|
||||
if params.get('correl_tsf_short_close-enabled'):
|
||||
conditions.append(params['correl_tsf_short_close-value_sell'] < dataframe['correl_tsf_short_close'])
|
||||
if params.get('correl_angle_short_close-enabled'):
|
||||
conditions.append(params['correl_angle_short_close-value_sell'] < dataframe['correl_angle_short_close'])
|
||||
if params.get('correl_angle_mid_close-enabled'):
|
||||
conditions.append(params['correl_angle_mid_close-value_sell'] < dataframe['correl_angle_mid_close'])
|
||||
if params.get('correl_angle_long_close-enabled'):
|
||||
conditions.append(params['correl_angle_long_close-value_sell'] < dataframe['correl_angle_long_close'])
|
||||
if params.get('correl_hist_close-enabled'):
|
||||
conditions.append(params['correl_hist_close-value_sell'] < dataframe['correl_hist_close'])
|
||||
if params.get('correl_mfi_close-enabled'):
|
||||
conditions.append(params['correl_mfi_close-value_sell'] < dataframe['correl_mfi_close'])
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append(params['mfi-value_sell'] > dataframe['mfi'])
|
||||
if params.get('ema-enabled'):
|
||||
conditions.append(params['ema-value_sell'] < (dataframe['ema'] - dataframe['close']))
|
||||
if params.get('sar-enabled'):
|
||||
conditions.append(params['sar-value_sell'] < (dataframe['close'] - dataframe['sar']))
|
||||
if params.get('ema_bol-enabled'):
|
||||
conditions.append(params['ema_bol-value_sell'] < (dataframe['middleband'] - dataframe['ema']))
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append(params['macdhist-value_sell'] > dataframe['macdhist'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'bol_high':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['upperband']
|
||||
))
|
||||
if params['trigger'] == 'bol_mid':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['middleband']
|
||||
))
|
||||
if params['trigger'] == 'ma_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ema'], dataframe['middleband']))
|
||||
if params['trigger'] == 'ema_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['close'], dataframe['ema']))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(-0.03, 0.027, name='tsf_long-value_sell'),
|
||||
Real(-0.023, 0.026, name='tsf_mid-value_sell'),
|
||||
Real(-0.0102, 0.009, name='tsf_short-value_sell'),
|
||||
Real(-0.136, 0.143, name='angle_short-value_sell'),
|
||||
Real(-0.0069, 0.009, name='angle_long-value_sell'),
|
||||
Real(-0.0154, 0.02, name='angle_mid-value_sell'),
|
||||
Real(0, 1, name='correl_h_l-value_sell'),
|
||||
Real(-1, 1, name='correl_close_last_close-value_sell'),
|
||||
Real(0, 1, name='correl_tsf_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_mid_close-value_sell'),
|
||||
Real(-1, 1, name='correl_tsf_short_close-value_sell'),
|
||||
Real(-1, 1, name='correl_angle_short_close-value_sell'),
|
||||
Real(0, 1, name='correl_angle_mid_close-value_sell'),
|
||||
Real(0, 1, name='correl_angle_long_close-value_sell'),
|
||||
Real(-1, 1, name='correl_hist_close-value_sell'),
|
||||
Real(-1, 1, name='correl_mfi_close-value_sell'),
|
||||
Integer(10, 60, name='mfi-value_sell'),
|
||||
Real(0.0012, 0.08, name='ema-value_sell'),
|
||||
Real(-0.0087, 0.009, name='ema_bol-value_sell'),
|
||||
Real(-0.02, 0.02, name='sar-value_sell'),
|
||||
Real(-0.0021, 0.00163, name='macdhist-value_sell'),
|
||||
Categorical([True, False], name='angle_short-enabled'),
|
||||
Categorical([True, False], name='angle_long-enabled'),
|
||||
Categorical([True, False], name='angle_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_long-enabled'),
|
||||
Categorical([True, False], name='tsf_mid-enabled'),
|
||||
Categorical([True, False], name='tsf_short-enabled'),
|
||||
Categorical([True, False], name='correl_h_l-enabled'),
|
||||
Categorical([True, False], name='correl_close_last_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_tsf_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_short_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_mid_close-enabled'),
|
||||
Categorical([True, False], name='correl_angle_long_close-enabled'),
|
||||
Categorical([True, False], name='correl_mfi_close-enabled'),
|
||||
Categorical([True, False], name='correl_hist_close-enabled'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='ema-enabled'),
|
||||
Categorical([True, False], name='sar-enabled'),
|
||||
Categorical([True, False], name='ema_bol-enabled'),
|
||||
Categorical(['mfi', 'macd_cross_signal', 'bol_low', 'bol_mid', 'ma_cross'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
240
.env/bin/user_data/hyperopts/hyper_ethusdt2.py
Normal file
240
.env/bin/user_data/hyperopts/hyper_ethusdt2.py
Normal file
@ -0,0 +1,240 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_ethusdt2(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] < params['angle_tsf_mid-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'ao_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'angle_tsf_mid_cross_up':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['angle_tsf_mid'], -50
|
||||
))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value'),
|
||||
Integer(-50, 50, name='ao2-value'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value'),
|
||||
Integer(8, 92, name='rsi1-value'),
|
||||
Integer(8, 92, name='rsi2-value'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['ao_cross', 'angle_tsf_mid_cross_up'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value_sell'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value_sell'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] > params['angle_tsf_mid-value_sell'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value_sell'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value_sell'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'ao_cross_dw':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'angle_tsf_mid_cross_dw':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['angle_tsf_mid'], 50
|
||||
))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value_sell'),
|
||||
Integer(-50, 50, name='ao2-value_sell'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value_sell'),
|
||||
Integer(8, 92, name='rsi1-value_sell'),
|
||||
Integer(8, 92, name='rsi2-value_sell'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['angle_tsf_mid_cross_dw', 'ao_cross_dw'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(60, 600, name='roi_t1'),
|
||||
Integer(300, 1000, name='roi_t2'),
|
||||
Integer(500, 1500, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
285
.env/bin/user_data/hyperopts/hyper_ethusdt3.py
Normal file
285
.env/bin/user_data/hyperopts/hyper_ethusdt3.py
Normal file
@ -0,0 +1,285 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_ethusdt3(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('correl_h_l_30-enabled'):
|
||||
conditions.append(params['correl_h_l_30-value'] < dataframe['correl_h_l_30'])
|
||||
if params.get('correl_h_l_10-enabled'):
|
||||
conditions.append(params['correl_h_l_10-value'] < dataframe['correl_h_l_10'])
|
||||
if params.get('correl_h_l_3-enabled'):
|
||||
conditions.append(params['correl_h_l_3-value'] < dataframe['correl_h_l_3'])
|
||||
if params.get('cci_45-enabled'):
|
||||
conditions.append(params['cci_45-value'] > dataframe['cci_45'])
|
||||
if params.get('cci_30-enabled'):
|
||||
conditions.append(params['cci_30-value'] > dataframe['cci_30'])
|
||||
if params.get('natr-enabled'):
|
||||
conditions.append(params['natr-value'] < dataframe['natr'])
|
||||
if params.get('trend_line-enabled'):
|
||||
conditions.append(params['trend_line-value'] < (dataframe['trend_line'] - dataframe['close']))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
|
||||
if params['trigger'] == 'correl_h_l_3':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['correl_h_l_30'], 0))
|
||||
if params['trigger'] == 'correl_h_l_10':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['correl_h_l_3'], 0))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
if params['trigger'] == 'cci_30':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_30'], -50))
|
||||
if params['trigger'] == 'cci_45':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_45'], -50))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.0, 4.2, name='natr-value'),
|
||||
Integer(-139, 105, name='trend_line-value'),
|
||||
Real(-1, 1, name='correl_h_l_3-value'),
|
||||
Real(-1, 1, name='correl_h_l_30-value'),
|
||||
Real(-1, 1, name='correl_h_l_10-value'),
|
||||
Integer(-200, 200, name='cci_30-value'),
|
||||
Integer(-200, 200, name='cci_45-value'),
|
||||
Categorical([True, False], name='correl_h_l_3-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_30-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_10-enabled'),
|
||||
Categorical([True, False], name='cci_30-enabled'),
|
||||
Categorical([True, False], name='cci_45-enabled'),
|
||||
Categorical([True, False], name='trend_line-enabled'),
|
||||
Categorical([True, False], name='natr-enabled'),
|
||||
|
||||
Categorical(
|
||||
['sar', 'correl_h_l_3', 'correl_h_l_10' 'cci_45', 'cci_30'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('correl_h_l_30-enabled'):
|
||||
conditions.append(params['correl_h_l_30-value_sell'] < dataframe['correl_h_l_30'])
|
||||
if params.get('correl_h_l_10-enabled'):
|
||||
conditions.append(params['correl_h_l_10-value_sell'] < dataframe['correl_h_l_10'])
|
||||
if params.get('correl_h_l_3-enabled'):
|
||||
conditions.append(params['correl_h_l_3-value_sell'] < dataframe['correl_h_l_3'])
|
||||
if params.get('cci_45-enabled'):
|
||||
conditions.append(params['cci_45-value_sell'] > dataframe['cci_45'])
|
||||
if params.get('cci_30-enabled'):
|
||||
conditions.append(params['cci_30-value_sell'] > dataframe['cci_30'])
|
||||
if params.get('natr-enabled'):
|
||||
conditions.append(params['natr-value_sell'] < dataframe['natr'])
|
||||
if params.get('trend_line-enabled'):
|
||||
conditions.append(params['trend_line-value_sell'] < (dataframe['trend_line'] - dataframe['close']))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
|
||||
if params['trigger'] == 'correl_h_l_3':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['correl_h_l_30'], 0))
|
||||
if params['trigger'] == 'correl_h_l_10':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['correl_h_l_3'], 0))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
if params['trigger'] == 'cci_30':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_30'], -50))
|
||||
if params['trigger'] == 'cci_45':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_45'], -50))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.0, 4.2, name='natr-value_sell'),
|
||||
Integer(-139, 105, name='trend_line-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_3-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_30-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_10-value_sell'),
|
||||
Integer(-200, 200, name='cci_30-value_sell'),
|
||||
Integer(-200, 200, name='cci_45-value_sell'),
|
||||
Categorical([True, False], name='correl_h_l_3-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_30-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_10-enabled'),
|
||||
Categorical([True, False], name='cci_30-enabled'),
|
||||
Categorical([True, False], name='cci_45-enabled'),
|
||||
Categorical([True, False], name='trend_line-enabled'),
|
||||
Categorical([True, False], name='natr-enabled'),
|
||||
|
||||
Categorical(
|
||||
['sar', 'correl_h_l_3', 'correl_h_l_10' 'cci_45', 'cci_30'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
290
.env/bin/user_data/hyperopts/hyper_ethusdt_high_risk.py
Normal file
290
.env/bin/user_data/hyperopts/hyper_ethusdt_high_risk.py
Normal file
@ -0,0 +1,290 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_ethusdt_high_risk(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao-value'])
|
||||
if params.get('vwap_short-enabled'):
|
||||
conditions.append(params['vwap_short-value'] > dataframe['vwap_short'])
|
||||
if params.get('correl_h_l_3-enabled'):
|
||||
conditions.append(params['correl_h_l_3-value'] < dataframe['correl_h_l_3'])
|
||||
if params.get('cci_45-enabled'):
|
||||
conditions.append(params['cci_45-value'] > dataframe['cci_45'])
|
||||
if params.get('cci_30-enabled'):
|
||||
conditions.append(params['cci_30-value'] > dataframe['cci_30'])
|
||||
if params.get('natr-enabled'):
|
||||
conditions.append(params['natr-value'] < dataframe['natr'])
|
||||
if params.get('trend_line-enabled'):
|
||||
conditions.append(params['trend_line-value'] < (dataframe['trend_line'] - dataframe['close']))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'ao_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
if params['trigger'] == 'cci_30':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_30'], -50))
|
||||
if params['trigger'] == 'cci_45':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_45'], -50))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.0, 4.2, name='ao-value'),
|
||||
Integer(-139, 105, name='trend_line-value'),
|
||||
Real(-1, 1, name='correl_h_l_3-value'),
|
||||
Real(-1, 1, name='correl_h_l_30-value'),
|
||||
Real(-1, 1, name='correl_h_l_10-value'),
|
||||
Integer(-200, 200, name='cci_30-value'),
|
||||
Integer(-200, 200, name='cci_45-value'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_30-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_10-enabled'),
|
||||
Categorical([True, False], name='cci_30-enabled'),
|
||||
Categorical([True, False], name='cci_45-enabled'),
|
||||
Categorical([True, False], name='trend_line-enabled'),
|
||||
Categorical([True, False], name='natr-enabled'),
|
||||
|
||||
Categorical(
|
||||
['ao_cross', 'macd_cross_signal', 'correl_h_l_10' 'cci_45', 'cci_30'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('correl_h_l_30-enabled'):
|
||||
conditions.append(params['correl_h_l_30-value_sell'] < dataframe['correl_h_l_30'])
|
||||
if params.get('correl_h_l_10-enabled'):
|
||||
conditions.append(params['correl_h_l_10-value_sell'] < dataframe['correl_h_l_10'])
|
||||
if params.get('correl_h_l_3-enabled'):
|
||||
conditions.append(params['correl_h_l_3-value_sell'] < dataframe['correl_h_l_3'])
|
||||
if params.get('cci_45-enabled'):
|
||||
conditions.append(params['cci_45-value_sell'] > dataframe['cci_45'])
|
||||
if params.get('cci_30-enabled'):
|
||||
conditions.append(params['cci_30-value_sell'] > dataframe['cci_30'])
|
||||
if params.get('natr-enabled'):
|
||||
conditions.append(params['natr-value_sell'] < dataframe['natr'])
|
||||
if params.get('trend_line-enabled'):
|
||||
conditions.append(params['trend_line-value_sell'] < (dataframe['trend_line'] - dataframe['close']))
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
|
||||
if params['trigger'] == 'ao_cross':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['macd'], dataframe['macdsignal']
|
||||
))
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']))
|
||||
if params['trigger'] == 'cci_30':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_30'], -50))
|
||||
if params['trigger'] == 'cci_45':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['cci_45'], -50))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(0.0, 4.2, name='natr-value_sell'),
|
||||
Integer(-139, 105, name='trend_line-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_3-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_30-value_sell'),
|
||||
Real(-1, 1, name='correl_h_l_10-value_sell'),
|
||||
Integer(-200, 200, name='cci_30-value_sell'),
|
||||
Integer(-200, 200, name='cci_45-value_sell'),
|
||||
Categorical([True, False], name='correl_h_l_3-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_30-enabled'),
|
||||
Categorical([True, False], name='correl_h_l_10-enabled'),
|
||||
Categorical([True, False], name='cci_30-enabled'),
|
||||
Categorical([True, False], name='cci_45-enabled'),
|
||||
Categorical([True, False], name='trend_line-enabled'),
|
||||
Categorical([True, False], name='natr-enabled'),
|
||||
|
||||
Categorical(
|
||||
['sar', 'macd_cross_signal', 'correl_h_l_10' 'cci_45', 'cci_30'],
|
||||
name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 120, name='roi_t1'),
|
||||
Integer(10, 60, name='roi_t2'),
|
||||
Integer(10, 40, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
240
.env/bin/user_data/hyperopts/hyper_ltcusdt_1h.py
Normal file
240
.env/bin/user_data/hyperopts/hyper_ltcusdt_1h.py
Normal file
@ -0,0 +1,240 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_ltcusdt_1h(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] < params['angle_tsf_mid-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
if params['trigger'] == 'sine':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['leadsine'], dataframe['sine']
|
||||
))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value'),
|
||||
Integer(-50, 50, name='ao2-value'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value'),
|
||||
Integer(8, 92, name='rsi1-value'),
|
||||
Integer(8, 92, name='rsi2-value'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['sar', 'sine'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value_sell'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value_sell'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] > params['angle_tsf_mid-value_sell'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value_sell'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value_sell'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'sar':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
if params['trigger'] == 'sine':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['leadsine'], dataframe['sine']
|
||||
))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value_sell'),
|
||||
Integer(-50, 50, name='ao2-value_sell'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value_sell'),
|
||||
Integer(8, 92, name='rsi1-value_sell'),
|
||||
Integer(8, 92, name='rsi2-value_sell'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['sar', 'sine'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(60, 600, name='roi_t1'),
|
||||
Integer(300, 1000, name='roi_t2'),
|
||||
Integer(500, 1500, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
240
.env/bin/user_data/hyperopts/hyper_ltcusdt_1hpy
Normal file
240
.env/bin/user_data/hyperopts/hyper_ltcusdt_1hpy
Normal file
@ -0,0 +1,240 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class hyper_ethusdt2(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] < params['angle_tsf_mid-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'ao_cross':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'angle_tsf_mid_cross_up':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['angle_tsf_mid'], -50
|
||||
))
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value'),
|
||||
Integer(-50, 50, name='ao2-value'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value'),
|
||||
Integer(8, 92, name='rsi1-value'),
|
||||
Integer(8, 92, name='rsi2-value'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['ao_cross', 'angle_tsf_mid_cross_up'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('ao-enabled'):
|
||||
conditions.append(dataframe['ao'] > params['ao1-value_sell'])
|
||||
conditions.append(dataframe['ao'] < params['ao2-value_sell'])
|
||||
if params.get('angle_tsf_mid-enabled'):
|
||||
conditions.append(dataframe['angle_tsf_mid'] > params['angle_tsf_mid-value_sell'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(params['rsi1-value_sell'] < dataframe['rsi'])
|
||||
conditions.append(params['rsi2-value_sell'] > dataframe['rsi'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'ao_cross_dw':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['ao'], 0
|
||||
))
|
||||
if params['trigger'] == 'angle_tsf_mid_cross_dw':
|
||||
conditions.append(qtpylib.crossed_below(
|
||||
dataframe['angle_tsf_mid'], 50
|
||||
))
|
||||
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(-50, 50, name='ao1-value_sell'),
|
||||
Integer(-50, 50, name='ao2-value_sell'),
|
||||
Integer(-87, 85, name='angle_tsf_mid-value_sell'),
|
||||
Integer(8, 92, name='rsi1-value_sell'),
|
||||
Integer(8, 92, name='rsi2-value_sell'),
|
||||
Categorical([True, False], name='ao-enabled'),
|
||||
Categorical([True, False], name='angle_tsf_mid-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['angle_tsf_mid_cross_dw', 'ao_cross_dw'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def generate_roi_table(params: Dict) -> Dict[int, float]:
|
||||
"""
|
||||
Generate the ROI table that will be used by Hyperopt
|
||||
|
||||
This implementation generates the default legacy Freqtrade ROI tables.
|
||||
|
||||
Change it if you need different number of steps in the generated
|
||||
ROI tables or other structure of the ROI tables.
|
||||
|
||||
Please keep it aligned with parameters in the 'roi' optimization
|
||||
hyperspace defined by the roi_space method.
|
||||
"""
|
||||
roi_table = {}
|
||||
roi_table[0] = params['roi_p1'] + params['roi_p2'] + params['roi_p3']
|
||||
roi_table[params['roi_t3']] = params['roi_p1'] + params['roi_p2']
|
||||
roi_table[params['roi_t3'] + params['roi_t2']] = params['roi_p1']
|
||||
roi_table[params['roi_t3'] + params['roi_t2'] + params['roi_t1']] = 0
|
||||
|
||||
return roi_table
|
||||
|
||||
@staticmethod
|
||||
def roi_space() -> List[Dimension]:
|
||||
"""
|
||||
Values to search for each ROI steps
|
||||
|
||||
Override it if you need some different ranges for the parameters in the
|
||||
'roi' optimization hyperspace.
|
||||
|
||||
Please keep it aligned with the implementation of the
|
||||
generate_roi_table method.
|
||||
"""
|
||||
return [
|
||||
Integer(60, 600, name='roi_t1'),
|
||||
Integer(300, 1000, name='roi_t2'),
|
||||
Integer(500, 1500, name='roi_t3'),
|
||||
Real(0.01, 0.04, name='roi_p1'),
|
||||
Real(0.01, 0.07, name='roi_p2'),
|
||||
Real(0.01, 0.20, name='roi_p3'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def stoploss_space() -> List[Dimension]:
|
||||
"""
|
||||
Stoploss Value to search
|
||||
|
||||
Override it if you need some different range for the parameter in the
|
||||
'stoploss' optimization hyperspace.
|
||||
"""
|
||||
return [
|
||||
Real(-0.25, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
# It was decided to always set trailing_stop is to True if the 'trailing' hyperspace
|
||||
# is used. Otherwise hyperopt will vary other parameters that won't have effect if
|
||||
# trailing_stop is set False.
|
||||
# This parameter is included into the hyperspace dimensions rather than assigning
|
||||
# it explicitly in the code in order to have it printed in the results along with
|
||||
# other 'trailing' hyperspace parameters.
|
||||
Categorical([True], name='trailing_stop'),
|
||||
|
||||
Real(0.01, 0.35, name='trailing_stop_positive'),
|
||||
|
||||
# 'trailing_stop_positive_offset' should be greater than 'trailing_stop_positive',
|
||||
# so this intermediate parameter is used as the value of the difference between
|
||||
# them. The value of the 'trailing_stop_positive_offset' is constructed in the
|
||||
# generate_trailing_params() method.
|
||||
# This is similar to the hyperspace dimensions used for constructing the ROI tables.
|
||||
Real(0.001, 0.1, name='trailing_stop_positive_offset_p1'),
|
||||
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
173
.env/bin/user_data/hyperopts/macd_hyper.py
Normal file
173
.env/bin/user_data/hyperopts/macd_hyper.py
Normal file
@ -0,0 +1,173 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class macd(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('mfi-enabled'):
|
||||
conditions.append((dataframe['macdhist']) > params['macd_diff'])
|
||||
conditions.append((dataframe['macdhist']) > params['macd_diff'])
|
||||
if params.get('fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] < params['fastd-value'])
|
||||
if params.get('adx-enabled'):
|
||||
conditions.append(dataframe['adx'] > params['adx-value'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] < params['rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'sr':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['sr_fastk'], dataframe['sr_fastd']))
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal']))
|
||||
if params['trigger'] == 'macd_histogram':
|
||||
conditions.append(dataframe['macdhist'] - dataframe['macdhist'].shift(1))
|
||||
if params['trigger'] == 'slow':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['slowk'], dataframe['slowd']))
|
||||
if params['trigger'] == 'sf_fast':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['sf_fastk'], dataframe['sf_fastd']))
|
||||
if params['trigger'] == 'tema':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['close'], dataframe['tema']))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(10, 25, name='mfi-value'),
|
||||
Integer(15, 45, name='fastd-value'),
|
||||
Integer(20, 50, name='adx-value'),
|
||||
Integer(20, 40, name='rsi-value'),
|
||||
Categorical([True, False], name='mfi-enabled'),
|
||||
Categorical([True, False], name='fastd-enabled'),
|
||||
Categorical([True, False], name='adx-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical(['sr', 'macd_cross_signal', 'macd_histogram', 'slow', 'sf_fast', 'tema'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('sell-mfi-enabled'):
|
||||
conditions.append(dataframe['mfi'] > params['sell-mfi-value'])
|
||||
if params.get('sell-fastd-enabled'):
|
||||
conditions.append(dataframe['fastd'] > params['sell-fastd-value'])
|
||||
if params.get('sell-adx-enabled'):
|
||||
conditions.append(dataframe['adx'] < params['sell-adx-value'])
|
||||
if params.get('sell-rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] > params['sell-rsi-value'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['sell-trigger'] == 'sell-bb_upper':
|
||||
conditions.append(dataframe['close'] > dataframe['bb_upperband'])
|
||||
if params['sell-trigger'] == 'sell-macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['macdsignal'], dataframe['macd']
|
||||
))
|
||||
if params['sell-trigger'] == 'sell-sar_reversal':
|
||||
conditions.append(qtpylib.crossed_above(
|
||||
dataframe['sar'], dataframe['close']
|
||||
))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Integer(75, 100, name='sell-mfi-value'),
|
||||
Integer(50, 100, name='sell-fastd-value'),
|
||||
Integer(50, 100, name='sell-adx-value'),
|
||||
Integer(60, 100, name='sell-rsi-value'),
|
||||
Categorical([True, False], name='sell-mfi-enabled'),
|
||||
Categorical([True, False], name='sell-fastd-enabled'),
|
||||
Categorical([True, False], name='sell-adx-enabled'),
|
||||
Categorical([True, False], name='sell-rsi-enabled'),
|
||||
Categorical(['sell-bb_upper',
|
||||
'sell-macd_cross_signal',
|
||||
'sell-sar_reversal'], name='sell-trigger')
|
||||
]
|
219
.env/bin/user_data/hyperopts/quick_ethusdt_1m_hyper.py
Normal file
219
.env/bin/user_data/hyperopts/quick_ethusdt_1m_hyper.py
Normal file
@ -0,0 +1,219 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
|
||||
# --- Do not remove these libs ---
|
||||
from functools import reduce
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from skopt.space import Categorical, Dimension, Integer, Real # noqa
|
||||
|
||||
from freqtrade.optimize.hyperopt_interface import IHyperOpt
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import talib.abstract as ta # noqa
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
|
||||
class quick_ethusdt_1m_hyper(IHyperOpt):
|
||||
"""
|
||||
This is a Hyperopt template to get you started.
|
||||
|
||||
More information in the documentation: https://www.freqtrade.io/en/latest/hyperopt/
|
||||
|
||||
You should:
|
||||
- Add any lib you need to build your hyperopt.
|
||||
|
||||
You must keep:
|
||||
- The prototypes for the methods: populate_indicators, indicator_space, buy_strategy_generator.
|
||||
|
||||
The methods roi_space, generate_roi_table and stoploss_space are not required
|
||||
and are provided by default.
|
||||
However, you may override them if you need 'roi' and 'stoploss' spaces that
|
||||
differ from the defaults offered by Freqtrade.
|
||||
Sample implementation of these methods will be copied to `user_data/hyperopts` when
|
||||
creating the user-data directory using `freqtrade create-userdir --userdir user_data`,
|
||||
or is available online under the following URL:
|
||||
https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/templates/sample_hyperopt_advanced.py.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def buy_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the buy strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Buy strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append((dataframe['macdhist']) > params['macdhist_diff_buy'])
|
||||
if params.get('macd_angle-enabled'):
|
||||
conditions.append((dataframe['macd_angle']) > params['macd_angle_buy'])
|
||||
if params.get('tema-enabled'):
|
||||
conditions.append(dataframe['tema'] < params['tema_value_buy'])
|
||||
if params.get('sr_fastd-enabled'):
|
||||
conditions.append(dataframe['sr_fastd'] > params['sr_fastd_value_buy'])
|
||||
if params.get('sr_fastd_angle-enabled'):
|
||||
conditions.append(dataframe['sr_fastd_angle'] > params['sr_fastd_angle_value_buy'])
|
||||
if params.get('slowk-enabled'):
|
||||
conditions.append(dataframe['slowk'] > params['slowk_value_buy'])
|
||||
if params.get('slowd_angle-enabled'):
|
||||
conditions.append(dataframe['slowd_angle'] > params['slowd_angle_value_buy'])
|
||||
if params.get('sf_fastk-enabled'):
|
||||
conditions.append(dataframe['sf_fastk'] > params['sf_fastk_value_buy'])
|
||||
if params.get('sf_fastd_angle-enabled'):
|
||||
conditions.append(dataframe['sf_fastd_angle'] > params['sf_fastd_angle_value_buy'])
|
||||
if params.get('rsi-enabled'):
|
||||
conditions.append(dataframe['rsi'] > params['rsi_value_buy'])
|
||||
if params.get('rsi_angle-enabled'):
|
||||
conditions.append(dataframe['rsi_angle'] > params['rsi_angle_value_buy'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'trigger' in params:
|
||||
if params['trigger'] == 'sr':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['sr_fastk'], dataframe['sr_fastd']))
|
||||
if params['trigger'] == 'macd_cross_signal':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal']))
|
||||
if params['trigger'] == 'macd_histogram':
|
||||
conditions.append((dataframe['macdhist'] - dataframe['macdhist'].shift(1)) > 0)
|
||||
if params['trigger'] == 'slow':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['slowk'], dataframe['slowd']))
|
||||
if params['trigger'] == 'sf_fast':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['sf_fastk'], dataframe['sf_fastd']))
|
||||
if params['trigger'] == 'tema':
|
||||
conditions.append(qtpylib.crossed_above(dataframe['close'], dataframe['tema']))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_buy_trend
|
||||
|
||||
@staticmethod
|
||||
def indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching buy strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(-0.00072, 0.0008, name='macdhist_diff_buy'),
|
||||
Real(-0.019, 0.018, name='macd_angle_buy'),
|
||||
Real(0.016, 0.13, name='tema_value_buy'),
|
||||
Integer(0, 100, name='sr_fastd_value_buy'),
|
||||
Integer(-90, 90, name='sr_fastd_angle_value_buy'),
|
||||
Integer(0, 100, name='slowk_value_buy'),
|
||||
Integer(-90, 90, name='slowd_angle_value_buy'),
|
||||
Integer(0, 100, name='sf_fastk_value_buy'),
|
||||
Integer(-90, 90, name='sf_fastd_angle_value_buy'),
|
||||
Integer(0, 100, name='rsi_value_buy'),
|
||||
Integer(-90, 90, name='rsi_angle_value_buy'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='macd_angle-enabled'),
|
||||
Categorical([True, False], name='tema-enabled'),
|
||||
Categorical([True, False], name='sr_fastd-enabled'),
|
||||
Categorical([True, False], name='sr_fastd_angle-enabled'),
|
||||
Categorical([True, False], name='slowk-enabled'),
|
||||
Categorical([True, False], name='slowd_angle-enabled'),
|
||||
Categorical([True, False], name='sf_fastk-enabled'),
|
||||
Categorical([True, False], name='sf_fastk_angle-enabled'),
|
||||
Categorical([True, False], name='rsi-enabled'),
|
||||
Categorical([True, False], name='rsi_angle-enabled'),
|
||||
Categorical(['sr', 'macd_cross_signal', 'macd_histogram', 'slow', 'sf_fast', 'tema'], name='trigger')
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def sell_strategy_generator(params: Dict[str, Any]) -> Callable:
|
||||
"""
|
||||
Define the sell strategy parameters to be used by Hyperopt.
|
||||
"""
|
||||
|
||||
def populate_sell_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Sell strategy Hyperopt will build and use.
|
||||
"""
|
||||
conditions = []
|
||||
|
||||
# GUARDS AND TRENDS
|
||||
if params.get('macd-enabled'):
|
||||
conditions.append((dataframe['macdhist']) < params['macdhist_diff_sell'])
|
||||
if params.get('macd_angle-enabled'):
|
||||
conditions.append((dataframe['macd_angle']) < params['macd_angle_sell'])
|
||||
if params.get('tema-enabled'):
|
||||
conditions.append(dataframe['tema'] < params['tema_value_sell'])
|
||||
if params.get('sr_fastd-enabled'):
|
||||
conditions.append(dataframe['sr_fastd'] < params['sr_fastd_value_sell'])
|
||||
if params.get('sr_fastd_angle-enabled'):
|
||||
conditions.append(dataframe['sr_fastd_angle'] > params['sr_fastd_angle_value_sell'])
|
||||
if params.get('slowk-enabled'):
|
||||
conditions.append(dataframe['slowk'] < params['slowk_value_sell'])
|
||||
if params.get('slowd_angle-enabled'):
|
||||
conditions.append(dataframe['slowd_angle'] < params['slowd_angle_value_sell'])
|
||||
if params.get('sf_fastk-enabled'):
|
||||
conditions.append(dataframe['sf_fastk'] > params['sf_fastk_value_sell'])
|
||||
if params.get('sf_fastd_angle-enabled'):
|
||||
conditions.append(dataframe['sf_fastd_angle'] < params['sf_fastd_angle_value_sell'])
|
||||
|
||||
# TRIGGERS
|
||||
if 'sell-trigger' in params:
|
||||
if params['trigger'] == 'sr':
|
||||
conditions.append(qtpylib.crossed_below(dataframe['sr_fastk'], dataframe['sr_fastd']))
|
||||
if params['trigger'] == 'macd_histogram':
|
||||
conditions.append((dataframe['macdhist'] - dataframe['macdhist'].shift(1)) < 0)
|
||||
if params['trigger'] == 'slow':
|
||||
conditions.append(qtpylib.crossed_below(dataframe['slowk'], dataframe['slowd']))
|
||||
if params['trigger'] == 'sf_fast':
|
||||
conditions.append(qtpylib.crossed_below(dataframe['sf_fastk'], dataframe['sf_fastd']))
|
||||
if params['trigger'] == 'tema':
|
||||
conditions.append(qtpylib.crossed_below(dataframe['close'], dataframe['tema']))
|
||||
|
||||
# Check that the candle had volume
|
||||
conditions.append(dataframe['volume'] > 0)
|
||||
|
||||
if conditions:
|
||||
dataframe.loc[
|
||||
reduce(lambda x, y: x & y, conditions),
|
||||
'sell'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
return populate_sell_trend
|
||||
|
||||
@staticmethod
|
||||
def sell_indicator_space() -> List[Dimension]:
|
||||
"""
|
||||
Define your Hyperopt space for searching sell strategy parameters.
|
||||
"""
|
||||
return [
|
||||
Real(-0.00072, 0.0008, name='macdhist_diff_sell'),
|
||||
Real(-0.019, 0.018, name='macd_angle_sell'),
|
||||
Real(0.016, 0.13, name='tema_value_sell'),
|
||||
Integer(0, 100, name='sr_fastd_value_sell'),
|
||||
Integer(-90, 90, name='sr_fastd_angle_value_sell'),
|
||||
Integer(0, 100, name='slowk_value_sell'),
|
||||
Integer(-90, 90, name='slowd_angle_value_sell'),
|
||||
Integer(0, 100, name='sf_fastk_value_sell'),
|
||||
Integer(-90, 90, name='sf_fastd_angle_value_sell'),
|
||||
Categorical([True, False], name='macd-enabled'),
|
||||
Categorical([True, False], name='macd_angle-enabled'),
|
||||
Categorical([True, False], name='tema-enabled'),
|
||||
Categorical([True, False], name='sr_fastd-enabled'),
|
||||
Categorical([True, False], name='sr_fastd_angle-enabled'),
|
||||
Categorical([True, False], name='slowk-enabled'),
|
||||
Categorical([True, False], name='slowd_angle-enabled'),
|
||||
Categorical([True, False], name='sf_fastk-enabled'),
|
||||
Categorical([True, False], name='sf_fastk_angle-enabled'),
|
||||
Categorical(['sr', 'macd_histogram', 'slow', 'sf_fast', 'tema'], name='trigger')
|
||||
|
||||
]
|
0
.env/bin/user_data/logs/.gitkeep
Normal file
0
.env/bin/user_data/logs/.gitkeep
Normal file
0
.env/bin/user_data/notebooks/.gitkeep
Normal file
0
.env/bin/user_data/notebooks/.gitkeep
Normal file
0
.env/bin/user_data/strategies/.gitkeep
Normal file
0
.env/bin/user_data/strategies/.gitkeep
Normal file
0
.env/bin/user_data/strategies/__init__.py
Normal file
0
.env/bin/user_data/strategies/__init__.py
Normal file
216
.env/bin/user_data/strategies/data_eth_usdt_1m.py
Normal file
216
.env/bin/user_data/strategies/data_eth_usdt_1m.py
Normal file
@ -0,0 +1,216 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
# isort: skip_file
|
||||
# --- Do not remove these libs ---
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from talib._ta_lib import ULTOSC, MACD, LINEARREG_ANGLE, TSF, MFI, EMA, MA, BBANDS, CORREL
|
||||
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# This class is a sample. Feel free to customize it.
|
||||
class data_ETHUSDT_1m(IStrategy):
|
||||
"""
|
||||
This is a sample strategy to inspire you.
|
||||
More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md
|
||||
|
||||
You can:
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
- Rename the class name (Do not forget to update class_name)
|
||||
- Add any methods you want to build your strategy
|
||||
- Add any lib you need to build your strategy
|
||||
|
||||
You must keep:
|
||||
- the lib in the section "Do not remove these libs"
|
||||
- the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_buy_trend,
|
||||
populate_sell_trend, hyperopt_space, buy_strategy_generator
|
||||
"""
|
||||
# Strategy interface version - allow new iterations of the strategy interface.
|
||||
# Check the documentation or the Sample strategy to get the latest version.
|
||||
INTERFACE_VERSION = 2
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi".
|
||||
minimal_roi = {
|
||||
"0": 0.24724,
|
||||
"30": 0.1,
|
||||
"46": 0.05,
|
||||
"151": 0
|
||||
}
|
||||
|
||||
# Optimal stoploss designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "stoploss".
|
||||
stoploss = -0.1
|
||||
|
||||
# Trailing stoploss
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.02
|
||||
trailing_stop_positive_offset = 0.14
|
||||
trailing_only_offset_is_reached = True
|
||||
|
||||
# Optimal ticker interval for the strategy.
|
||||
timeframe = '1m'
|
||||
|
||||
# Run "populate_indicators()" only for new candle.
|
||||
process_only_new_candles = False
|
||||
|
||||
# These values can be overridden in the "ask_strategy" section in the config.
|
||||
use_sell_signal = True
|
||||
sell_profit_only = False
|
||||
ignore_roi_if_buy_signal = True
|
||||
|
||||
# Number of candles the strategy requires before producing valid signals
|
||||
startup_candle_count: int = 30
|
||||
|
||||
# Optional order type mapping.
|
||||
order_types = {
|
||||
'buy': 'limit',
|
||||
'sell': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
|
||||
# Optional order time in force.
|
||||
order_time_in_force = {
|
||||
'buy': 'gtc',
|
||||
'sell': 'gtc'
|
||||
}
|
||||
|
||||
plot_config = {
|
||||
'main_plot': {
|
||||
'tema': {},
|
||||
'sar': {'color': 'white'},
|
||||
},
|
||||
'subplots': {
|
||||
"MACD": {
|
||||
'macd': {'color': 'blue'},
|
||||
'macdsignal': {'color': 'orange'},
|
||||
},
|
||||
"RSI": {
|
||||
'rsi': {'color': 'red'},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def informative_pairs(self):
|
||||
"""
|
||||
Define additional, informative pair/interval combinations to be cached from the exchange.
|
||||
These pair/interval combinations are non-tradeable, unless they are part
|
||||
of the whitelist as well.
|
||||
For more information, please consult the documentation
|
||||
:return: List of tuples in the format (pair, interval)
|
||||
Sample: return [("ETH/USDT", "5m"),
|
||||
("BTC/USDT", "15m"),
|
||||
]
|
||||
"""
|
||||
return [("ETH/USDT", "1m")]
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
||||
Performance Note: For the best performance be frugal on the number of indicators
|
||||
you are using. Let uncomment only the indicator you are using in your strategies
|
||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
||||
:param dataframe: Dataframe with data from the exchange
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
"""
|
||||
|
||||
|
||||
dataframe['mfi'] = MFI(dataframe['high'], dataframe['low'], dataframe['close'], dataframe['volume'],
|
||||
timeperiod=14)
|
||||
dataframe['angle_short'] = LINEARREG_ANGLE(dataframe['close'], timeperiod=10)
|
||||
dataframe['angle_mid'] = LINEARREG_ANGLE(dataframe['close'], timeperiod=144)
|
||||
dataframe['angle_long'] = LINEARREG_ANGLE(dataframe['close'], timeperiod=288)
|
||||
|
||||
dataframe['tsf_long'] = TSF(dataframe['close'], timeperiod=288)
|
||||
dataframe['tsf_mid'] = TSF(dataframe['close'], timeperiod=144)
|
||||
dataframe['tsf_short'] = TSF(dataframe['close'], timeperiod=10)
|
||||
|
||||
dataframe['correl_h_l'] = CORREL(dataframe['high'], dataframe['low'], timeperiod=30)
|
||||
dataframe['correl_close_last_close'] = CORREL(dataframe['close'].shift(1), dataframe['close'], timeperiod=30)
|
||||
|
||||
dataframe['correl_tsf_long_close'] = CORREL(dataframe['tsf_long'], dataframe['close'], timeperiod=288)
|
||||
dataframe['correl_tsf_mid_close'] = CORREL(dataframe['tsf_mid'], dataframe['close'], timeperiod=144)
|
||||
dataframe['correl_tsf_short_close'] = CORREL(dataframe['tsf_short'], dataframe['close'], timeperiod=30)
|
||||
|
||||
dataframe['correl_angle_short_close'] = CORREL(dataframe['angle_short'], dataframe['close'], timeperiod=30)
|
||||
dataframe['correl_angle_mid_close'] = CORREL(dataframe['angle_mid'], dataframe['close'], timeperiod=144)
|
||||
dataframe['correl_angle_long_close'] = CORREL(dataframe['angle_long'], dataframe['close'], timeperiod=288)
|
||||
|
||||
dataframe['correl_hist_close'] = CORREL(dataframe['macdhist'], dataframe['close'], timeperiod=24)
|
||||
dataframe['correl_mfi_close'] = CORREL(dataframe['mfi'], dataframe['close'], timeperiod=14)
|
||||
|
||||
|
||||
|
||||
|
||||
dataframe['ema'] = EMA(dataframe['close'], timeperiod=8)
|
||||
dataframe['ma'] = MA(dataframe['close'], timeperiod=8, matype=0)
|
||||
dataframe['upperband'], dataframe['middleband'], dataframe['lowerband'] = BBANDS(dataframe['close'],
|
||||
timeperiod=20, nbdevup=2,
|
||||
nbdevdn=2, matype=0)
|
||||
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['close'], dataframe['lowerband'])) &
|
||||
((dataframe['tsf_mid'] - dataframe['close']) > 14) &
|
||||
(0.5263534368259521 < dataframe['correl_h_l']) &
|
||||
(0.0728048430667152 < dataframe['correl_tsf_mid_close']) &
|
||||
(-0.02402596125126566 < dataframe['correl_angle_short_close']) &
|
||||
(0.2842166347875669 < dataframe['correl_angle_long_close']) &
|
||||
(-0.6552565064627378 < dataframe['correl_mfi_close']) &
|
||||
(-0.4853276710303872 < dataframe['correl_hist_close']) &
|
||||
(0.442188534531633 < dataframe['mfi']) &
|
||||
(0.6714488827895353 < dataframe['ema']) &
|
||||
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['close'], dataframe['lowerband'])) &
|
||||
((dataframe['tsf_mid'] - dataframe['close']) > 68) &
|
||||
(-0.6225944943311145 < dataframe['correl_h_l']) &
|
||||
(0.2602396802858502 < dataframe['correl_tsf_mid_close']) &
|
||||
(0.771988603840956 < dataframe['correl_angle_short_close']) &
|
||||
(0.33471662411500236 < dataframe['correl_angle_long_close']) &
|
||||
(-0.9562413964921457 < dataframe['correl_hist_close']) &
|
||||
(-0.43268559077377733 < dataframe['correl_mfi_close']) &
|
||||
(-0.25207265197064166 < dataframe['mfi']) &
|
||||
(-0.00739011415527302 < dataframe['ema']) &
|
||||
|
||||
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
208
.env/bin/user_data/strategies/ethusdt2_safe_prod1.py
Normal file
208
.env/bin/user_data/strategies/ethusdt2_safe_prod1.py
Normal file
@ -0,0 +1,208 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
# isort: skip_file
|
||||
# --- Do not remove these libs ---
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from talib._ta_lib import ULTOSC, MACD, LINEARREG_ANGLE, TSF, MFI, EMA, MA, BBANDS, CORREL, MAX, MIN, SAR, CCI, \
|
||||
HT_TRENDLINE, HT_DCPERIOD, HT_TRENDMODE, HT_SINE, RSI
|
||||
|
||||
from freqtrade.strategy import merge_informative_pair
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# This class is a sample. Feel free to customize it.
|
||||
class strg2_ETHUSDT_1h_prod1(IStrategy):
|
||||
"""
|
||||
This is a sample strategy to inspire you.
|
||||
More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md
|
||||
|
||||
You can:
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
- Rename the class name (Do not forget to update class_name)
|
||||
- Add any methods you want to build your strategy
|
||||
- Add any lib you need to build your strategy
|
||||
|
||||
You must keep:
|
||||
- the lib in the section "Do not remove these libs"
|
||||
- the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_buy_trend,
|
||||
populate_sell_trend, hyperopt_space, buy_strategy_generator
|
||||
"""
|
||||
# Strategy interface version - allow new iterations of the strategy interface.
|
||||
# Check the documentation or the Sample strategy to get the latest version.
|
||||
INTERFACE_VERSION = 2
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi".
|
||||
minimal_roi = {
|
||||
"0": 0.07371,
|
||||
"9817": 0.0461,
|
||||
"14487": 0.0254,
|
||||
"15960": 0
|
||||
}
|
||||
order_types = {
|
||||
'buy': 'market',
|
||||
'sell': 'market',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
# Optimal stoploss designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "stoploss".
|
||||
stoploss = -0.23371
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.11193
|
||||
trailing_stop_positive_offset = 0.20381
|
||||
trailing_only_offset_is_reached = True
|
||||
|
||||
plot_config = {
|
||||
'main_plot': {
|
||||
'upperband': {'upperband': 'green'},
|
||||
'middleband': {'color': 'green'},
|
||||
'lowerband': {'color': 'green'},
|
||||
'tsf_mid': {'color': 'white'},
|
||||
'ema': {'color': 'white'},
|
||||
},
|
||||
'subplots': {
|
||||
"corr": {
|
||||
'correl_h_l': {'color': 'black'},
|
||||
},
|
||||
"correl_tsf_mid_close": {
|
||||
'correl_tsf_mid_close': {'color': 'grey'},
|
||||
},
|
||||
"correl_angle_short_close": {
|
||||
'correl_angle_short_close': {'color': 'blue'},
|
||||
},
|
||||
"correl_angle_long_close": {
|
||||
'correl_angle_long_close': {'color': 'red'},
|
||||
},
|
||||
"correl_mfi_close": {
|
||||
'correl_mfi_close': {'color': 'black'},
|
||||
},
|
||||
"correl_hist_close": {
|
||||
'correl_tsf_mid_close': {'color': 'red'},
|
||||
},
|
||||
"mfi": {
|
||||
'mfi': {'color': 'yellow'},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
def informative_pairs(self):
|
||||
"""
|
||||
Define additional, informative pair/interval combinations to be cached from the exchange.
|
||||
These pair/interval combinations are non-tradeable, unless they are part
|
||||
of the whitelist as well.
|
||||
For more information, please consult the documentation
|
||||
:return: List of tuples in the format (pair, interval)
|
||||
Sample: return [("ETH/USDT", "5m"),
|
||||
("BTC/USDT", "15m"),
|
||||
]
|
||||
"""
|
||||
return [("ETH/USDT", "1d")]
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
||||
Performance Note: For the best performance be frugal on the number of indicators
|
||||
you are using. Let uncomment only the indicator you are using in your strategies
|
||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
||||
:param dataframe: Dataframe with data from the exchange
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
"""
|
||||
|
||||
# dataframe['macd'], dataframe['macdsignal'], dataframe['macdhist'] = MACD(dataframe['close'], fastperiod=12,
|
||||
# slowperiod=26, signalperiod=7)
|
||||
|
||||
# dataframe['cci'] = CCI(dataframe['high'], dataframe['low'], dataframe['close'], timeperiod=30)
|
||||
dataframe['ao'] = qtpylib.awesome_oscillator(dataframe, weighted=False, fast=5, slow=34)
|
||||
# dataframe['vwap'] = qtpylib.vwap(dataframe)
|
||||
# dataframe['vwap'] = qtpylib.rolling_vwap(dataframe)
|
||||
dataframe['rsi'] = RSI(dataframe['close'], timeperiod=14)
|
||||
# dataframe['tsf_long'] = TSF(dataframe['close'], timeperiod=200)
|
||||
# dataframe['tsf_short'] = TSF(dataframe['close'], timeperiod=7)
|
||||
dataframe['tsf_mid'] = TSF(dataframe['close'], timeperiod=50)
|
||||
|
||||
dataframe['angle_tsf_mid'] = LINEARREG_ANGLE(dataframe['tsf_mid'], timeperiod=10)
|
||||
# dataframe['angle'] = LINEARREG_ANGLE(dataframe['close'], timeperiod=50)
|
||||
|
||||
# dataframe['tsf_max'] = MAX(dataframe['tsf_mid'], timeperiod=30)
|
||||
# dataframe['tsf_min'] = MIN(dataframe['tsf_mid'], timeperiod=30)
|
||||
# dataframe['sar'] = SAR(dataframe['high'], dataframe['low'])
|
||||
# dataframe['sine'], dataframe['leadsine'] = HT_SINE(dataframe['close'])
|
||||
# dataframe['trend'] = HT_TRENDLINE(dataframe['close'])
|
||||
# dataframe['mfi'] = MFI(dataframe['high'], dataframe['low'], dataframe['close'], dataframe['volume'],
|
||||
# timeperiod=5)
|
||||
# dataframe['angle_trend_mid'] = LINEARREG_ANGLE(dataframe['trend'], timeperiod=10)
|
||||
|
||||
# dataframe['upperband'], dataframe['middleband'], dataframe['lowerband'] = BBANDS(dataframe['close'],
|
||||
# timeperiod=30, nbdevup=2,
|
||||
# nbdevdn=2, matype=0)
|
||||
# if not self.dp:
|
||||
# # Don't do anything if DataProvider is not available.
|
||||
# return dataframe
|
||||
# # Get the informative pair
|
||||
# informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe='1d')
|
||||
# informative['trend'] = HT_TRENDLINE(informative['close'])
|
||||
# informative['period'] = HT_DCPERIOD(informative['close'])
|
||||
# informative['mode'] = HT_TRENDMODE(informative['close'])
|
||||
# # informative['sine'], informative['leadsine'] = HT_SINE(informative['close'])
|
||||
# informative['angle_trend'] = LINEARREG_ANGLE(informative['trend'], timeperiod=5)
|
||||
# # informative['sar'] = SAR(informative['high'], informative['low'])
|
||||
# dataframe = merge_informative_pair(dataframe, informative, self.timeframe, '1d', ffill=True)
|
||||
# return dataframe.set_index('date')['2021-01-01':].reset_index()
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['angle_tsf_mid'], -50)) &
|
||||
|
||||
# (dataframe['sine_1h'] < dataframe['leadsine_1h']) &
|
||||
# (dataframe['tsf_mid'] > dataframe['close']) &
|
||||
# (dataframe['ao'] > -5) &
|
||||
# (dataframe['rsi'] < 36) &
|
||||
(dataframe['rsi'] > 14) &
|
||||
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_below(dataframe['angle_tsf_mid'], 50)) &
|
||||
# (dataframe['sine_1h'] > dataframe['leadsine_1h']) &
|
||||
# (dataframe['sar_1d'] < dataframe['close']) &
|
||||
# (dataframe['tsf_mid'] < dataframe['close']) &
|
||||
(dataframe['rsi'] > 50) &
|
||||
(dataframe['ao'] < -10) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
214
.env/bin/user_data/strategies/ethusdt_high_risk.py
Normal file
214
.env/bin/user_data/strategies/ethusdt_high_risk.py
Normal file
@ -0,0 +1,214 @@
|
||||
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
|
||||
# isort: skip_file
|
||||
# --- Do not remove these libs ---
|
||||
import numpy as np # noqa
|
||||
import pandas as pd # noqa
|
||||
from pandas import DataFrame
|
||||
from talib._ta_lib import ULTOSC, MACD, LINEARREG_ANGLE, TSF, MFI, EMA, MA, BBANDS, CORREL, MAX, MIN, SAR, CCI, \
|
||||
HT_TRENDLINE, HT_DCPERIOD, HT_TRENDMODE, HT_SINE, RSI, NATR, STOCH, STOCHF, STOCHRSI
|
||||
|
||||
from freqtrade.strategy import merge_informative_pair
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
|
||||
# --------------------------------
|
||||
# Add your lib to import here
|
||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# This class is a sample. Feel free to customize it.
|
||||
class ETHUSDT_1m_high_risk(IStrategy):
|
||||
"""
|
||||
This is a sample strategy to inspire you.
|
||||
More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md
|
||||
|
||||
You can:
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
- Rename the class name (Do not forget to update class_name)
|
||||
- Add any methods you want to build your strategy
|
||||
- Add any lib you need to build your strategy
|
||||
|
||||
You must keep:
|
||||
- the lib in the section "Do not remove these libs"
|
||||
- the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_buy_trend,
|
||||
populate_sell_trend, hyperopt_space, buy_strategy_generator
|
||||
"""
|
||||
# Strategy interface version - allow new iterations of the strategy interface.
|
||||
# Check the documentation or the Sample strategy to get the latest version.
|
||||
INTERFACE_VERSION = 2
|
||||
|
||||
# Minimal ROI designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "minimal_roi".
|
||||
minimal_roi = {
|
||||
"0": 0.22703036349783817,
|
||||
"30": 0.09085576426119433,
|
||||
"82": 0.029443202051755248,
|
||||
"164": 0
|
||||
}
|
||||
order_types = {
|
||||
'buy': 'market',
|
||||
'sell': 'market',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False
|
||||
}
|
||||
# Optimal stoploss designed for the strategy.
|
||||
# This attribute will be overridden if the config file contains "stoploss".
|
||||
# Stoploss:
|
||||
stoploss = -0.22515
|
||||
|
||||
# Trailing stop:
|
||||
trailing_stop = True
|
||||
trailing_stop_positive = 0.03428
|
||||
trailing_stop_positive_offset = 0.05094
|
||||
trailing_only_offset_is_reached = True
|
||||
|
||||
plot_config = {
|
||||
'main_plot': {
|
||||
'upperband': {'upperband': 'green'},
|
||||
'middleband': {'color': 'green'},
|
||||
'lowerband': {'color': 'green'},
|
||||
'tsf_mid': {'color': 'white'},
|
||||
'ema': {'color': 'white'},
|
||||
},
|
||||
'subplots': {
|
||||
"corr": {
|
||||
'correl_h_l': {'color': 'black'},
|
||||
},
|
||||
"correl_tsf_mid_close": {
|
||||
'correl_tsf_mid_close': {'color': 'grey'},
|
||||
},
|
||||
"correl_angle_short_close": {
|
||||
'correl_angle_short_close': {'color': 'blue'},
|
||||
},
|
||||
"correl_angle_long_close": {
|
||||
'correl_angle_long_close': {'color': 'red'},
|
||||
},
|
||||
"correl_mfi_close": {
|
||||
'correl_mfi_close': {'color': 'black'},
|
||||
},
|
||||
"correl_hist_close": {
|
||||
'correl_tsf_mid_close': {'color': 'red'},
|
||||
},
|
||||
"mfi": {
|
||||
'mfi': {'color': 'yellow'},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
def informative_pairs(self):
|
||||
"""
|
||||
Define additional, informative pair/interval combinations to be cached from the exchange.
|
||||
These pair/interval combinations are non-tradeable, unless they are part
|
||||
of the whitelist as well.
|
||||
For more information, please consult the documentation
|
||||
:return: List of tuples in the format (pair, interval)
|
||||
Sample: return [("ETH/USDT", "5m"),
|
||||
("BTC/USDT", "15m"),
|
||||
]
|
||||
"""
|
||||
return [("ETH/BTC", "1h")]
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Adds several different TA indicators to the given DataFrame
|
||||
|
||||
Performance Note: For the best performance be frugal on the number of indicators
|
||||
you are using. Let uncomment only the indicator you are using in your strategies
|
||||
or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
|
||||
:param dataframe: Dataframe with data from the exchange
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: a Dataframe with all mandatory indicators for the strategies
|
||||
"""
|
||||
dataframe['trend'] = HT_TRENDLINE(dataframe['close'])
|
||||
dataframe['tsf_short'] = TSF(dataframe['close'], timeperiod=12)
|
||||
dataframe['tsf_mid'] = TSF(dataframe['close'], timeperiod=48)
|
||||
|
||||
dataframe['vwap_short'] = qtpylib.rolling_vwap(dataframe, window=5)
|
||||
dataframe['vwap_mid'] = qtpylib.rolling_vwap(dataframe, window=90)
|
||||
dataframe['vwap_long'] = qtpylib.rolling_vwap(dataframe, window=1440)
|
||||
|
||||
dataframe['macd'], dataframe['macdsignal'], dataframe['macdhist'] = MACD(dataframe['close'], fastperiod=12,
|
||||
slowperiod=26, signalperiod=7)
|
||||
dataframe['ao_mid'] = qtpylib.awesome_oscillator(dataframe, weighted=False, fast=5, slow=36)
|
||||
dataframe['ao_short'] = qtpylib.awesome_oscillator(dataframe, weighted=False, fast=5, slow=15)
|
||||
|
||||
dataframe['cci'] = CCI(dataframe['high'], dataframe['low'], dataframe['close'], timeperiod=30)
|
||||
dataframe['rsi'] = RSI(dataframe['close'], timeperiod=14)
|
||||
dataframe['slowk'], dataframe['slowd'] = STOCH(dataframe['high'], dataframe['low'], dataframe['close'],
|
||||
fastk_period=5, slowk_period=3,
|
||||
slowk_matype=0, slowd_period=3,
|
||||
slowd_matype=0)
|
||||
dataframe['fastk'], dataframe['fastd'] = STOCHF(dataframe['high'], dataframe['low'], dataframe['close'],
|
||||
fastk_period=5, fastd_period=3, fastd_matype=0)
|
||||
dataframe['fastk'], dataframe['fastd'] = STOCHRSI(dataframe['close'], timeperiod=14, fastk_period=5,
|
||||
fastd_period=3, fastd_matype=0)
|
||||
|
||||
|
||||
dataframe['sar'] = SAR(dataframe['high'], dataframe['low'])
|
||||
|
||||
dataframe['min_high'] = MIN(dataframe['high'], timeperiod=5)
|
||||
dataframe['max_low'] = MAX(dataframe['low'], timeperiod=5)
|
||||
dataframe['max_low_min_high_ratio'] = dataframe['max_low'] - dataframe['min_high'].shift(15)
|
||||
dataframe['correl_h_l_30'] = CORREL(dataframe['high'], dataframe['low'], timeperiod=30)
|
||||
|
||||
|
||||
dataframe['angle_tsf_short'] = LINEARREG_ANGLE(dataframe['tsf_short'], timeperiod=5)
|
||||
dataframe['angle_close'] = LINEARREG_ANGLE(dataframe['close'], timeperiod=5)
|
||||
dataframe['sine'], dataframe['leadsine'] = HT_SINE(dataframe['close'])
|
||||
dataframe['mode'] = HT_TRENDMODE(dataframe['close'])
|
||||
dataframe['corel_mode'] = CORREL(dataframe['mode'], dataframe['close'], timeperiod=30)
|
||||
|
||||
dataframe = dataframe.reset_index().dropna()
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the buy signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_below(dataframe['sar'], dataframe['close'])) &
|
||||
(dataframe['angle_trend'] > 0) &
|
||||
(dataframe['angle_tsf_mid'] > 0) &
|
||||
(0.75227 < dataframe['correl_h_l_30']) &
|
||||
(0.4 < dataframe['correl_h_l_30']) &
|
||||
|
||||
# (dataframe['sine_1h'] < dataframe['leadsine_1h']) &
|
||||
# (dataframe['tsf_mid'] > dataframe['close']) &
|
||||
# (dataframe['angle'] > 0) &
|
||||
# (dataframe['rsi'] <50) &
|
||||
# (dataframe['natr'] > 1.1) &
|
||||
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'buy'] = 1
|
||||
|
||||
return dataframe
|
||||
|
||||
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
"""
|
||||
Based on TA indicators, populates the sell signal for the given dataframe
|
||||
:param dataframe: DataFrame populated with indicators
|
||||
:param metadata: Additional information, like the currently traded pair
|
||||
:return: DataFrame with buy column
|
||||
"""
|
||||
dataframe.loc[
|
||||
(
|
||||
(qtpylib.crossed_above(dataframe['sar'], dataframe['close'])) &
|
||||
|
||||
(dataframe['max_low'] - dataframe['min_high'].shift(15) < 0) &
|
||||
(dataframe['angle_trend'] < 2) &
|
||||
(dataframe['angle_tsf_mid'] < 2) &
|
||||
(dataframe['mode'] == 1) &
|
||||
# (dataframe['close'] < dataframe['vwap']) &
|
||||
(dataframe['volume'] > 0) # Make sure Volume is not 0
|
||||
),
|
||||
'sell'] = 1
|
||||
return dataframe
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user