New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I get errors when I try to use proxy with ccxt #20686
Comments
@kerimSD Hello, from the log the Regarding the socks5 issue, can you double-check if your proxy works as expected outside ccxt? Also, we have made some updates to the proxies recently, can you update your ccxt version to make if it makes a difference? Also, you can read more about the proxies we support here: https://docs.ccxt.com/#/README?id=supported-proxy-types /cc @ttodua |
|
@ttodua @carlosmiei Could you try to use same proxy, to see if there is a problem with proxy or ccxt? (socks5://24.249.199.12:4145/) |
I ran into the same issue. Operating SystemmacOS 14.2.1 Programming LanguageTypescript CCXT version4.2.9 (latest) DescriptionI am getting same error with @kerimSD CodeI have put const proxyUrl = `http://${MY_PROXY_HOST}:80/`;
const okx = new ccxt.okx({ ...this.key, proxyUrl });
const [balances, positions] = await Promise.all([
(await okx.privateGetAccountBalance())["data"],
(await okx.privateGetAccountPositions())["data"],
]);
I also tried Test Proxy out of CCXTconst res1 = await axios.get("https://api.ipify.org?format=json");
console.log(JSON.stringify(res1["data"], undefined, 2));
const res2 = await axios.get("https://api.ipify.org?format=json", { proxy: { protocol: "http", host: MY_PROXY_HOST, port: 80 } });
console.log(JSON.stringify(res2["data"], undefined, 2)); This code worked fine. Ouput:
|
Using const httpAgent = new HttpProxyAgent(`http://${MY_PROXY_HOST}:80`);
const okx = new ccxt.okx({ ...this.key, httpAgent });
const [balances, positions] = await Promise.all([
(await okx.privateGetAccountBalance())["data"],
(await okx.privateGetAccountPositions())["data"],
]); It worked! But I still don't know why |
Yes, it looks like working fine but even though I put an IP access restriction to my API Key, it still makes the request. |
@kerimSD |
I don't understand that if proxies don't work in ccxt at all? |
@kerimSD const httpsProxy = `http://${MY_PROXY_HOST}:80`;
const okx = new ccxt.okx({ ...this.key, httpsProxy });
const [balances, positions] = await Promise.all([
(await okx.privateGetAccountBalance())["data"],
(await okx.privateGetAccountPositions())["data"],
]); |
@kerimSD We use proxies daily on our tests pipeline (both for Rest and WS), so I think it is safe to say that they work. |
@dooly9931 Thank you it worked! but I realise that only binance and gateio gives errors while using proxy, other exchanges like okx, kraken, huobi etc. are working fine. |
@kerimSD We do but for public queries, we are not sure if private ones have some kind of restriction, you might also try to change the proxy location to see if it makes a difference |
Guys, to check if proxies work for you, please see an example at https://github.com/ccxt/ccxt/tree/master/examples and find file |
hi everyone, Operating SystemmacOS 14.2.1 Programming LanguageVanilla JavaScript CCXT versionLatest DescriptionI'm using CCXT since 2022 in my backend nodejs project and works fine. I'm trying to implement CCXT browserside but i think i'm missing some points. I looked at the documents. when i tried @dooly9931's and @kerimSD's codes for binance i got the this error:
when i tried .proxyUrl i got this error:
btw okx works fine. CODE
|
Operating System
Windows
Programming Languages
JavaScript
CCXT Version
4.1.28
Description
I am trying to connect binance (also tried other exchanges) and retrieve my account balance by using a proxy. I've tested with http, https, socks5 proxies and with different implementations but even I can make any call without proxy, when I use proxy it gives error.
Could anyone help me about it?
Code
This code gives that error:
also this one gives the same error
I also tried this implementation it doesn't give any error but it seems it doesn't make request via proxy but make the request with my own IP. (I added IP access restriction to my API Key but it still makes the request)
The text was updated successfully, but these errors were encountered: