freqtrade_origin/docs/includes/strategy-imports.md

1.1 KiB

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.

# flake8: noqa: F401
# isort: skip_file
# --- Do not remove these imports ---
import numpy as np
import pandas as pd
from datetime import datetime
from pandas import DataFrame
from typing import Dict, Optional, Union

from freqtrade.strategy import (
    IStrategy,
    Trade, 
    Order,
    PairLocks,
    informative,  # @informative decorator
    # Hyperopt Parameters
    BooleanParameter,
    CategoricalParameter,
    DecimalParameter,
    IntParameter,
    RealParameter,
    # 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