Create Book FX by currency
Create a Book FX using a currency pair of default accounts.
Definition
URL
POST https://api-test.instarem.com:4803/api/v1/bookfx/currency/create
Header Parameters
Parameter | Description | Type | Required |
---|---|---|---|
authorization token | auth token | String | Yes |
content-type | The Content-Type entity header is used to indicate the media type of the resource. Expected value is application/json. | String | Yes |
X-CLIENT-ID | Unique id for client generated by Nium, Required only in case of partner based model (E.g. 593feb7c7c52bb2357b2df6c). | String | No |
Example Request
- Bash
- Javascript
- C#
curl --request post \\
--url "https://api-test.instarem.com:4803/api/v1/bookfx/currency/create" \\
--data {
"sell_amount": 3478.7,
"request_id": "1XkQkI34DA",
"description": "Low balance in account.",
"buy_currency": "MYR",
"sell_currency": "USD",
"book_fx_type": "",
"fx_hold_id": "bf07da86-d6d5-47a4-b3c6-b77203b298e1"
}
--header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTgxMzQ4OTQsImRhdGEiOnsic3ViIjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWE1IiwiY2xpZW50IjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWExIn0sImlhdCI6MTQ5ODA0ODQ5NH0.pevwSDpk-JDNtVIpqFu_m0Xu1UnDVumrAYStcrxf8sM' \\
--header 'content-type: application/json' \\
var data = JSON.stringify({
"sell_amount": 3478.7,
"request_id": "1XkQkI34DA",
"description": "Low balance in account.",
"buy_currency": "MYR",
"sell_currency": "USD",
"book_fx_type": ""
})
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("post", "https://api-test.instarem.com:4803/api/v1/bookfx/currency/create")
xhr.setRequestHeader("authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTgxMzQ4OTQsImRhdGEiOnsic3ViIjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWE1IiwiY2xpZW50IjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWExIn0sImlhdCI6MTQ5ODA0ODQ5NH0.pevwSDpk-JDNtVIpqFu_m0Xu1UnDVumrAYStcrxf8sM");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);/_ Click to edit code
var client = new RestClient("https://api-test.instarem.com:4803/api/v1/bookfx/currency/create");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTgxMzQ4OTQsImRhdGEiOnsic3ViIjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWE1IiwiY2xpZW50IjoiNTk0MjNmMzZjZWEyMTQ2OTI2ODczOWExIn0sImlhdCI6MTQ5ODA0ODQ5NH0.pevwSDpk-JDNtVIpqFu_m0Xu1UnDVumrAYStcrxf8sM");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", @"{
""sell_amount"": 3478.7,
""request_id"": ""1XkQkI34DA"",
""description"": ""Low balance in account."",
""buy_currency"": ""MYR"",
""sell_currency"": ""USD"",
""book_fx_type"": """"
}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Body Parameters
Parameter | Description | Type | Required |
---|---|---|---|
buy_amount | Returns a requested amount or a computed amount. | Number | conditional |
sell_amount | Returns a requested amount or a computed amount. | Number | conditional |
request_id | A unique request ID specified by the client in the request. | String | Yes |
description | Narration for this Book FX request. | String | Yes |
buy_currency | Currency that the client buys (3-letter ISO-4217 code). | String | Yes |
sell_currency | Currency that the client sells (3-letter ISO-4217 code). | String | Yes |
book_fx_ type | One of ["", PREFUNDING, SCHEDULED1, SCHEDULED2]. Defaults to the client's default FX type if left empty. | String | No |
value_date | Custom time for trade execution in UTC. If specified, it must be less than 24 hours from the current time for Scheduled1 and between 24 and 48 hours for Scheduled2. For ex: 2022-04-14 10:10:10 | String | No |
fx__hold__id | Lock & Hold Id with schedule as SCHEDULE1 or SCHEDULE2 | String | No |
Example Response
{
"confirmation_id": "USD-MYR-SJtfvAOQb",
"buy_amount": 14921.71,
"sell_amount": 3478.7,
"from_account": 101950173983,
"to_account": 101950173170,
"buy_currency": "MYR",
"sell_currency": "USD",
"instarem_fx_rate": 4.2556,
"fx_rate": 4.277,
"margin_percent": 0.5,
"margin_value": 0.17323,
"created_at": "2017-06-22T05:35:13.387Z",
"expiry_at": "2017-04-12T06:33:30.887Z"
}
Response Parameters
Parameter | Description | Type |
---|---|---|
confirmation_id | Returns the unique confirmation ID generated by Instarem for successful Book Fx. | String |
buy_amount | Returns a requested amount or a computed amount. | Number |
sell_amount | Returns a requested amount or a computed amount. | Number |
from_account | Returns 12 digit account number for a specified buy currency generated by Instarem. | Number |
to_account | Returns 12 digit account number for a specified sell currency generated by Instarem. | Number |
buy_currency | Currency that the client buys (3-letter ISO-4217 code). | String |
sell_currency | Currency that the client sells (3-letter ISO-4217 code). | String |
instarem_fx_ rate | One of ["", PREFUNDING, SCHEDULED1, SCHEDULED2]. Defaults to the client's default FX type if left empty. | Number |
fx_rate | Returns real time FX provider rate | Number |
margin_percent | Returns margin percent as specified in the agreement for the book FX pair. | Number |
margin_value | Returns computed margin value for the book FX pair. | Number |
created_at | Date and time (UTC) of book FX. | String |
expiry_at | Date and time (UTC) when book FX expires. | String |