Author

Topic: Bitstamp API failing by returning Incapsula CAPTCHA - workaround (Read 1729 times)

hero member
Activity: 609
Merit: 505

The emergency fix is as follows:
- Get a "clean" browser such as Firefox or Chrome by deleting all cookies
- Open the browser's developer console. Firefox has a cookies tab, which is what you need
- Go to the Bitstamp order book https://www.bitstamp.net/market/order_book/
- Complete the CAPTCHA that should be shown
- Copy the cookies into your trading system code
- Restart your trading system


Does this have to be done from the same IP address as you wish to use for the API calls going forward? In other words does Incapsula associate those cookies with a particular IP?
newbie
Activity: 2
Merit: 0
Note: You can keep up to date with any other technical issues I find and fixes here https://twitter.com/dominic_w

If you run a trading engine or system against Bitstamp, you will be making calls to its API.

PROBLEM 1 ~12am Nov 29 Pacific

Unfortunately the Bitstamp API is malfunctioning for a lot of people, with calls receiving the HTML page code for their Incapsula CAPTCHA system. Incapsula is something they have installed to control the load on their system, but clearly it should not be returning are-you-a-human test to API calls. Depending on what client library you are using, this manifests itself in various ways, but the end result is the same - your Bitstamp trading system is broken.

The emergency fix is as follows:
- Get a "clean" browser such as Firefox or Chrome by deleting all cookies
- Open the browser's developer console. Firefox has a cookies tab, which is what you need
- Go to the Bitstamp order book https://www.bitstamp.net/market/order_book/
- Complete the CAPTCHA that should be shown
- Copy the cookies into your trading system code
- Restart your trading system

e.g.
  if(method === 'post') {
    options.headers['Content-Length'] = data.length;
    options.headers['Content-Type'] = 'application/x-www-form-urlencoded';
    options.headers['Cookie'] = 'incap_ses_84_99025=3JyxGtdm/lCzPe1mM24qAS1VmFIAAAAFhg==; visid_incap_99025=x46CWDURpS3xoFKGL1L7mVhfVIAAAAAQAACA02dgARgGn7ZRUvYoE5BYkJZ8zgJhqWmP';
  }


PROBLEM 2 (possible)

I had an issue when I placed several small trades via the API. The API did not return an error message. However, the trades did not appear in my open orders, nor where they settled in my transactions. It is possible that this was related to the Incapsula problem and my system didn't catch error response but... couldn't convince myself of that because I had already included the cookie code and was making other API calls including orders fine. So... be warned..
 
Jump to: