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
{{ message }}
This repository was archived by the owner on May 13, 2024. It is now read-only.
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.
23
+
<RenderOfficialContents>
24
+
<p>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.</p>
Copy file name to clipboardExpand all lines: docs/code-examples/javascript/ticks-history/index.mdx
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,16 @@ keywords:
16
16
description: Subscribe to Deriv API's ticks history feature to get past tick times and prices. Integrate this feature into your trading app with this API example.
The easiest way to understand how Deriv API works is to try our Tick call:
21
+
<RenderOfficialContents>
22
+
<p>The easiest way to understand how Deriv API works is to try our Tick call:</p>
23
+
</RenderOfficialContents>
21
24
22
25
<SandboxIframesandbox={sandboxes.ticks} />
23
26
24
-
We'll start with the ticks example because it's a pretty simple block of code to implement. You don't have to log into the Deriv account and get your app authenticated to try it.
27
+
<RenderOfficialContents>
28
+
<p>We'll start with the ticks example because it's a pretty simple block of code to implement. You don't have to log into the Deriv account and get your app authenticated to try it.</p>
29
+
</RenderOfficialContents>
25
30
26
-
A tick is a measure of minimum upward or downward movement in the price of a trading commodity. We subscribe to the ticks functionality from the Deriv API websocket, which will return new tick data every second. As an example you could create an interactive tick graph with this data.
31
+
<RenderOfficialContents>
32
+
<p>A tick is a measure of minimum upward or downward movement in the price of a trading commodity. We subscribe to the ticks functionality from the Deriv API websocket, which will return new tick data every second. As an example you could create an interactive tick graph with this data.</p>
Copy file name to clipboardExpand all lines: docs/core-concepts/api-calls-anatomy/index.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,9 @@ All API calls have a send functionality for making a request and receiving a res
23
23
24
24
Several API calls provide the `subscribe` functionality. When you subscribe to an API call, you will receive a continuous stream from data of this particular API call.
25
25
26
-
Some of these API calls automatically subscribe (e.g. [ticks](https://api.deriv.com/api-explorer#ticks)) and some have an optional `subscribe` field. If you pass `1` to the `subscribe` field, the subscription will start and the server will continue to send the requested data until you unsubscribe by calling the `Forget` or `Forget all` API calls.
26
+
Some of these API calls automatically subscribe (e.g. [ticks](/api-explorer#ticks)) and some have an optional `subscribe` field. If you pass `1` to the `subscribe` field, the subscription will start and the server will continue to send the requested data until you unsubscribe by calling the `Forget` or `Forget all` API calls.
27
27
28
-
For example, you can call [Tick History](https://api.deriv.com/api-explorer#ticks_history) to receive tick history data. But when you add the `subscribe` option to this call, you will receive the tick history data you requested in the first response, and you will continue to receive a new response every time there is a new tick published by the server for the given symbol.
28
+
For example, you can call [Tick History](/api-explorer#ticks_history) to receive tick history data. But when you add the `subscribe` option to this call, you will receive the tick history data you requested in the first response, and you will continue to receive a new response every time there is a new tick published by the server for the given symbol.
29
29
30
30
In the message stream from `subscribe`, there is a field called `subscription`. This is the `Stream ID`. With this ID, you can identify the message stream in your logic and stop the stream with `Forget` and `Forget All` API calls.
31
31
@@ -40,7 +40,7 @@ If you call the API with the `send` functionality, then the server will only sen
40
40
If you want to stop the message stream created by `subscribe`, you will have to call the `Forget` API call with the correct `Stream ID`. Otherwise, you can use the `Forget All` API call to stop streams by their `Method name`.
41
41
42
42
:::caution
43
-
For more information on the `Forget` API call, have a look at [Forget](https://api.deriv.com/api-explorer#forget) and [Forget All](https://api.deriv.com/api-explorer#forget_all) in the API explorer.
43
+
For more information on the `Forget` API call, have a look at [Forget](/api-explorer#forget) and [Forget All](/api-explorer#forget_all) in the API explorer.
44
44
:::
45
45
46
46
## Request data
@@ -63,15 +63,15 @@ A `Residence List` call returns a list of countries and 2-letter country codes,
63
63
64
64
The request data for this call is as below:
65
65
66
-
```ts
66
+
```ts showLineNumbers
67
67
{
68
68
residence_list: 1; // Api Call Method Name
69
69
passthrough?:object; // Optional
70
70
req_id?:number; // Optional
71
71
}
72
72
```
73
73
74
-
The `residence_list` field is the `method name` for the call and is required. There may be other required fields related to this type of the request you want to send. To know more about `Residence List` and other API calls, please check them out in [API Explorer](https://api.deriv.com/api-explorer#residence_list).
74
+
The `residence_list` field is the `method name` for the call and is required. There may be other required fields related to this type of the request you want to send. To know more about `Residence List` and other API calls, please check them out in [API Explorer](/api-explorer#residence_list).
75
75
76
76
### Optional fields
77
77
@@ -86,7 +86,7 @@ Whatever you pass to this field will be returned back to you inside a `response`
86
86
You may need to `tag` your requests and pass them through our `WebSocket` calls. You can do so by passing a `number` to this field. It can be helpful when you need to map `requests` to `responses`.
87
87
88
88
:::caution
89
-
To learn about additional optional fields specific to each API call, please refer to our [API Explorer](https://api.deriv.com/api-explorer).
89
+
To learn about additional optional fields specific to each API call, please refer to our [API Explorer](/api-explorer).
90
90
:::
91
91
92
92
## Response data
@@ -95,7 +95,7 @@ When you get the response for the call, there will be a `Field` with the same na
95
95
96
96
The response for the `Residence List` call:
97
97
98
-
```js
98
+
```js showLineNumbers
99
99
{
100
100
echo_req: {
101
101
req_id:1,
@@ -162,7 +162,7 @@ The response for the `Residence List` call:
162
162
};
163
163
```
164
164
165
-
Here the `residence_list` is the `method name`, and it contains the actual data you requested. To keep it short, we haven't included the rest of the array. You can check the actual response [here](https://api.deriv.com/api-explorer#residence_list).
165
+
Here the `residence_list` is the `method name`, and it contains the actual data you requested. To keep it short, we haven't included the rest of the array. You can check the actual response [here](/api-explorer#residence_list).
166
166
167
167
#### The `echo_req` field
168
168
@@ -172,7 +172,7 @@ This `Field` contains the exact `Request Data` you sent to the server.
172
172
173
173
This `Field` helps you determine which `message` data you're getting on the message event of the WebSocket connection. For example, your `onmessage` event handler for your WebSocket connection in `JavaScript` would be:
Copy file name to clipboardExpand all lines: docs/core-concepts/authorization-authentication/index.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Please refer to [Setting up a Deriv application](docs/setting-up-a-deriv-applica
33
33
34
34
An API token is a unique identifier of a client that requests access from a server. It's the simplest way of authorisation.
35
35
36
-
The access level for each API token has to match the required access level of each API call, which can be found in the [API Explorer](https://api.deriv.com/api-explorer) as well.
36
+
The access level for each API token has to match the required access level of each API call, which can be found in the [API Explorer](/api-explorer) as well.
37
37
38
38
For example, on the screenshot below, you can see that to be able to use the Account Status, a token with read access level must be used.
39
39
@@ -71,7 +71,7 @@ Once a user signs up/logs in, they will be redirected to the URL that you entere
71
71
72
72
The query parameters in the redirect URL are the user's accounts and their related session tokens. You can map the query parameters to an array using the following approach:
73
73
74
-
```js
74
+
```js showLineNumbers
75
75
constuser_accounts= [
76
76
{
77
77
account:'cr799393',
@@ -86,17 +86,17 @@ const user_accounts = [
86
86
];
87
87
```
88
88
89
-
To authorise the user based on the user's **selected** account, call the [authorize](https://api.deriv.com/api-explorer#authorize) API call with the user's **selected** account **session token**:
89
+
To authorise the user based on the user's **selected** account, call the [authorize](/api-explorer#authorize) API call with the user's **selected** account **session token**:
90
90
91
-
```js
91
+
```js showLineNumbers
92
92
{
93
93
"authorize":"a1-f7pnteezo4jzhpxclctizt27hyeot"
94
94
}
95
95
```
96
96
97
97
The response for the `authorize` call would be an object as below:
0 commit comments