REST and WebSocket test environments
Our spot REST and WebSocket APIs (api.kraken.com) do not currently offer a test environment, but our futures REST and WebSocket APIs (futures.kraken.com) offer a full test environment using the API URL demo-futures.kraken.com.
Our spot WebSocket API offers a beta environment that can be used to test upcoming WebSocket API features, but note that the WebSocket beta environment is still linked to production Kraken accounts (placing an order on the WebSocket beta environment will place a real order on your real account, for example).
Validate testing parameter
When placing an order via the REST API AddOrder or WebSocket API addOrder endpoints, the validate input parameter can be used to simulate the order.
Calling AddOrder/addOrder with the validate parameter set to true (validate=1, validate=true, validate=anything, etc.) will cause the order details to be checked for errors, but the API response will never include an order ID (which would always be returned for a successful order without the validate parameter).
Example AddOrder call with the validate parameter (note the missing order ID):
$ ./krakenapi AddOrder pair=xdgusd type=buy ordertype=market volume=5000 validate=true{"error":[],"result":{"descr":{"order":"buy 5000.00000000 XDGUSD @ market"}}}
Small real orders and/or orders with extreme prices
For a comprehensive API test, we recommend placing very small market orders (orders for the minimum order size), or limit orders that are priced far away from the current market price (placing a limit order to sell ETH/USD at $800 when the market price is $200, for example).
Testing using live orders allows your API code to interact with our API in real world conditions, hence every aspect of the test will be accurate (how your orders affect the order book, etc.).