-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.html
123 lines (123 loc) · 5.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="ROBOTS" content="INDEX, FOLLOW" />
<meta name="VIEWPORT" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://saxobank.github.io/openapi-samples-js/assets/css/style.css">
<link rel="shortcut icon" type="image/x-icon" href="https://saxobank.github.io/openapi-samples-js/favicon.ico">
<script type="text/javascript" src="../../assets/js/boilerplate.js" defer></script>
<script type="text/javascript" src="demo.js" defer></script>
<title>Order Demo for Block Orders</title>
<style type="text/css" media="screen">
div.input-field {
width: 48%;
display: inline-block;
}
</style>
</head>
<body>
<section class="page-header">
<h1 class="project-name">Block Orders</h1>
<h2 class="project-tagline">Example on Block Orders and Allocation</h2>
<a href="https://saxobank.github.io/openapi-samples-js" class="btn">← Back to main page</a>
<a href="https://github.com/SaxoBank/openapi-samples-js/tree/main/orders/block-orders" class="btn">View on GitHub</a>
</section>
<section class="main-content">
<div class="highlight">
<label><span>Add token <a href="https://www.developer.saxo/openapi/token" target="_blank" id="idHrefRetrieveToken">from here</a> to the box below:</span><br />
<input type="text" class="token-field" id="idBearerToken" value="" placeholder="Paste token here.." autofocus /></label>
<input type="button" class="action-button" value="Validate" id="idBtnValidate" /><br />
<label>
Account: <select class="selector" id="idCbxAccount">
<option value="-">Click Validate to populate</option>
</select>
</label>
</div>
<h1>Block orders and trade allocation</h1>
This example shows how place a block order and allocate the position into a number of sub-accounts.
<br />
More info on block orders: <a href="https://www.developer.saxo/openapi/learn/block-orders" target="_blank">https://www.developer.saxo/openapi/learn/block-orders</a>.
<p class="note">Block trading is only available for specially configured accounts. To get a SIM-account configured for block trading, contact your Saxo Bank account manager.</p>
<br />
<br />
<label>
AllocationUnitType: <select class="selector" id="idCbxAllocationUnitType">
<option value="Percentage">Percentage (dangerous!)</option>
<option value="Unit" selected>Unit</option>
</select>
</label>
<div>
<div class="input-field">POST body with AllocationKey data:<br /><textarea class="json-input" id="idNewAllocationKeyObject" rows="13" wrap="off">
{
"AllocationKeyName": "MyAllocationKeyName",
"AllocationUnitType": "Unit",
"OwnerAccountKey": "(added on AllocationKey request)",
"MarginHandling": "Reduce",
"OneTime": false,
"ParticipatingAccountsInfo": [
{
"AcceptRemainderAmount": true,
"AccountKey": "(added on managed accounts request)",
"Priority": 1,
"UnitValue": 70003
},
{
"AcceptRemainderAmount": false,
"AccountKey": "(added on managed accounts request)",
"Priority": 2,
"UnitValue": 30000
}
]
}
</textarea></div>
<div class="input-field">POST body with Order data:<br /><textarea class="json-input" id="idNewOrderObject" rows="13" wrap="off">
{
"AccountKey": "(added on order request)",
"Uic": 21,
"OrderType": "Market",
"AssetType": "FxSpot",
"BuySell": "Buy",
"Amount": 100003,
"AllocationKeyId": "0",
"ExternalReference": "MyBlockOrderCorrelationId",
"ManualOrder": true,
"OrderDuration": {
"DurationType": "DayOrder"
}
}
</textarea></div>
</div>
Allocation key:<br />
<input type="button" class="action-button" value="Get managed accounts" id="idBtnGetAccountKeys" />
<input type="button" class="action-button" value="Get allocation keys" id="idBtnGetAllocationKeys" />
<input type="button" class="action-button" value="Create key" id="idBtnCreateAllocationKey" />
<br />
<label>
AllocationKey: <select class="selector" id="idCbxAllocationKey">
<option value="-" selected>Press "Get Allocation Keys" to populate</option>
</select>
</label>
<br />
<input type="button" class="action-button" value="Get key details" id="idBtnGetAllocationKeyDetails" />
<input type="button" class="action-button" value="Get distributed amount" id="idBtnGetDistributedAmount" />
<input type="button" class="action-button" value="Delete key" id="idBtnDeleteAllocationKey" />
<br />
Order:<br />
<input type="button" class="action-button" value="Precheck order" id="idBtnPreCheckOrder" />
<input type="button" class="action-button" value="Place order" id="idBtnPlaceNewOrder" />
<input type="button" class="action-button" value="Get order details" id="idBtnGetOrderDetails" />
<input type="button" class="action-button" value="Modify" id="idBtnModifyLastOrder" />
<input type="button" class="action-button" value="Cancel" id="idBtnCancelLastOrder" />
<br />
<input type="button" class="action-button" value="Get ENS events" id="idBtnHistoricalEnsEvents" />
<input type="button" class="action-button" value="Get trade messages" id="idBtnGetTradeMessages" />
<br />
<br />
Response: <pre class="highlight" id="idResponse">Click button to launch function.</pre>
<br />
JS code: <pre class="code-block" id="idJavaScript">Click button to show code.</pre>
<footer class="site-footer"><span class="site-footer-credits" id="idFooter"></span></footer>
</section>
</body>
</html>