freqtrade_origin/docs/includes/strategy-imports.md
2024-08-18 08:38:59 +02:00

1.2 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, 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