Files
obsidian-vault/05 投资交易/docker运行freqtrade时的代理设置.md
2026-06-23 00:24:32 +08:00

1.9 KiB
Raw Permalink Blame History

#交易 #量化交易 #软件配置 #freqtrade #docker

docker运行freqtrade时和在linux与mac中的设置是不同的 直接运行在系统中时代理需要在config.json中配置 而在docker中时需要在docker-compose.yml中配置 经测试反而在config中配置后程序无法正确运行

---
services:
  freqtrade:
    image: freqtradeorg/freqtrade:stable
    # image: freqtradeorg/freqtrade:develop
    # Use plotting image
    # image: freqtradeorg/freqtrade:develop_plot
    # # Enable GPU Image and GPU Resources (only relevant for freqAI)
    # # Make sure to uncomment the whole deploy section
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: 1
    #           capabilities: [gpu]
    # 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
    # for more information.
    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
    environment:
      - HTTP_PROXY=http://127.0.0.1:7890
      - HTTPS_PROXY=http://127.0.0.1:7890
      - NO_PROXY=localhost,127.0.0.1,api.binance.com

配置完成后如上所示 重点在于environment的配置,这部分是增加进来的 还有一处要注意,是api.binance.com要添加进来,否则还是会被拦截,无法正常使用。