-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.html
202 lines (193 loc) · 7.95 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="https://saxobank.github.io/openapi-samples-js/favicon.ico" />
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui" />
<style>
#refreshIFrame {
display: none;
}
tbody tr:nth-of-type(even) {
background-color: rgba(0, 0, 0, 0.3);
}
tr.cancelled {
text-decoration: line-through;
}
.v-toolbar__title {
overflow: visible;
}
.blotterDateSelector {
width: 0;
}
</style>
<title>Saxo Order Manager</title>
</head>
<body>
<div id="app">
<v-app id="inspire">
<v-app-bar app clipped-left>
<img
src="https://www.home.saxo/-/media/global/logos/logo_vector_color-svg.svg?la=da-DK&hash=4D764EF4BF5FD260749C904CAEF5CCD0"
alt="Saxo Bank Logo" width="77" height="58"
></img>
 
 
 
<v-toolbar-title><h2>Saxo Order Manager</h2></v-toolbar-title>
<v-tabs v-model="page" align-with-title>
<v-tab>Open Orders</v-tab>
<v-tab>Trade Blotter</v-tab>
</v-tabs>
<v-btn v-if="loggedIn" v-on:click="logout">
Logout
<v-icon>mdi-logout</v-icon>
</v-btn>
<template v-else>
<v-btn v-on:click="login('sim')">
Login DEMO
<v-icon>mdi-test-tube</v-icon>
</v-btn>
 
 
 
<v-btn v-on:click="login('live')">
Login LIVE
<v-icon>mdi-flash</v-icon>
</v-btn>
</template>
</v-app-bar>
<v-content v-if="page === 0">
<v-container fluid>
<v-row>
<v-col>
<v-card>
<v-card-title>
Open Orders
<v-btn
v-if="loggedIn"
class="ml-3"
outlined
small
color="primary"
v-on:click="getOrders"
>Refresh</v-btn
>
<v-btn
v-if="this.orders.length > 0"
class="ml-3"
outlined
small
color="success"
v-on:click="downloadOrdersCsv"
>Export CSV</v-btn>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-text-field
v-model="orderSearch"
append-icon="mdi-magnify"
label="Search"
single-line
hide-details
></v-text-field>
</v-card-title>
<v-data-table
:headers="headers"
:items="orders"
item-key="OrderId"
:search="orderSearch"
class="elevation-1"
:loading="ordersLoading"
:items-per-page="itemsPerPage"
:footer-props="{
'items-per-page-options': [50, 100, 150, 200]
}"
dark
dense
>
<template v-slot:item="{ item, headers }">
<tr :class="item.cancelled ? 'cancelled' : ''">
<td v-for="header in headers">
<v-btn v-if="header.value === 'actions' && !item.cancelled" x-small class="mr-2" @click="cancelOrder(item)" outlined color="warning">
Cancel
</v-btn>
<template v-else>
{{item[header.value]}}
</template>
</td>
</tr>
</template>
<template v-slot:no-data>
<v-alert v-if="loggedIn">
It looks like you have no orders in your portfolio.
</v-alert>
<v-alert v-else>
Log in using the buttons above to load your orders. Note: app credentials should be added to script.js to log into the LIVE environment.
</v-alert>
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</v-container>
</v-content>
<v-content v-if="page === 1">
<v-container fluid>
<v-row>
<v-col>
<v-card>
<v-card-title>
Trade Blotter
<v-select class="blotterDateSelector ml-3 mr-3" :value="blotterDate" :items="blotterDates" @change="updateBlotterDate" label="Date" hide-details dense outlined single-line></v-select>
<v-btn v-if="loggedIn" class="ml-3" outlined small color="primary" v-on:click="getTrades">Refresh</v-btn>
<v-btn v-if="this.trades.length > 0" class="ml-3" outlined small color="success" v-on:click="downloadTradesCsv">
Export CSV</v-btn>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-text-field v-model="tradeSearch" append-icon="mdi-magnify" label="Search" single-line hide-details>
</v-text-field>
</v-card-title>
<v-data-table :headers="tradesHeaders" :items="trades" item-key="SequenceId" :search="tradeSearch" class="elevation-1"
:loading="tradesLoading" :items-per-page="itemsPerPage" :footer-props="{
'items-per-page-options': [50, 100, 150, 200]
}" dark dense>
<template v-slot:no-data>
<v-alert v-if="loggedIn">
It looks like you have no trades on {{blotterDate}}.
</v-alert>
<v-alert v-else>
Log in using the buttons above to load your trades. Note: app credentials should be added to script.js to log into the LIVE environment.
</v-alert>
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</v-container>
</v-content>
<v-snackbar top :timeout="snackbarTimeout" v-model="snackbar">
{{ snackbarMessage }}
<v-btn color="red" text @click="snackbar = false">
Close
</v-btn>
</v-snackbar>
</v-app>
</div>
<iframe id="refreshIFrame" src=""></iframe>
<script src="https://cdn.jsdelivr.net/npm/moment@2.26.0/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<script type="text/javascript" src="script.js" defer></script>
<script></script>
</body>
</html>