You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the decimal format for price of a coin is denominated in the file KrakenExchangeAdapter.java as:
DecimalFormat("#.########", getDecimalFormatSymbols()).format(price));
When trading XBT (Bitcoin) this formatting would for instance an error from the KrakenAPI and causing the trade to fail.
To solve the KrakenAPI should be queried to retrieve the allowed decimal precision for a specific coin this is traded or the allowed number of decimals should be configurable in the a Kraken specific YAML file.
Hard coded fix I applied myself for trading XBTEUR is this change in KrakenExchangeAdapter.Java:
if (orderType == OrderType.SELL) {
params.put(PRICE, new DecimalFormat("#.#", getDecimalFormatSymbols()).format(price));
} else {
params.put(PRICE, new DecimalFormat("#.########", getDecimalFormatSymbols()).format(price));
}
Note: you also need to change the unittests.
The text was updated successfully, but these errors were encountered:
Thanks for spotting this Roy. If you fancy having a go at a fix and PR, you're more than welcome. I've got a lot on at the moment, but I plan on releasing a maintenance/dependency update release of the bot in the Spring.
Fetch decimal price precision from kraken api use it for volume and
price when placing orders.
Fixes#126
Co-authored-by: gazbert <gazbert@users.noreply.github.com>
The Kraken API doesn't allow the same number of decimals for each coin. See https://support.kraken.com/hc/en-us/articles/360001389366-Price-and-volume-decimal-precision
Currently the decimal format for price of a coin is denominated in the file KrakenExchangeAdapter.java as:
DecimalFormat("#.########", getDecimalFormatSymbols()).format(price));
When trading XBT (Bitcoin) this formatting would for instance an error from the KrakenAPI and causing the trade to fail.
To solve the KrakenAPI should be queried to retrieve the allowed decimal precision for a specific coin this is traded or the allowed number of decimals should be configurable in the a Kraken specific YAML file.
Hard coded fix I applied myself for trading XBTEUR is this change in KrakenExchangeAdapter.Java:
if (orderType == OrderType.SELL) {
params.put(PRICE, new DecimalFormat("#.#", getDecimalFormatSymbols()).format(price));
Note: you also need to change the unittests.
The text was updated successfully, but these errors were encountered: