mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
46 lines
1.2 KiB
Markdown
46 lines
1.2 KiB
Markdown
## Imports necessary for a strategy
|
|
|
|
When creating a strategy, you will need to import the necessary modules and classes. The following imports are required for a strategy:
|
|
|
|
By default, we recommend the following imports as a base line for your strategy:
|
|
This will cover all imports necessary for freqtrade functions to work.
|
|
Obviously you can add more imports as needed for your strategy.
|
|
|
|
``` python
|
|
# flake8: noqa: F401
|
|
# isort: skip_file
|
|
# --- Do not remove these imports ---
|
|
import numpy as np
|
|
import pandas as pd
|
|
from datetime import datetime, timedelta, timezone
|
|
from pandas import DataFrame
|
|
from typing import Dict, Optional, Union, Tuple
|
|
|
|
from freqtrade.strategy import (
|
|
IStrategy,
|
|
Trade,
|
|
Order,
|
|
PairLocks,
|
|
informative, # @informative decorator
|
|
# Hyperopt Parameters
|
|
BooleanParameter,
|
|
CategoricalParameter,
|
|
DecimalParameter,
|
|
IntParameter,
|
|
RealParameter,
|
|
# timeframe helpers
|
|
timeframe_to_minutes,
|
|
timeframe_to_next_date,
|
|
timeframe_to_prev_date,
|
|
# Strategy helper functions
|
|
merge_informative_pair,
|
|
stoploss_from_absolute,
|
|
stoploss_from_open,
|
|
)
|
|
|
|
# --------------------------------
|
|
# Add your lib to import here
|
|
import talib.abstract as ta
|
|
from technical import qtpylib
|
|
```
|