freqtrade_origin/en/2020.5/bot-usage/index.html

1617 lines
46 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="prev" href="../stoploss/">
<link rel="next" href="../telegram-usage/">
<link rel="icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.30">
<title>Start the bot - Freqtrade</title>
<link rel="stylesheet" href="../assets/stylesheets/main.3cba04c6.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../stylesheets/ft.extra.css">
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="blue-grey" data-md-color-accent="tear">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#start-the-bot" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<div data-md-color-scheme="default" data-md-component="outdated" hidden>
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="Freqtrade" class="md-header__button md-logo" aria-label="Freqtrade" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Freqtrade
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Start the bot
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Freqtrade" class="md-nav__button md-logo" aria-label="Freqtrade" data-md-component="logo">
<img src="../images/logo.png" alt="logo">
</a>
Freqtrade
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." class="md-nav__link">
<span class="md-ellipsis">
Home
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../docker/" class="md-nav__link">
<span class="md-ellipsis">
Installation Docker
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../installation/" class="md-nav__link">
<span class="md-ellipsis">
Installation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../configuration/" class="md-nav__link">
<span class="md-ellipsis">
Configuration
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../strategy-customization/" class="md-nav__link">
<span class="md-ellipsis">
Strategy Customization
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../stoploss/" class="md-nav__link">
<span class="md-ellipsis">
Stoploss
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Start the bot
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Start the bot
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#bot-commands" class="md-nav__link">
<span class="md-ellipsis">
Bot commands
</span>
</a>
<nav class="md-nav" aria-label="Bot commands">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#bot-trading-commands" class="md-nav__link">
<span class="md-ellipsis">
Bot trading commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-specify-which-configuration-file-be-used" class="md-nav__link">
<span class="md-ellipsis">
How to specify which configuration file be used?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-multiple-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
How to use multiple configuration files?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#where-to-store-custom-data" class="md-nav__link">
<span class="md-ellipsis">
Where to store custom data
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-strategy" class="md-nav__link">
<span class="md-ellipsis">
How to use --strategy?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-strategy-path" class="md-nav__link">
<span class="md-ellipsis">
How to use --strategy-path?
</span>
</a>
<nav class="md-nav" aria-label="How to use --strategy-path?">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#how-to-install-a-strategy" class="md-nav__link">
<span class="md-ellipsis">
How to install a strategy?
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-to-use-db-url" class="md-nav__link">
<span class="md-ellipsis">
How to use --db-url?
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#backtesting-commands" class="md-nav__link">
<span class="md-ellipsis">
Backtesting commands
</span>
</a>
<nav class="md-nav" aria-label="Backtesting commands">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#getting-historic-data-for-backtesting" class="md-nav__link">
<span class="md-ellipsis">
Getting historic data for backtesting
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#hyperopt-commands" class="md-nav__link">
<span class="md-ellipsis">
Hyperopt commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#edge-commands" class="md-nav__link">
<span class="md-ellipsis">
Edge commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#next-step" class="md-nav__link">
<span class="md-ellipsis">
Next step
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<span class="md-ellipsis">
Control the bot
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Control the bot
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../telegram-usage/" class="md-nav__link">
<span class="md-ellipsis">
Telegram
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../webhook-config/" class="md-nav__link">
<span class="md-ellipsis">
Web Hook
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../rest-api/" class="md-nav__link">
<span class="md-ellipsis">
REST API
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../data-download/" class="md-nav__link">
<span class="md-ellipsis">
Data Downloading
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../backtesting/" class="md-nav__link">
<span class="md-ellipsis">
Backtesting
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../hyperopt/" class="md-nav__link">
<span class="md-ellipsis">
Hyperopt
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../edge/" class="md-nav__link">
<span class="md-ellipsis">
Edge Positioning
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../utils/" class="md-nav__link">
<span class="md-ellipsis">
Utility Subcommands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../exchanges/" class="md-nav__link">
<span class="md-ellipsis">
Exchange-specific Notes
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../faq/" class="md-nav__link">
<span class="md-ellipsis">
FAQ
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_16" >
<label class="md-nav__link" for="__nav_16" id="__nav_16_label" tabindex="0">
<span class="md-ellipsis">
Data Analysis
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_16_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_16">
<span class="md-nav__icon md-icon"></span>
Data Analysis
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../data-analysis/" class="md-nav__link">
<span class="md-ellipsis">
Jupyter Notebooks
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../strategy_analysis_example/" class="md-nav__link">
<span class="md-ellipsis">
Strategy analysis
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../plotting/" class="md-nav__link">
<span class="md-ellipsis">
Plotting
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../sql_cheatsheet/" class="md-nav__link">
<span class="md-ellipsis">
SQL Cheatsheet
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../advanced-setup/" class="md-nav__link">
<span class="md-ellipsis">
Advanced Post-installation Tasks
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../strategy-advanced/" class="md-nav__link">
<span class="md-ellipsis">
Advanced Strategy
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../advanced-hyperopt/" class="md-nav__link">
<span class="md-ellipsis">
Advanced Hyperopt
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../sandbox-testing/" class="md-nav__link">
<span class="md-ellipsis">
Sandbox Testing
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../deprecated/" class="md-nav__link">
<span class="md-ellipsis">
Deprecated Features
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../developer/" class="md-nav__link">
<span class="md-ellipsis">
Contributors Guide
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#bot-commands" class="md-nav__link">
<span class="md-ellipsis">
Bot commands
</span>
</a>
<nav class="md-nav" aria-label="Bot commands">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#bot-trading-commands" class="md-nav__link">
<span class="md-ellipsis">
Bot trading commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-specify-which-configuration-file-be-used" class="md-nav__link">
<span class="md-ellipsis">
How to specify which configuration file be used?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-multiple-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
How to use multiple configuration files?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#where-to-store-custom-data" class="md-nav__link">
<span class="md-ellipsis">
Where to store custom data
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-strategy" class="md-nav__link">
<span class="md-ellipsis">
How to use --strategy?
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-use-strategy-path" class="md-nav__link">
<span class="md-ellipsis">
How to use --strategy-path?
</span>
</a>
<nav class="md-nav" aria-label="How to use --strategy-path?">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#how-to-install-a-strategy" class="md-nav__link">
<span class="md-ellipsis">
How to install a strategy?
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-to-use-db-url" class="md-nav__link">
<span class="md-ellipsis">
How to use --db-url?
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#backtesting-commands" class="md-nav__link">
<span class="md-ellipsis">
Backtesting commands
</span>
</a>
<nav class="md-nav" aria-label="Backtesting commands">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#getting-historic-data-for-backtesting" class="md-nav__link">
<span class="md-ellipsis">
Getting historic data for backtesting
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#hyperopt-commands" class="md-nav__link">
<span class="md-ellipsis">
Hyperopt commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#edge-commands" class="md-nav__link">
<span class="md-ellipsis">
Edge commands
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#next-step" class="md-nav__link">
<span class="md-ellipsis">
Next step
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="start-the-bot">Start the bot<a class="headerlink" href="#start-the-bot" title="Permanent link">&para;</a></h1>
<p>This page explains the different parameters of the bot and how to run it.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If you've used <code>setup.sh</code>, don't forget to activate your virtual environment (<code>source .env/bin/activate</code>) before running freqtrade commands.</p>
</div>
<h2 id="bot-commands">Bot commands<a class="headerlink" href="#bot-commands" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code>usage: freqtrade [-h] [-V]
{trade,backtesting,edge,hyperopt,create-userdir,list-exchanges,list-timeframes,download-data,plot-dataframe,plot-profit}
...
Free, open source crypto trading bot
positional arguments:
{trade,backtesting,edge,hyperopt,create-userdir,list-exchanges,list-timeframes,download-data,plot-dataframe,plot-profit}
trade Trade module.
backtesting Backtesting module.
edge Edge module.
hyperopt Hyperopt module.
create-userdir Create user-data directory.
list-exchanges Print available exchanges.
list-timeframes Print available ticker intervals (timeframes) for the
exchange.
download-data Download backtesting data.
plot-dataframe Plot candles with indicators.
plot-profit Generate plot showing profits.
optional arguments:
-h, --help show this help message and exit
-V, --version show program&#39;s version number and exit
</code></pre></div>
<h3 id="bot-trading-commands">Bot trading commands<a class="headerlink" href="#bot-trading-commands" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code>usage: freqtrade trade [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
[--userdir PATH] [-s NAME] [--strategy-path PATH]
[--db-url PATH] [--sd-notify] [--dry-run]
optional arguments:
-h, --help show this help message and exit
--db-url PATH Override trades database URL, this is useful in custom
deployments (default: `sqlite:///tradesv3.sqlite` for
Live Run mode, `sqlite:///tradesv3.dryrun.sqlite` for
Dry Run).
--sd-notify Notify systemd service manager.
--dry-run Enforce dry-run for trading (removes Exchange secrets
and simulates trades).
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--logfile FILE Log to the file specified. Special values are:
&#39;syslog&#39;, &#39;journald&#39;. See the documentation for more
details.
-V, --version show program&#39;s version number and exit
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d PATH, --datadir PATH
Path to directory with historical backtesting data.
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
.
</code></pre></div>
<h3 id="how-to-specify-which-configuration-file-be-used">How to specify which configuration file be used?<a class="headerlink" href="#how-to-specify-which-configuration-file-be-used" title="Permanent link">&para;</a></h3>
<p>The bot allows you to select which configuration file you want to use by means of
the <code>-c/--config</code> command line option:</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>-c<span class="w"> </span>path/far/far/away/config.json
</code></pre></div>
<p>Per default, the bot loads the <code>config.json</code> configuration file from the current
working directory.</p>
<h3 id="how-to-use-multiple-configuration-files">How to use multiple configuration files?<a class="headerlink" href="#how-to-use-multiple-configuration-files" title="Permanent link">&para;</a></h3>
<p>The bot allows you to use multiple configuration files by specifying multiple
<code>-c/--config</code> options in the command line. Configuration parameters
defined in the latter configuration files override parameters with the same name
defined in the previous configuration files specified in the command line earlier.</p>
<p>For example, you can make a separate configuration file with your key and secret
for the Exchange you use for trading, specify default configuration file with
empty key and secret values while running in the Dry Mode (which does not actually
require them):</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>-c<span class="w"> </span>./config.json
</code></pre></div>
<p>and specify both configuration files when running in the normal Live Trade Mode:</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>-c<span class="w"> </span>./config.json<span class="w"> </span>-c<span class="w"> </span>path/to/secrets/keys.config.json
</code></pre></div>
<p>This could help you hide your private Exchange key and Exchange secret on you local machine
by setting appropriate file permissions for the file which contains actual secrets and, additionally,
prevent unintended disclosure of sensitive private data when you publish examples
of your configuration in the project issues or in the Internet.</p>
<p>See more details on this technique with examples in the documentation page on
<a href="../configuration/">configuration</a>.</p>
<h3 id="where-to-store-custom-data">Where to store custom data<a class="headerlink" href="#where-to-store-custom-data" title="Permanent link">&para;</a></h3>
<p>Freqtrade allows the creation of a user-data directory using <code>freqtrade create-userdir --userdir someDirectory</code>.
This directory will look as follows:</p>
<div class="highlight"><pre><span></span><code>user_data/
├── backtest_results
├── data
├── hyperopts
├── hyperopt_results
├── plot
└── strategies
</code></pre></div>
<p>You can add the entry "user_data_dir" setting to your configuration, to always point your bot to this directory.
Alternatively, pass in <code>--userdir</code> to every command.
The bot will fail to start if the directory does not exist, but will create necessary subdirectories.</p>
<p>This directory should contain your custom strategies, custom hyperopts and hyperopt loss functions, backtesting historical data (downloaded using either backtesting command or the download script) and plot outputs.</p>
<p>It is recommended to use version control to keep track of changes to your strategies.</p>
<h3 id="how-to-use-strategy">How to use <strong>--strategy</strong>?<a class="headerlink" href="#how-to-use-strategy" title="Permanent link">&para;</a></h3>
<p>This parameter will allow you to load your custom strategy class.
To test the bot installation, you can use the <code>SampleStrategy</code> installed by the <code>create-userdir</code> subcommand (usually <code>user_data/strategy/sample_strategy.py</code>).</p>
<p>The bot will search your strategy file within <code>user_data/strategies</code>.
To use other directories, please read the next section about <code>--strategy-path</code>.</p>
<p>To load a strategy, simply pass the class name (e.g.: <code>CustomStrategy</code>) in this parameter.</p>
<p><strong>Example:</strong>
In <code>user_data/strategies</code> you have a file <code>my_awesome_strategy.py</code> which has
a strategy class called <code>AwesomeStrategy</code> to load it:</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>--strategy<span class="w"> </span>AwesomeStrategy
</code></pre></div>
<p>If the bot does not find your strategy file, it will display in an error
message the reason (File not found, or errors in your code).</p>
<p>Learn more about strategy file in
<a href="../strategy-customization/">Strategy Customization</a>.</p>
<h3 id="how-to-use-strategy-path">How to use <strong>--strategy-path</strong>?<a class="headerlink" href="#how-to-use-strategy-path" title="Permanent link">&para;</a></h3>
<p>This parameter allows you to add an additional strategy lookup path, which gets
checked before the default locations (The passed path must be a directory!):</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>--strategy<span class="w"> </span>AwesomeStrategy<span class="w"> </span>--strategy-path<span class="w"> </span>/some/directory
</code></pre></div>
<h4 id="how-to-install-a-strategy">How to install a strategy?<a class="headerlink" href="#how-to-install-a-strategy" title="Permanent link">&para;</a></h4>
<p>This is very simple. Copy paste your strategy file into the directory
<code>user_data/strategies</code> or use <code>--strategy-path</code>. And voila, the bot is ready to use it.</p>
<h3 id="how-to-use-db-url">How to use <strong>--db-url</strong>?<a class="headerlink" href="#how-to-use-db-url" title="Permanent link">&para;</a></h3>
<p>When you run the bot in Dry-run mode, per default no transactions are
stored in a database. If you want to store your bot actions in a DB
using <code>--db-url</code>. This can also be used to specify a custom database
in production mode. Example command:</p>
<div class="highlight"><pre><span></span><code>freqtrade<span class="w"> </span>trade<span class="w"> </span>-c<span class="w"> </span>config.json<span class="w"> </span>--db-url<span class="w"> </span>sqlite:///tradesv3.dry_run.sqlite
</code></pre></div>
<h2 id="backtesting-commands">Backtesting commands<a class="headerlink" href="#backtesting-commands" title="Permanent link">&para;</a></h2>
<p>Backtesting also uses the config specified via <code>-c/--config</code>.</p>
<div class="highlight"><pre><span></span><code>usage: freqtrade backtesting [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [-s NAME]
[--strategy-path PATH] [-i TICKER_INTERVAL]
[--timerange TIMERANGE] [--max-open-trades INT]
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
[--eps] [--dmmp]
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
[--export EXPORT] [--export-filename PATH]
optional arguments:
-h, --help show this help message and exit
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
`1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
--max-open-trades INT
Override the value of the `max_open_trades`
configuration setting.
--stake-amount STAKE_AMOUNT
Override the value of the `stake_amount` configuration
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
--eps, --enable-position-stacking
Allow buying the same pair multiple times (position
stacking).
--dmmp, --disable-max-market-positions
Disable applying `max_open_trades` during backtest
(same as setting `max_open_trades` to a very high
number).
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
Provide a space-separated list of strategies to
backtest. Please note that ticker-interval needs to be
set either in config or via command line. When using
this together with `--export trades`, the strategy-
name is injected into the filename (so `backtest-
data.json` becomes `backtest-data-
DefaultStrategy.json`
--export EXPORT Export backtest results, argument are: trades.
Example: `--export=trades`
--export-filename PATH
Save backtest results to the file with this filename.
Requires `--export` to be set as well. Example:
`--export-filename=user_data/backtest_results/backtest
_today.json`
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--logfile FILE Log to the file specified. Special values are:
&#39;syslog&#39;, &#39;journald&#39;. See the documentation for more
details.
-V, --version show program&#39;s version number and exit
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d PATH, --datadir PATH
Path to directory with historical backtesting data.
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
</code></pre></div>
<h3 id="getting-historic-data-for-backtesting">Getting historic data for backtesting<a class="headerlink" href="#getting-historic-data-for-backtesting" title="Permanent link">&para;</a></h3>
<p>The first time your run Backtesting, you will need to download some historic data first.
This can be accomplished by using <code>freqtrade download-data</code>.<br />
Check the corresponding <a href="../data-download/">Data Downloading</a> section for more details</p>
<h2 id="hyperopt-commands">Hyperopt commands<a class="headerlink" href="#hyperopt-commands" title="Permanent link">&para;</a></h2>
<p>To optimize your strategy, you can use hyperopt parameter hyperoptimization
to find optimal parameter values for your strategy.</p>
<div class="highlight"><pre><span></span><code>usage: freqtrade hyperopt [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
[--userdir PATH] [-s NAME] [--strategy-path PATH]
[-i TICKER_INTERVAL] [--timerange TIMERANGE]
[--max-open-trades INT]
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
[--hyperopt NAME] [--hyperopt-path PATH] [--eps]
[-e INT]
[--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]]
[--dmmp] [--print-all] [--no-color] [--print-json]
[-j JOBS] [--random-state INT] [--min-trades INT]
[--continue] [--hyperopt-loss NAME]
optional arguments:
-h, --help show this help message and exit
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
`1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
--max-open-trades INT
Override the value of the `max_open_trades`
configuration setting.
--stake-amount STAKE_AMOUNT
Override the value of the `stake_amount` configuration
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
--hyperopt NAME Specify hyperopt class name which will be used by the
bot.
--hyperopt-path PATH Specify additional lookup path for Hyperopt and
Hyperopt Loss functions.
--eps, --enable-position-stacking
Allow buying the same pair multiple times (position
stacking).
-e INT, --epochs INT Specify number of epochs (default: 100).
--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]
Specify which parameters to hyperopt. Space-separated
list.
--dmmp, --disable-max-market-positions
Disable applying `max_open_trades` during backtest
(same as setting `max_open_trades` to a very high
number).
--print-all Print all results, not only the best ones.
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--print-json Print best results in JSON format.
-j JOBS, --job-workers JOBS
The number of concurrently running jobs for
hyperoptimization (hyperopt worker processes). If -1
(default), all CPUs are used, for -2, all CPUs but one
are used, etc. If 1 is given, no parallel computing
code is used at all.
--random-state INT Set random state to some positive integer for
reproducible hyperopt results.
--min-trades INT Set minimal desired number of trades for evaluations
in the hyperopt optimization path (default: 1).
--continue Continue hyperopt from previous runs. By default,
temporary files will be removed and hyperopt will
start from scratch.
--hyperopt-loss NAME Specify the class name of the hyperopt loss function
class (IHyperOptLoss). Different functions can
generate completely different results, since the
target for optimization is different. Built-in
Hyperopt-loss-functions are:
DefaultHyperOptLoss, OnlyProfitHyperOptLoss,
SharpeHyperOptLoss, SharpeHyperOptLossDaily,
SortinoHyperOptLoss, SortinoHyperOptLossDaily.
(default: `DefaultHyperOptLoss`).
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--logfile FILE Log to the file specified. Special values are:
&#39;syslog&#39;, &#39;journald&#39;. See the documentation for more
details.
-V, --version show program&#39;s version number and exit
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d PATH, --datadir PATH
Path to directory with historical backtesting data.
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
</code></pre></div>
<h2 id="edge-commands">Edge commands<a class="headerlink" href="#edge-commands" title="Permanent link">&para;</a></h2>
<p>To know your trade expectancy and winrate against historical data, you can use Edge.</p>
<div class="highlight"><pre><span></span><code>usage: freqtrade edge [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
[--userdir PATH] [-s NAME] [--strategy-path PATH]
[-i TICKER_INTERVAL] [--timerange TIMERANGE]
[--max-open-trades INT] [--stake-amount STAKE_AMOUNT]
[--fee FLOAT] [--stoplosses STOPLOSS_RANGE]
optional arguments:
-h, --help show this help message and exit
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
`1d`).
--timerange TIMERANGE
Specify what timerange of data to use.
--max-open-trades INT
Override the value of the `max_open_trades`
configuration setting.
--stake-amount STAKE_AMOUNT
Override the value of the `stake_amount` configuration
setting.
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
entry and exit).
--stoplosses STOPLOSS_RANGE
Defines a range of stoploss values against which edge
will assess the strategy. The format is &quot;min,max,step&quot;
(without any space). Example:
`--stoplosses=-0.01,-0.1,-0.001`
Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
--logfile FILE Log to the file specified. Special values are:
&#39;syslog&#39;, &#39;journald&#39;. See the documentation for more
details.
-V, --version show program&#39;s version number and exit
-c PATH, --config PATH
Specify configuration file (default:
`userdir/config.json` or `config.json` whichever
exists). Multiple --config options may be used. Can be
set to `-` to read config from stdin.
-d PATH, --datadir PATH
Path to directory with historical backtesting data.
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
Strategy arguments:
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
--strategy-path PATH Specify additional strategy lookup path.
</code></pre></div>
<p>To understand edge and how to read the results, please read the <a href="../edge/">edge documentation</a>.</p>
<h2 id="next-step">Next step<a class="headerlink" href="#next-step" title="Permanent link">&para;</a></h2>
<p>The optimal strategy of the bot will change with time depending of the market trends. The next step is to
<a href="../strategy-customization/">Strategy Customization</a>.</p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.b8dbb3d2.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
<script src="../assets/javascripts/bundle.fe8b6f2b.min.js"></script>
</body>
</html>