Skip to content

Commit

Permalink
Merge branch 'master' into feature/integrate-translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandeep authored and Sandeep committed Jun 13, 2024
2 parents d3caa64 + 1052175 commit 4aff9c0
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 14 deletions.
2 changes: 2 additions & 0 deletions _data/v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ groups:
title: Update Contract History
- name: contracts_for
title: Contracts For Symbol
- name: contracts_for_company
title: Contracts For Company
- name: copy_start
title: 'Copy Trading: Start'
- name: copy_stop
Expand Down
3 changes: 3 additions & 0 deletions config/v3/contracts_for_company/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"contracts_for_company": 1
}
114 changes: 114 additions & 0 deletions config/v3/contracts_for_company/receive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Contracts For Company (response)",
"description": "Get the list of currently available contracts for a given landing company.",
"type": "object",
"required": [
"echo_req",
"msg_type"
],
"properties": {
"contracts_for_company": {
"title": "contracts_for_company",
"description": "List of available contracts for a given landing company.",
"type": "object",
"additionalProperties": false,
"required": [
"available",
"hit_count"
],
"properties": {
"available": {
"description": "List of available contracts.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"barrier_category",
"contract_category",
"contract_category_display",
"contract_display",
"contract_type",
"sentiment"
],
"properties": {
"barrier_category": {
"description": "Category of contract barrier.",
"type": "string",
"examples": [
"american",
"asian",
"euro_atm",
"euro_non_atm"
]
},
"contract_category": {
"description": "Category of contract.",
"type": "string",
"examples": [
"asian",
"callput"
]
},
"contract_category_display": {
"description": "Display name for the contract category, localized to selected language.",
"type": "string",
"examples": [
"Asians",
"Up/Down"
]
},
"contract_display": {
"description": "Display name for the contract, localized to selected language.",
"type": "string",
"examples": [
"Asian Up",
"Higher"
]
},
"contract_type": {
"description": "Type of contract.",
"type": "string",
"examples": [
"ASIANU",
"CALL"
]
},
"sentiment": {
"description": "Type of sentiment.",
"type": "string",
"examples": [
"differ",
"down",
"match",
"up"
]
}
}
},
"minItems": 1
},
"hit_count": {
"description": "Count of contracts available",
"type": "number"
}
}
},
"echo_req": {
"description": "Echo of the request made.",
"type": "object"
},
"msg_type": {
"description": "Action name of the request made.",
"type": "string",
"enum": [
"contracts_for_company"
]
},
"req_id": {
"description": "Optional field sent in request to map to response, present only when request contains `req_id`.",
"type": "integer"
}
}
}
46 changes: 46 additions & 0 deletions config/v3/contracts_for_company/send.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Contracts For Company (request)",
"description": "Get the list of currently available contracts for a given landing company.",
"type": "object",
"auth_required": 0,
"additionalProperties": false,
"required": [
"contracts_for_company"
],
"properties": {
"contracts_for_company": {
"description": "Must be `1`",
"type": "integer",
"enum": [
1
]
},
"landing_company": {
"description": "[Optional] Indicates which landing company to get a list of contracts for. If you are logged in, your account's landing company will override this field.",
"type": "string",
"default": "virtual",
"enum": [
"iom",
"malta",
"maltainvest",
"svg",
"virtual",
"vanuatu"
]
},
"loginid": {
"description": "[Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id.",
"type": "string",
"pattern": "^[A-Za-z]+[0-9]+$"
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field.",
"type": "object"
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
}
}
6 changes: 3 additions & 3 deletions docs/core-concepts/authorization-authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ Here is the visual representation of how the OAuth authorisation connection work

## The authentication process

In order to authenticate your user, specify the URL that will be used as the OAuth Redirect URL on the [Dashboard](/dashboard) page, **Register application** tab in the **OAuth details** fields. Then, add a login button on your website or app and direct users to **`https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id`** where your_app_id is the ID of your app.
In order to authenticate your user, specify the URL that will be used as the OAuth Authorisation URL on the [Dashboard](/dashboard) page, **Register application** tab in the **OAuth details** fields. Then, add a login button on your website or app and direct users to **`https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id`** where your_app_id is the ID of your app.

![Deriv OAuth Login](/img/oauth_login.png 'Deriv OAuth Login')

Once a user signs up/logs in, they will be redirected to the URL that you entered as the Redirect URL. This URL will have arguments added to it with the user's session tokens, and will look similar to this:
Once a user signs up/logs in, they will be redirected to the URL that you entered as the Authorisation URL. This URL will have arguments added to it with the user's session tokens, and will look similar to this:

`https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd`

## The authorisation process

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:
The query parameters in the Authorisation URL are the user's accounts and their related session tokens. You can map the query parameters to an array using the following approach:

```js showLineNumbers
const user_accounts = [
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/guides/about-the-deriv-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Here are the steps to use the Deriv API:

2. **Familiarise yourself with the API documentation**: The Deriv API provides comprehensive documentation that explains how to use the API endpoints, including the available parameters and response formats. Make sure you are familiar with the documentation before you start using the API.

3. **Create an API application**: To create an API application, you need to provide a name for your application and a redirect URI. The redirect URI is the URL that the user will be redirected to after they have authorised your application to access their Deriv account.
3. **Create an API application**: To create an API application, you need to provide a name for your application and a Authorisation URL. The Authorisation URL is the URL that the user will be redirected to after they have authorised your application to access their Deriv account.

4. **Authorise your application**: Once you have created your API application, you need to authorise it to access your Deriv account. This involves logging into your Deriv account and granting permission for your application to access your account data.

Expand Down
21 changes: 21 additions & 0 deletions docs/guides/monetizing-the-deriv-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,24 @@ There are several ways to monetize the Deriv API:
5. **Advertising**: If you have built a trading application that has a large user base, you could consider selling advertising space to relevant advertisers. This can be a good way to generate additional revenue.

6. **Markup**: Use the Deriv API to create your own websites and apps, and earn commissions on the trades and payments your clients make, monetizing your creations through markup.

## Markup

Boost your revenue by applying markups on every contract purchased through the trading app you've developed using the Deriv API. You can set the markup yourself, up to a maximum of 3%.

Supported trade types include: Options, Multipliers, and Accumulators.

Here's an example of how the markup is calculated:

To get a payout of **2.00 USD**:

- Client stake without markup = **1.07 USD**

With the markup (e.g. 2%), a client pays:

- Client's stake with the markup = Stake + (payout x markup)
- Client's stake with the markup = 1.07 USD + (2 USD x 2%) = **1.11 USD**

## Earning commission

Earn commissions on trades and payments made by your clients through the websites and apps you create with the Deriv API. Get more details about the commission plans [here](https://www.deriv.com/partners/affiliate-ib).
4 changes: 2 additions & 2 deletions docs/guides/oauth2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ For more information on OAuth2, [see this guide](https://aaronparecki.com/oauth-

### How to use OAuth authorisation

1. Specify the URL that will be used as the **OAuth Redirect URL** on the app registration page in the **Website URL field**.
1. Specify the URL that will be used as the **OAuth Authorisation URL** on the app registration page in the **Website URL field**.

2. Add a login button on your website or app and direct users to `https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id` where your_app_id is the ID of your app.

3. Once a user signs up, they will be redirected to the URL that you entered as the **Redirect URL**. This URL will have arguments added to it with the user's session tokens, and will look similar to: `https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd&state=`
3. Once a user signs up, they will be redirected to the URL that you entered as the **Authorisation URL**. This URL will have arguments added to it with the user's session tokens, and will look similar to: `https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd&state=`

4. In the parameters of the URL, you will see all the accounts and the session token for each account. Pass these tokens to the Authorize API call in order to perform actions on behalf of the account.
16 changes: 8 additions & 8 deletions docs/setting-up-a-deriv-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ You need a token with the `Admin` scope to create an application.

To create your application with the appropriate configuration options, select the **Register Application** tab in the Dashboard. You can make changes to your application's configuration at anytime in the **Manage Applications** tab.

| App information field | Description |
| --------------------- | -------------------------------------------------------------------------------------------------- |
| Account | The account you want to create the application with |
| API Token | The API token you want to create the application with |
| App Name | Application name |
| Markup | The commission added to the trade price to earn additional income |
| Authorisation URL | The URL that enables clients to log in to your app using their Deriv accounts without an API token |
| Verification URL | The OAuth redirect URL for the OAuth authorisation |
| App information field | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account | The account you want to create the application with |
| API Token | The API token you want to create the application with |
| App Name | Application name |
| Markup | The commission added to the trade price to earn additional income |
| Authorisation URL | The URL that enables clients to log in to your app using their Deriv accounts without an API token |
| Verification URL | Used for email verification. If provided, the URL with the verification token is sent to the user's email; otherwise, the Authentication URL is used. |

**To create an application, follow these steps:**

Expand Down

0 comments on commit 4aff9c0

Please sign in to comment.