Quickstart to Deriv API

On this page, you’ll find code samples in various programming languages showing you how to work with the Deriv API to perform some of the most important operations.

You can find all of the other available calls in the API Playground.

Before you begin

  • Open a Deriv account (either a demo or real account).
  • Create a new token using the admin scope.
  • Register your app to receive your app_id or use app_id 1089 to test Deriv API.

Setting up your environment

Instructions for setting up your environment and running the examples in your desired programming language are given as comments in the code samples.

Buy contract

A contract is an agreement to buy or sell an asset at an agreed-upon price. This example shows you how to buy a contract using Deriv API.

copy code icon
Copy

Ticks

A tick is a measure of minimum upward or downward movement in the price of a trading commodity. This example shows you how to collect ticks for your trading app using Deriv’s API.

copy code icon
Copy

Account balance

This example shows you how to use the Deriv API to retrieve account balance information.

copy code icon
Copy

Proposal

This example is for getting a contract proposal. You’ll be able to get the price, payout and spot value for your contract.

To keep this connection alive in case of inactivity timeouts, see the example for Keep alive.

copy code icon
Copy

Keep alive

In this example you’ll see how to keep a connection alive when getting contract proposals via the Deriv API. This example keeps the connection alive by sending a ping every 30 seconds.

copy code icon
Copy