Skip to content
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

Poloniex API no longer accessible programmatically #4

Closed
ielashi opened this issue Nov 21, 2017 · 7 comments
Closed

Poloniex API no longer accessible programmatically #4

ielashi opened this issue Nov 21, 2017 · 7 comments

Comments

@ielashi
Copy link

ielashi commented Nov 21, 2017

Looks like the Poloniex API is no longer accessible programmatically. I'll look into alternative APIs and will try to follow up with a pull request for this.

@ZhengyaoJiang
Copy link
Owner

Looks like the Poloniex API is no longer accessible programmatically.

Did you mean you can't download training data?

@ielashi
Copy link
Author

ielashi commented Nov 21, 2017

Yes, download requests give a 403 now because Poloniex added a CAPTCHA to the API calls.

@ZhengyaoJiang
Copy link
Owner

Really? I've also tried to download training data just now, nothing strange happened though.

@ielashi
Copy link
Author

ielashi commented Nov 21, 2017

Interesting. I just tried it through a US proxy and it works. I guess that's a regional restriction that Poloniex has rolled out. Never mind then.

@dexhunter
Copy link
Collaborator

dexhunter commented Nov 21, 2017

Yes, download requests give a 403 now because Poloniex added a CAPTCHA to the API calls.

@ielashi Because you are in a IP-flagged area. Try use a VPN. I need to use proxy as well and it works just fine. You can also check this for more ideas to bypass the restriction.

Edit:

Really? I've also tried to download training data just now, nothing strange happened though.

@ZhengyaoJiang Your area is not restricted so nothing happens. But in mainland China and some other areas the problem exists.

@dexhunter
Copy link
Collaborator

dexhunter commented Nov 21, 2017

Since our work is reported by a Chinese news media. Here is a reference for future users who may need a proxy:

A quick fix looks like this (change line45-56 of poloniex.py)

import requests

    def api(self, command, args={}):
        """
        returns 'False' if invalid command or if no APIKey or Secret is specified (if command is "private")
        returns {"error":"<error message>"} if API error
        """
        proxies = {'http': 'socks5://127.0.0.1:1080', # socks5://<usr>:<pwd>@<addr>:<port>
                   'https': 'socks5://127.0.0.1:1080'} #use only if you are using **socks**

        if command in PUBLIC_COMMANDS:
            url = 'https://poloniex.com/public?'
            args['command'] = command
            return json.loads(requests.get(url+urlencode(args), proxies=proxies).text)
        else:
            return False

Edit:

Another way is to use transparent proxy, which is easier since no change of code needed.

@dexhunter
Copy link
Collaborator

Besides, you can use python-poloniex which supports private command as well. The latest version should cover proxy. You can check this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants