binance-connector-ruby icon indicating copy to clipboard operation
binance-connector-ruby copied to clipboard

Allow calling binance API through a proxy

Open tiendo1011 opened this issue 2 years ago • 4 comments

I see you guys use Faraday to make a request, which supports calling through a proxy. Can you expose that functionality to the user?

I think allowing it through the Binance::Spot.new interface is one of the ways to go, users can set it just like they set the key & secret. It'll look like this: Binance::Spot.new(key: key, secret: secret, proxy_url: proxy_url)

tiendo1011 avatar Feb 22 '23 04:02 tiendo1011

@2pd what do you think about this?

tiendo1011 avatar Mar 23 '23 11:03 tiendo1011

I haven't tried this, but you should be able to add the http_proxy and/or https_proxy env variable.

The library used under the covers is faraday, and it should honor that env variable standard. https://github.com/binance/binance-connector-ruby/blob/master/lib/binance/session.rb#L87-L94

https://lostisland.github.io/faraday/usage/customize#Proxy:~:text=sort_params%20%3D%20false-,Proxy,-Faraday%20will%20try

blackjid avatar Mar 27 '23 17:03 blackjid

@blackjid yeah, I know that. That can be used as a workaround, but supporting proxy officially through the param will provide a much better experience to the lib user.

tiendo1011 avatar Mar 28 '23 01:03 tiendo1011

Agree 👍

blackjid avatar Mar 28 '23 01:03 blackjid