Ccxt: Kraken - 403 forbidden error when trying to get minimal orders

Created on 14 Apr 2020  ·  7Comments  ·  Source: ccxt/ccxt

Hello,

The Kraken integration seems broken for me since this update: https://github.com/ccxt/ccxt/commit/89ee033e90c10b500c098ce3ed5a440c39c33dad#diff-5e85c8f10126d08bcbd8c3138002c7c0
In the commit, "fetchMinLimitOrder" has been set to true.
But, Kraken has a protection mechanism that requires users to complete a captcha on their website to access pages. I think when this protection is enabled, Kraken fails to load markets.

Please tell me if I'm wrong in my thinking and whether a fix is possible.

Thank you,
Alex

duplicate question

Most helpful comment

@alextousss As indicated in Kroitor's response above, the min order size for Kraken is retrieved via Kraken support page - https://support.kraken.com/hc/en-us/articles/205893708-What-is-the-minimum-order-size-.

The html code from the Kraken support page is captured and the html tags <td class="wysiwyg-text-align-right"> is exploded into an array that is used to derive the min orders.

My short term fix (until Kraken adds the minimum order sizes to the REST API AssetPairs endpoint ) was to provide the html code directly to the fetch_min_order_amounts() function in the ccxt/kraken.php file.

Instead of $html = $this->zendeskGet205893708WhatIsTheMinimumOrderSize ();

I defined the variable $html with the text from the support page using a function that returned the relevant text.

I simply created the following function that returned the relevant html code copied from the kraken support page:

public function Minimum_Order_Size_Hard_Code(){

return '<td><strong>Base currency</strong></td>
<td class="wysiwyg-text-align-right"><strong>Order minimum</strong></td>
</tr>
<tr>
<td>Algorand</td>
<td class="wysiwyg-text-align-right">50 ALGO</td>
</tr>
<tr>
<td>Augur</td>
<td class="wysiwyg-text-align-right">0.3 REP</td>
</tr>
<tr>
<td>Basic Attention Token</td>
<td class="wysiwyg-text-align-right">50 BAT</td>
</tr>
<tr>
<td>Bitcoin</td>
<td class="wysiwyg-text-align-right">0.002 XBT</td>
</tr>
<tr>
<td>Bitcoin Cash</td>
<td class="wysiwyg-text-align-right">0.000002 BCH</td>
</tr>
<tr>
<td>Cardano</td>
<td class="wysiwyg-text-align-right">1 ADA</td>
</tr>
<tr>
<td>Chainlink</td>
<td class="wysiwyg-text-align-right">10 LINK</td>
</tr>
<tr>
<td>Cosmos</td>
<td class="wysiwyg-text-align-right">1 ATOM</td>
</tr>
<tr>
<td>DAI</td>
<td class="wysiwyg-text-align-right">10 DAI</td>
</tr>
<tr>
<td>Dash</td>
<td class="wysiwyg-text-align-right">0.03 DASH</td>
</tr>
<tr>
<td>Dogecoin</td>
<td class="wysiwyg-text-align-right">3000 XDG</td>
</tr>
<tr>
<td>EOS</td>
<td class="wysiwyg-text-align-right">3 EOS</td>
</tr>
<tr>
<td>Ethereum</td>
<td class="wysiwyg-text-align-right">0.02 ETH</td>
</tr>
<tr>
<td>Ethereum Classic</td>
<td class="wysiwyg-text-align-right">0.3 ETC</td>
</tr>
<tr>
<td>Gnosis</td>
<td class="wysiwyg-text-align-right">0.02 GNO</td>
</tr>
<tr>
<td>ICON</td>
<td class="wysiwyg-text-align-right">50 ICX</td>
</tr>
<tr>
<td>Lisk</td>
<td class="wysiwyg-text-align-right">10 LSK</td>
</tr>
<tr>
<td>Litecoin</td>
<td class="wysiwyg-text-align-right">0.1 LTC</td>
</tr>
<tr>
<td>Monero</td>
<td class="wysiwyg-text-align-right">0.1 XMR</td>
</tr>
<tr>
<td>Nano</td>
<td class="wysiwyg-text-align-right">10 NANO</td>
</tr>
<tr>
<td>OmiseGO</td>
<td class="wysiwyg-text-align-right">10 OMG</td>
</tr>
<tr>
<td>PAX Gold</td>
<td class="wysiwyg-text-align-right">0.01 PAXG</td>
</tr>
<tr>
<td>QTUM</td>
<td class="wysiwyg-text-align-right">0.1 QTUM</td>
</tr>
<tr>
<td>Ripple</td>
<td class="wysiwyg-text-align-right">30 XRP</td>
</tr>
<tr>
<td>Siacoin</td>
<td class="wysiwyg-text-align-right">5000 SC</td>
</tr>
<tr>
<td>Stellar Lumens</td>
<td class="wysiwyg-text-align-right">30 XLM</td>
</tr>
<tr>
<td>Tether</td>
<td class="wysiwyg-text-align-right">5 USDT</td>
</tr>
<tr>
<td>Tezos</td>
<td class="wysiwyg-text-align-right">1 XTZ</td>
</tr>
<tr>
<td>Tron</td>
<td class="wysiwyg-text-align-right">500 TRX</td>
</tr>
<tr>
<td>USD Coin</td>
<td class="wysiwyg-text-align-right">5 USDC</td>
</tr>
<tr>
<td>Watermelon</td>
<td class="wysiwyg-text-align-right">0.1 MLN</td>
</tr>
<tr>
<td>Waves</td>
<td class="wysiwyg-text-align-right">10 WAVES</td>
</tr>
<tr>
<td>Zcash</td>
<td class="wysiwyg-text-align-right">0.03 ZEC</td>
</tr>
<tr>
<td>Euro</td>
<td class="wysiwyg-text-align-right">10 EUR</td>
</tr>
<tr>
<td>US Dollar</td>
<td class="wysiwyg-text-align-right">10 USD</td>
</tr>
<tr>
<td>Great British Pound</td>
<td class="wysiwyg-text-align-right">10 GBP</td>
</tr>
</tbody>';
}

and then defined the $html variable in the fetch_min_order_amounts() function n the ccxt/kraken.php file with a call to the above function:

public function fetch_min_order_amounts() {
$html =  $this->Minimum_Order_Size_Hard_Code();
...

This fix of course is not ideal, as the workaround will automatically be lost when ccxt is updated, but it works. Also, this fix does not represent a material change to the code, and can easily be added to any future updates.

All 7 comments

This has been reported previously, here:

Kraken's official answer:

we are aware of the recent issue that CCXT experienced when a security change to our support pages prevented the minimum order sizes from being retrieved via our support pages. Our REST API developers are in the process of adding the minimum order sizes to the REST API AssetPairs endpoint, which would make the minimum order sizes available more efficiently (and more reliably). We do not yet have an expected availability date for this update, but I will keep track of the progress, and let you know when more information is available.

In the meantime, you can workaround the issue, by setting fetchMinOrderAmounts option to false.

exchange = ccxt.kraken({
    'enableRateLimit': True,
    'options': {  # ←--------------------- inside 'options' subkey
        'fetchMinOrderAmounts': False,  # ←---------- set to False 
    }
})

That way you will effectively lose the information about the minimal limits, but the other functionality will keep working.

Let me know if that does not answer the question.

I'm sorry for the duplicate, I only searched for "Kraken" in the issues tab when you marked my issue as Duplicate (there was no mention of Kraken on the front page of the issues).

However, yes, it confirms everything I thought. I fixed my production system by coming back to the version before the commit I mentioned. In the long run, I'll disable fetchMinOrderAmounts

Thank you for your response, and your broader involvement in ccxt.
It's not an easy task to unify 100 crypto exchange's APIs, but you've done it wonderfully. Hats off.

@alextousss thx for the feedback, really appreciate it! Don't hesitate if you have further questions. Will keep you updated and will let you know when it's fixed on the Kraken's side.

@alextousss As indicated in Kroitor's response above, the min order size for Kraken is retrieved via Kraken support page - https://support.kraken.com/hc/en-us/articles/205893708-What-is-the-minimum-order-size-.

The html code from the Kraken support page is captured and the html tags <td class="wysiwyg-text-align-right"> is exploded into an array that is used to derive the min orders.

My short term fix (until Kraken adds the minimum order sizes to the REST API AssetPairs endpoint ) was to provide the html code directly to the fetch_min_order_amounts() function in the ccxt/kraken.php file.

Instead of $html = $this->zendeskGet205893708WhatIsTheMinimumOrderSize ();

I defined the variable $html with the text from the support page using a function that returned the relevant text.

I simply created the following function that returned the relevant html code copied from the kraken support page:

public function Minimum_Order_Size_Hard_Code(){

return '<td><strong>Base currency</strong></td>
<td class="wysiwyg-text-align-right"><strong>Order minimum</strong></td>
</tr>
<tr>
<td>Algorand</td>
<td class="wysiwyg-text-align-right">50 ALGO</td>
</tr>
<tr>
<td>Augur</td>
<td class="wysiwyg-text-align-right">0.3 REP</td>
</tr>
<tr>
<td>Basic Attention Token</td>
<td class="wysiwyg-text-align-right">50 BAT</td>
</tr>
<tr>
<td>Bitcoin</td>
<td class="wysiwyg-text-align-right">0.002 XBT</td>
</tr>
<tr>
<td>Bitcoin Cash</td>
<td class="wysiwyg-text-align-right">0.000002 BCH</td>
</tr>
<tr>
<td>Cardano</td>
<td class="wysiwyg-text-align-right">1 ADA</td>
</tr>
<tr>
<td>Chainlink</td>
<td class="wysiwyg-text-align-right">10 LINK</td>
</tr>
<tr>
<td>Cosmos</td>
<td class="wysiwyg-text-align-right">1 ATOM</td>
</tr>
<tr>
<td>DAI</td>
<td class="wysiwyg-text-align-right">10 DAI</td>
</tr>
<tr>
<td>Dash</td>
<td class="wysiwyg-text-align-right">0.03 DASH</td>
</tr>
<tr>
<td>Dogecoin</td>
<td class="wysiwyg-text-align-right">3000 XDG</td>
</tr>
<tr>
<td>EOS</td>
<td class="wysiwyg-text-align-right">3 EOS</td>
</tr>
<tr>
<td>Ethereum</td>
<td class="wysiwyg-text-align-right">0.02 ETH</td>
</tr>
<tr>
<td>Ethereum Classic</td>
<td class="wysiwyg-text-align-right">0.3 ETC</td>
</tr>
<tr>
<td>Gnosis</td>
<td class="wysiwyg-text-align-right">0.02 GNO</td>
</tr>
<tr>
<td>ICON</td>
<td class="wysiwyg-text-align-right">50 ICX</td>
</tr>
<tr>
<td>Lisk</td>
<td class="wysiwyg-text-align-right">10 LSK</td>
</tr>
<tr>
<td>Litecoin</td>
<td class="wysiwyg-text-align-right">0.1 LTC</td>
</tr>
<tr>
<td>Monero</td>
<td class="wysiwyg-text-align-right">0.1 XMR</td>
</tr>
<tr>
<td>Nano</td>
<td class="wysiwyg-text-align-right">10 NANO</td>
</tr>
<tr>
<td>OmiseGO</td>
<td class="wysiwyg-text-align-right">10 OMG</td>
</tr>
<tr>
<td>PAX Gold</td>
<td class="wysiwyg-text-align-right">0.01 PAXG</td>
</tr>
<tr>
<td>QTUM</td>
<td class="wysiwyg-text-align-right">0.1 QTUM</td>
</tr>
<tr>
<td>Ripple</td>
<td class="wysiwyg-text-align-right">30 XRP</td>
</tr>
<tr>
<td>Siacoin</td>
<td class="wysiwyg-text-align-right">5000 SC</td>
</tr>
<tr>
<td>Stellar Lumens</td>
<td class="wysiwyg-text-align-right">30 XLM</td>
</tr>
<tr>
<td>Tether</td>
<td class="wysiwyg-text-align-right">5 USDT</td>
</tr>
<tr>
<td>Tezos</td>
<td class="wysiwyg-text-align-right">1 XTZ</td>
</tr>
<tr>
<td>Tron</td>
<td class="wysiwyg-text-align-right">500 TRX</td>
</tr>
<tr>
<td>USD Coin</td>
<td class="wysiwyg-text-align-right">5 USDC</td>
</tr>
<tr>
<td>Watermelon</td>
<td class="wysiwyg-text-align-right">0.1 MLN</td>
</tr>
<tr>
<td>Waves</td>
<td class="wysiwyg-text-align-right">10 WAVES</td>
</tr>
<tr>
<td>Zcash</td>
<td class="wysiwyg-text-align-right">0.03 ZEC</td>
</tr>
<tr>
<td>Euro</td>
<td class="wysiwyg-text-align-right">10 EUR</td>
</tr>
<tr>
<td>US Dollar</td>
<td class="wysiwyg-text-align-right">10 USD</td>
</tr>
<tr>
<td>Great British Pound</td>
<td class="wysiwyg-text-align-right">10 GBP</td>
</tr>
</tbody>';
}

and then defined the $html variable in the fetch_min_order_amounts() function n the ccxt/kraken.php file with a call to the above function:

public function fetch_min_order_amounts() {
$html =  $this->Minimum_Order_Size_Hard_Code();
...

This fix of course is not ideal, as the workaround will automatically be lost when ccxt is updated, but it works. Also, this fix does not represent a material change to the code, and can easily be added to any future updates.

@mjoh090 yes, hardcoding the limits is one of the ways to workaround this issue, when you really need that information.

From a broader perspective, would it be possible to have a "stable mode" that would disable that kind of feature that isn't relying on official and stable APIs? Is ccxt parsing help pages for other exchanges? This issue was already present for fees if I remember well and caused me a major headache.
If you build it, I will have better sleep ;-)

@alextousss yes, in general we are trying to make all "unofficial" endpoints optional, however, there may be some quirks still left in the derived exchanges – will do our best to clean it all up. I've switched it off for Kraken (in 1.26.20), so that option is now false by default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alpaykoray picture alpaykoray  ·  3Comments

gaardiolor picture gaardiolor  ·  3Comments

jjhesk picture jjhesk  ·  3Comments

Sarona93 picture Sarona93  ·  3Comments

jjhesk picture jjhesk  ·  3Comments