Kucoin / kucoin-python-sdk

MIT License
40 stars 11 forks source link

send order with proxy #79

Open progmlp opened 1 year ago

progmlp commented 1 year ago

How to send a limit order request with a proxy in this module?

codewc commented 1 year ago

How to send a limit order request with a proxy in this module?

Hi, it is the requests library used by SDK, you can modify the source code to add proxis parameter to support.

progmlp commented 1 year ago

Hello Thanks for your answer. How can I modify this library to send requests with proxy? I try to do that but I can't solve this problem yet. Please help me if it's possible for you. Do you have any version of this library for using proxy?

در تاریخ دوشنبه ۱ اوت ۲۰۲۲،‏ ۱۱:۳۶ codewc @.***> نوشت:

How to send a limit order request with a proxy in this module?

Hi, it is the requests library used by SDK, you can modify the source code to add proxis parameter to support.

— Reply to this email directly, view it on GitHub https://github.com/Kucoin/kucoin-python-sdk/issues/79#issuecomment-1200799668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWQ225U3BV5RNKJZ6ARUO3VW5ZQ7ANCNFSM55DPSYLA . You are receiving this because you authored the thread.Message ID: @.***>

progressivehed commented 1 year ago

Hello

  1. First import the requests package.

  2. Create a proxies dictionary that defines the HTTP and HTTPS connections. This variable should be a dictionary that maps a protocol to the proxy URL. Additionally, make a URL variable set to the webpage you're scraping from. You may use the same syntax for different API calls, but regardless of the call you're making, you need to specify the protocol.

Example:

> 
> import requests
> 
> proxies = {
>    'http': 'http://proxy.example.com:8080',
>    'https': 'http://secureproxy.example.com:8090',
> }
> 
> url = 'http://mywebsite.com/example'
> 
> response = requests.post(url, proxies=proxies)

Requests Methods ✍️ response = requests.get(url) response = requests.post(url, data={"a": 1, "b": 2}) response = requests.put(url, data=put_body) response = requests.delete(url) response = requests.patch(url, data=patch_update) response = requests.head(url) response = requests.options(url)

Proxy Authentication 👩‍💻 If you need to add authentication, you can rewrite your code using the following syntax:

response = requests.get(url, auth=('user', 'pass'))

progressivehed commented 1 year ago

Please message me in API telegram group if you needed more help

progmlp commented 1 year ago

Hello

Thanks for your answer. I understand how to use proxy in requests package, but my problem is that I can't use proxy in kucoin-python library. In other word, how to change kucoin-python library for using proxy inside this library. So can you help me to change this library for using create-limit-order() method with proxy?

در تاریخ چهارشنبه ۳ اوت ۲۰۲۲،‏ ۱۹:۱۰ Hed @.***> نوشت:

Hello

1.

First import the requests package https://requests.readthedocs.io/en/master/. 2.

Create a proxies dictionary that defines the HTTP and HTTPS connections. This variable should be a dictionary that maps a protocol to the proxy URL. Additionally, make a URL variable set to the webpage you're scraping from. You may use the same syntax for different API calls, but regardless of the call you're making, you need to specify the protocol.

Example:

import requests

proxies = {

'http': 'http://proxy.example.com:8080',

'https': 'http://secureproxy.example.com:8090',

}

url = 'http://mywebsite.com/example'

response = requests.post(url, proxies=proxies)

Requests Methods ✍️ response = requests.get(url) response = requests.post(url, data={"a": 1, "b": 2}) response = requests.put(url, data=put_body) response = requests.delete(url) response = requests.patch(url, data=patch_update) response = requests.head(url) response = requests.options(url)

Proxy Authentication 👩‍💻 If you need to add authentication, you can rewrite your code using the following syntax:

response = requests.get(url, auth=('user', 'pass'))

— Reply to this email directly, view it on GitHub https://github.com/Kucoin/kucoin-python-sdk/issues/79#issuecomment-1204040035, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWQ222Z7DB3EWX2VEWLXTLVXKAF7ANCNFSM55DPSYLA . You are receiving this because you authored the thread.Message ID: @.***>

progressivehed commented 1 year ago

You can simply find all the source codes here:

https://github.com/Kucoin/kucoin-python-sdk/tree/master/kucoin

Just edit them based on your needs