kroitor,
First of all, thanks and salute to your great work!!
I am looking for the ways to implement proxying the IP to send concurrent fetchOrderBook requests in node code (using promise.all).
you guided the methods in php (curl_option in #2302 ) and python (python proxing in #906) versions, but I could not the find the same for node.js.
Currently I know php and node languages, and I will have to learn python for this feature if this is the case.
I don't want to use php either as it does not support asynch/concurrency, so node version is my only option.
I save "Improved proxy support" and "WebSocket interfaces:" in your pending list, but can't wait for my project, please guide available options.
Highly appreciated
Hi! )
but can't wait for my project, please guide available options.
Available options:
const ccxt = require ('ccxt')
const fetch = require ('node-fetch')
const yourImplementationOfFetchInterface = async function (url, options) {
// you can set all options supported by Node fetch here
// all fetch options are listed here: https://www.npmjs.com/package/node-fetch#options
return fetch (url, Object.assign ({}, options, { agent : yourProxyAgent })
}
const exchange = new ccxt.kraken ({'fetchImplementation': yourImplementationOfFetchInterface})
agent parameter to constructor to override it partially with just the proxying agent... const ccxt = require ('ccxt')
const https = require ('https')
class YourAgent extends https.Agent {
// ... add your proxy/ip overrides here according to `node-fetch` and `http(s).Agent` docs...
}
const exchange = new ccxt.kraken ({'agent': new YourAgent ()})
Let us know if this does not answer your question. Thx!
https://www.npmjs.com/package/https-proxy-agent
const ccxt = require ('ccxt')
, HttpsProxyAgent = require ('https-proxy-agent')
const proxy = process.env.http_proxy || 'http://168.63.76.32:3128' // HTTP/HTTPS proxy to connect to
const agent = new HttpsProxyAgent (proxy)
const kraken = new ccxt.kraken ({ agent })
Hello kroitor,
Thanks for the solutions, I am going to work on it as this is really a
life-saving help!
2 items I forgot to ask in the question:
Bunch of thanks.
On Fri, Apr 6, 2018 at 9:41 PM, Igor Kroitor notifications@github.com
wrote:
Hi! )
but can't wait for my project, please guide available options.
Available options:
- You can pass your fetch implementation to the exchange constructor,
and, basically, override everything you want in the networking internals,
including proxies, tunnelAgents, etc...const ccxt = require ('ccxt')
const yourImplementationOfFetchInterface = async function (url, options) {
// you can set all options supported by Node fetch here
}
const exchange = new ccxt.kraken ({'fetchImplementation': yourImplementationOfFetchInterface})
- You can pass the agent parameter to constructor to override it
partially with just the proxying agent...https://www.npmjs.com/package/node-fetch#options
Let us know if this does not answer your question. Thx!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ccxt/ccxt/issues/2480#issuecomment-379309437, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AhOtfH0JBGWmTVm6NF51_iporJt4ozgdks5tl5rAgaJpZM4TKVl_
.
Most helpful comment
Hi! )
Available options:
agentparameter to constructor to override it partially with just the proxying agent...Let us know if this does not answer your question. Thx!