1

I try to call a function (sell/buy, whatever) through a proxy, but it gives an error. What am I doing wrong?

account_binance = ccxt.binance({
    'apiKey': API_KEY,
    'secret': API_SECRET,
    'enableRateLimit': True,
    'options': {
        'defaultType': 'spot'
    },
    'proxy': f'http://{login}:{password}@{ip}:3000'
})

1 Answers1

2

You can pass a new key proxies to the input where you can set your proxy information in both http and https modes. The correct format is 'host_name_or_ip:port_number'. Here is an example where I used v2ray proxy:

api_binance = ccxt.binance({
    'apiKey': API_KEY,
    'secret': API_SECRET,
    'proxies': {
        'http': '127.0.0.1:10809',
        'https': '127.0.0.1:10809',
    }
})
msamsami
  • 644
  • 5
  • 10
Dake Zhou
  • 21
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 27 '22 at 01:02