API Kraken Futures | REST Private API

Connection

URL: https://futures.kraken.com/derivatives/api/v3

 

Authentication

REST Private API requires an API Key and API Secret, these values are provided by Kraken in your account.

  
Kraken.ApiKey := 'api key';
Kraken.ApiSecret := 'api secret';

 

Methods

EditOrderByOrderId

This endpoint allows editing an existing order for a currently listed Futures contract.

 

aOrderId: ID of the order you wish to edit

aSize: The size associated with the order

aLimitPrice: The limit price associated with the order.

aStopPrice: The stop price associated with a stop order. Required if old Order Type is Stop.


KrakenFutures.REST_API.EditOrderByOrderId('Order_Id', 2, 1000);

EditOrderByCliOrderId

This endpoint allows editing an existing order for a currently listed Futures contract.

 

aCliOrderId: The order identity that is specified from the user. It must be globally unique.

aSize: The size associated with the order

aLimitPrice: The limit price associated with the order.

aStopPrice: The stop price associated with a stop order. Required if Order Type is Stop.


KrakenFutures.REST_API.EditOrderByCliOrderId('Cli_Order_Id', 2, 1000);

SendMarketOrder

This endpoint allows to send a Market Order.

 

aSide: The direction of the order: buy or sell.

aSymbol: The symbol of the futures

aSize: The size associated with the order.


KrakenFutures.REST_API.SendMarketOrder(kosfBuy, 'PI_XBTUSD', 1);

SendLimitOrder

This endpoint allows to send a Limit Order.

 

aSide: The direction of the order: buy or sell.

aSymbol: The symbol of the futures

aSize: The size associated with the order.

aLimitPrice: The limit price associated with the order.


KrakenFutures.REST_API.SendLimitOrder(kosfBuy, 'PI_XBTUSD', 1, 1000);

SendStopOrder

This endpoint allows to send a Stop Order.

 

aSide: The direction of the order: buy or sell.

aSymbol: The symbol of the futures

aSize: The size associated with the order.

aStopPrice: The stop price associated with a stop order.

aLimitPrice: The limit price associated with the order.


KrakenFutures.REST_API.SendStopOrder(kosfBuy, 'PI_XBTUSD', 1, 1000, 900);

SendTakeProfitOrder

This endpoint allows to send a Take Profit Order.

 

aSide: The direction of the order: buy or sell.

aSymbol: The symbol of the futures

aSize: The size associated with the order.

aStopPrice: The stop price associated with a stop order.

aLimitPrice: The limit price associated with the order.


KrakenFutures.REST_API.SendTakeProfitOrder(kosfBuy, 'PI_XBTUSD', 1, 1000, 900);

SendOrder

This endpoint allows sending a limit, stop, take profit or immediate-or-cancel order for a currently listed Futures contract.

 

OrderType: select one of the following kotfLMT, kotfPOST, kotfMKT, kotfSTP, kotfTAKE_PROFIT, kotfIOC

Symbol: The symbol of the futures

Side: The direction of the order (buy or sell).

Size: The size associated with the order.

StopPrice: The stop price associated with a stop order.

LimitPrice: The limit price associated with the order.

TriggerSignal: If placing a Stop or TakeProfit order, the signal used for trigger, select one of the following kotsMark, kotsIndex, kotsLast

CliOrderId: The order identity that is specified from the user. It must be globally unique.

ReduceOnly: Set as true if you wish the order to only reduce an existing position. Any order which increases an existing position will be rejected. Default false.


oOrder := TsgcHTTPKrakenFuturesOrder.Create;
Try
  oOrder.Side := kosfBuy;
  oOrder.Symbol := 'PI_XBTUSD';
  oOrder.OrderType := kotfMKT;
  oOrder.Size := 1;
  KrakenFutures.REST_API.SendOrder(oOrder);  
Finally
  oOrder.Free;
End;

CancelOrderByOrderId

This endpoint allows cancelling an open order for a Futures contract.

 

aOrderId: ID of the order you wish to edit


KrakenFutures.REST_API.CancelOrderByOrderId('Order_Id');

CancelOrderByCliOrderId

This endpoint allows cancelling an open order for a Futures contract.

 

aCliOrderId: The order identity that is specified from the user. It must be globally unique.


KrakenFutures.REST_API.CancelOrderByCliOrderId('Cli_Order_Id');

GetFills

This endpoint returns information on filled orders for all futures contracts.

 

aLastFillDate: If not provided, returns the last 100 fills in any futures contract. If provided, returns the 100 entries before lastFillTime.


KrakenFutures.REST_API.GetFills('2020-07-22T13:45:00.000Z');

Transfer

This endpoint allows you to transfer funds between two margin accounts with the same collateral currency, or between a margin account and your cash account.

 

aFromAcocunt: The name of the cash or margin account to move funds from.

aToAcocunt: The name of the cash or margin account to move funds to.

aUnit: The unit to transfer.

aAmount: The amount to transfer.


KrakenFutures.REST_API.Transfer('FI_XBTUSD', 'cash', 'xbt', 1.5);

GetOpenPositions

This endpoint returns the size and average entry price of all open positions in Futures contracts. This includes Futures contracts that have matured but have not yet been settled.


KrakenFutures.REST_API.GetOpenPositions();

GetNotifications

This endpoint provides the platform's notifications.


KrakenFutures.REST_API.GetNotifications();

GetAccounts

This endpoint returns key information relating to all your Kraken Futures accounts which may either be cash accounts or margin accounts. This includes digital asset balances, instrument balances, margin requirements, margin trigger estimates and auxiliary information such as available funds, PnL of open positions and portfolio value.


KrakenFutures.REST_API.GetAccounts();

CancelAllOrders

This endpoint allows cancelling an open order for a Futures contract.

 

Symbol: A futures product to cancel all open orders (optional)


KrakenFutures.REST_API.CancelAllOrders();

CancelAllOrdersAfter

This endpoint provides a Dead Man's Switch mechanism to protect the client from network malfunctions. The client can send a request with a timeout in seconds which will trigger a countdown timer that will cancel all client orders when timeout expires.

 

aTimeout: The timeout specified in seconds.


KrakenFutures.REST_API.CancelAllOrdersAfter(60);

GetOpenOrders

This endpoint returns information on all open orders for all Futures contracts.


KrakenFutures.REST_API.OpenOrders();

GetHistoricalOrders

This endpoint returns historical orders made on an account.

 

aSince: The DateTime Since

aBefore: The DateTime Before

aSort: "asc" for ascending sort "desc" for descending

aContinuationToken: Continuation token provided from a prior response which can be used in call to return the next set of available results


KrakenFutures.REST_API.GetHistoricalOrders(Now, Now - 5);

GetHistoricalTriggers

This endpoint returns allows historical triggers made on an account.

 

aSince: The DateTime Since

aBefore: The DateTime Before

aSort: "asc" for ascending sort "desc" for descending

aContinuationToken: Continuation token provided from a prior response which can be used in call to return the next set of available results


KrakenFutures.REST_API.GetHistoricalTriggers(Now, Now - 5);

GetHistoricalExecutions

This endpoint returns allows historical executions made on an account.

 

aSince: The DateTime Since

aBefore: The DateTime Before

aSort: "asc" for ascending sort "desc" for descending

aContinuationToken: Continuation token provided from a prior response which can be used in call to return the next set of available results


KrakenFutures.REST_API.GetHistoricalExecutions(Now, Now - 5);

WithdrawalToSpotWallet

This endpoint allows submitting a request to withdraw digital assets from a Kraken Futures wallet to your Kraken Spot wallet.

 

aCurrency: The digital asset that shall be withdrawn, e.g. xbt or xrp.

aAmount: The amount of currency that shall be withdrawn.


KrakenFutures.REST_API.WithdrawalToSpotWallet('xbt', 1000);

GetFeeScheduleVolumes

This endpoint returns your 30-day USD volume.


KrakenFutures.REST_API.GetFeeScheduleVolumes();

GetAccountLogCSV

This endpoint allows clients to download a csv file of their account logs.


KrakenFutures.REST_API.GetAccountLogCSV();