freqtrade / freqtrade

Free, open source crypto trading bot
https://www.freqtrade.io
GNU General Public License v3.0
28.75k stars 6.16k forks source link

Module missing even if installed via dockerfile #8432

Closed ThatFack closed 1 year ago

ThatFack commented 1 year ago

PLEASE DO NOT CONSIDER I FOUND MY MISTAKE SORRY TO REACH OUT FOR NOTHING

Describe your environment

Hello ! I am completely new to docker and I am running into this issue :

Please see below my configs files and the commands I run :

Docker-compose.yml

---
version: '3'
services:
  freqtrade:
    image: freqtradeorg/freqtrade:stable
    # image: freqtradeorg/freqtrade:develop
    # Use plotting image
    # image: freqtradeorg/freqtrade:develop_plot
    # Build step - only needed when additional dependencies are needed
    # build:
    #   context: .
    #   dockerfile: "./docker/Dockerfile.custom"
    restart: unless-stopped
    container_name: freqtrade
    volumes:
      - "./user_data:/freqtrade/user_data"
    # Expose api on port 8080 (localhost only)
    # Please read the https://www.freqtrade.io/en/stable/rest-api/ documentation
    # before enabling this.
    ports:
      - "127.0.0.1:8080:8080"
    # Default command used when running `docker compose up`
    command: >
      trade
      --logfile /freqtrade/user_data/logs/freqtrade.log
      --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite
      --config /freqtrade/user_data/config.json
      --strategy SampleStrategy

Docker-compose.local.yml

version: '3'
services:
  freqtrade:
    image: freqtrade:local
    build:
       context: .
       dockerfile: "./Dockerfile.env"

Dockerfile.env

FROM freqtradeorg/freqtrade:develop

RUN pip install market_profile

When i run this : docker-compose -f docker-compose.yml -f docker-compose.local.yml run --rm freqtrade backtesting --config user_data/config.json --strategy ${STRATEGY} --timerange 20220901-20230401 -i 1m

I can see that the market_profile module is indeed downloaded and exported to the image, please see below the output :

[+] Building 0.8s (6/6) FINISHED
 => [internal] load build definition from Dockerfile.env                                                                                                    0.1s
 => => transferring dockerfile: 108B                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                             0.0s
 => [internal] load metadata for docker.io/freqtradeorg/freqtrade:develop                                                                                   0.6s
 => [1/2] FROM docker.io/freqtradeorg/freqtrade:develop@sha256:6e96cb3c05f10704914d99ee9f1e07917928b8e4563435bdafab3f72fa4852c6                             0.0s
 => CACHED [2/2] RUN pip install market_profile                                                                                                             0.0s
 => exporting to image                                                                                                                                      0.1s
 => => exporting layers                                                                                                                                     0.0s
 => => writing image sha256:0a1a2df9d7fd769b3e71372ba179a7eb9fa64688a4a70bdc407f93ced0f34a2e                                                                0.0s
 => => naming to docker.io/library/freqtrade:local                                                                                                          0.0s

Then I got this error about a missing python module :

2023-04-02 21:04:59,660 - freqtrade - INFO - freqtrade docker-2023.4.dev-19e112f3
2023-04-02 21:04:59,673 - freqtrade.configuration.load_config - INFO - Using config: user_data/config.json ...
2023-04-02 21:04:59,680 - freqtrade.loggers - INFO - Verbosity set to 0
2023-04-02 21:04:59,681 - freqtrade.configuration.configuration - INFO - Parameter -i/--timeframe detected ... Using timeframe: 1m ...
2023-04-02 21:04:59,681 - freqtrade.configuration.configuration - INFO - Using max_open_trades: 10 ...
2023-04-02 21:04:59,681 - freqtrade.configuration.configuration - INFO - Parameter --timerange detected: 20220901-20230401 ...
2023-04-02 21:04:59,941 - freqtrade.configuration.configuration - INFO - Using user-data directory: /freqtrade/user_data ...
2023-04-02 21:04:59,946 - freqtrade.configuration.configuration - INFO - Using data directory: /freqtrade/user_data/data/bybit ...
2023-04-02 21:04:59,946 - freqtrade.configuration.configuration - INFO - Overriding timeframe with Command line argument
2023-04-02 21:04:59,946 - freqtrade.configuration.configuration - INFO - Parameter --cache=day detected ...
2023-04-02 21:04:59,946 - freqtrade.configuration.configuration - INFO - Filter trades by timerange: 20220901-20230401
2023-04-02 21:04:59,948 - freqtrade.exchange.check_exchange - INFO - Checking exchange...
2023-04-02 21:04:59,968 - freqtrade.exchange.check_exchange - WARNING - Exchange "bybit" is known to the the ccxt library, available for the bot, but not officially supported by the Freqtrade development team. It may work flawlessly (please report back) or have serious issues. Use it at your own discretion.
2023-04-02 21:04:59,968 - freqtrade.configuration.configuration - INFO - Using pairlist from configuration.
2023-04-02 21:04:59,968 - freqtrade.configuration.config_validation - INFO - Validating configuration ...
2023-04-02 21:04:59,975 - freqtrade.commands.optimize_commands - INFO - Starting freqtrade in Backtesting mode
2023-04-02 21:04:59,976 - freqtrade.exchange.exchange - INFO - Instance is running with dry_run enabled
2023-04-02 21:04:59,976 - freqtrade.exchange.exchange - INFO - Using CCXT 3.0.37
2023-04-02 21:04:59,976 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'enableRateLimit': True}
2023-04-02 21:04:59,996 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}, 'enableRateLimit': True}
2023-04-02 21:05:00,019 - freqtrade.exchange.exchange - INFO - Using Exchange "Bybit"
2023-04-02 21:05:01,453 - freqtrade.exchange.exchange - INFO - Using cached leverage_tiers.
2023-04-02 21:05:01,453 - freqtrade.exchange.exchange - INFO - Done initializing 208 markets.
2023-04-02 21:05:01,461 - freqtrade.resolvers.exchange_resolver - INFO - Using resolved exchange 'Bybit'...
2023-04-02 21:05:01,518 - freqtrade.resolvers.iresolver - WARNING - Could not import /freqtrade/user_data/strategies/MarketProfileStrategy.py due to 'No module named 'market_profile''
2023-04-02 21:05:01,584 - freqtrade - ERROR - Impossible to load Strategy 'MarketProfileStrategy'. This class does not exist or contains Python code errors.

I know that my strategy has no Python code error as I can backtest it on my virutalenv but I got a weird error saying that futures trading is not supported on bybit even thought I am currently running another strategy in live on bybit. This is why I am trying to run it on docker so I have the latest version for sure of freqtrade.

Thank you very much to anyone taking the time to read my issue, really apprieciate your help @xmatthias , seen you on every issue raised and helped me a lot getting into freqtrade.

PS : Here is my config file if needed

Config.json

{
    "max_open_trades": 10,
    "stake_currency": "USDT",
    "stake_amount": "unlimited",
    "tradable_balance_ratio": 0.5,
    "fiat_display_currency": "EUR",
    "dry_run": true,
    "dry_run_wallet": 50,
    "cancel_open_orders_on_exit": false,
    "trading_mode": "futures",
    "margin_mode": "isolated",
    "unfilledtimeout": {
        "entry": 10,
        "exit": 10,
        "exit_timeout_count": 0,
        "unit": "minutes"
    },
    "entry_pricing": {
        "price_side": "same",
        "use_order_book": true,
        "order_book_top": 1,
        "price_last_balance": 0.0,
        "check_depth_of_market": {
            "enabled": false,
            "bids_to_ask_delta": 1
        }
    },
    "exit_pricing":{
        "price_side": "same",
        "use_order_book": true,
        "order_book_top": 1
    },
    "exchange": {
        "name": "bybit",

        "ccxt_config": {"enableRateLimit": true},
        "ccxt_async_config": {},
        "pair_whitelist": ["BTC/USDT:USDT"],
        "pair_blacklist": ["BNB/<STAKE>"]
    },
    "pairlists": [
        {
            "method": "StaticPairList",
            "number_assets": 20,
            "sort_key": "quoteVolume",
            "min_value": 0,
            "refresh_period": 1800
        }
    ],
        "telegram": {
        "enabled": true,

    },
    "api_server": {
        "enabled": false,
        "listen_ip_address": "127.0.0.1",
        "listen_port": 8080,
        "verbosity": "error",
        "enable_openapi": false,

        "CORS_origins": [],
        "username": "freqtrader",
        "password": ""
    },
    "bot_name": "freqtrade",
    "initial_state": "running",
    "force_entry_enable": false,
    "internals": {
        "process_throttle_secs": 5
    },
    "futures_funding_rate": 0

}
xmatthias commented 1 year ago

please do not mix multiple issues that are not connected.

if your virtual environment says bybit does not support futures, then you're using an old version (or have some other missconfiguration). The version you specify does not correspond to the version the logs show - which is a first sign of a missconnect - which also proofs why different issues should not be mixed.

I'd also ask you to not use uppercase letters in issue titles. we'll close issues once we seem them as solved / once we get no answer. A screaming title will probably speed this process up (simply because it immediately reads unfriendly), causing the opposite effect than what you'd like


Now for your Module error - i think you're simply not using it correctly.

i've quickly tried to install it locally - and it doesn't seem to provide an import named market_profile. Best ask the module author how to install / use the module (unlikely to get a response, last commit was 5 years ago) - or ask the strategy author (you clearly didn't write that yourself, otherwise this wouldn't be a problem) what the CORRECT module is (this is not the one used in the strategy).

ThatFack commented 1 year ago

Hello Matias, I edited my title to uppercase because I solved the problem myslef and wanted to delete the issue but it seems we cannot so I decided to added a tag "DO NOT CONSIDER", I am sorry if you felt uncomfortable with it.

Thank you for taking the time to read and answer. I indeed write my strategy myself, I was just importing market_profile instead on MarketProfile because I ran several test on my environment and when I ran pip freeze | Select-String market I've seen that I had multiple market profile library and was importing the wrong one. Issue was solved sorry to reach out early I though I was missing something on Docker as I am quite new to it.

Thanks again!

xmatthias commented 1 year ago

it actually red "PLEASE DO NOT CONSIDER ISSUE SOLVED" - which does not hint at the fact that you solved the issue, but sounds like a command "dare you close this issue, it's not solved" ... 😆

While you can't delete issues - you can always do is close the issue yourself (close button at the bottom).

ThatFack commented 1 year ago

Ohhh indeed I apologize my english is not that good ahaha! Wish you a lovely day from France ahah and thanks again for your time! ;)