-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathui.R
204 lines (203 loc) · 8.03 KB
/
ui.R
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
203
204
## Copyright (C) 2015 Phil Stubbings <[email protected]>
## Licensed under the GPL v2 license. See LICENSE.md for full terms.
shinyUI(fluidPage(
includeCSS("www/bootstrap-slate.css"),
includeCSS("www/my.css"),
titlePanel("obAnalytics | Microstructure visualisation"),
sidebarLayout(
sidebarPanel(width=3,
dateInput("date",
label="",
value="2015-08-18",
min="2015-08-18",
max="2015-08-25"),
hr(),
plotOutput("overview.plot",
height="250px"),
hr(),
wellPanel(
h4("Time of day"),
sliderInput("time.point.h",
"Hour",
min=0,
max=23,
value=23,
step=1,
width="100%",
animate=animationOptions(interval=3000, loop=F)),
sliderInput("time.point.m",
"Minute",
min=0,
max=59,
value=30,
step=1,
width="100%",
animate=animationOptions(interval=3000, loop=F)),
sliderInput("time.point.s",
"Second",
min=0,
max=59,
value=0,
step=1,
width="100%",
animate=animationOptions(interval=3000, loop=F)),
sliderInput("time.point.ms",
"Millisecond",
min=0,
max=999,
value=0,
step=1,
width="100%",
animate=animationOptions(interval=3000, loop=F)),
verbatimTextOutput("time.point.out")),
hr(),
wellPanel(
selectInput("res",
"Time range",
list("15 seconds"=15,
"30 seconds"=30,
"1 minute"=60,
"5 minutes"=300,
"15 minutes"=900,
"30 minutes"=1800,
"1 hour"=3600,
"3 hours"=10800,
"6 hours"=21600,
"12 hours"=43200,
"1 day"=86399,
"custom"=0),
selected=3600)
),
conditionalPanel(
condition="input.res == 0",
wellPanel(
sliderInput("zoom.width",
"Zoom width",
min=1,
max=86399,
value=60,
step=1,
width="100%"),
verbatimTextOutput("zoom.width.out"))),
hr(),
conditionalPanel(
condition="input.histcheck",
wellPanel(
plotOutput("price.histogram.plot",
height="250px"),
plotOutput("volume.histogram..plot",
height="250px"))
),
wellPanel(
fluidRow(
column(6, selectInput("pvrange",
"Price & Volume range",
list("Auto"=1,
"Custom"=0))),
column(5, checkboxInput("histcheck",
label="Show histograms",
value=F)))),
conditionalPanel(
condition="input.pvrange == 0",
wellPanel(
fluidRow(
column(6, numericInput("price.from",
label="Price from",
value=0.01,
min=0.01,
max=999.99)),
column(6, numericInput("price.to",
label="Price to",
value=1000.00,
min=0.02,
max=1000.00))),
hr(),
fluidRow(
column(6, numericInput("volume.from",
label="Volume from",
value=0.00000001,
min=0.00000001,
max=99999.99999999)),
column(6, numericInput("volume.to",
label="Volume to",
value=100000,
min=0.00000002,
max=100000))),
actionButton("reset.range", label="Reset range")))),
mainPanel(width=9,
tabsetPanel(type="tabs", selected="Price level volume",
tabPanel("Order book",
wellPanel(
plotOutput("ob.depth.plot")),
hr(),
fluidRow(
column(6, align="right",
wellPanel(
tags$h3("Bids"),
hr(),
tableOutput("ob_bids_out"))),
column(6, align="left",
wellPanel(
tags$h3("Asks"),
hr(),
tableOutput("ob.asks.out"))))),
tabPanel("Price level volume",
wellPanel(
plotOutput("depth.map.plot", height="800px")),
conditionalPanel(
condition="input.showpercentiles == true",
wellPanel(
plotOutput("depth.percentile.plot", height="400px"))),
wellPanel(
fluidRow(
column(6,
checkboxInput("showtrades",
label="Show trades", value=F),
checkboxInput("showspread",
label="Show spread", value=F),
checkboxInput("showmidprice",
label="Show midprice", value=T),
checkboxInput("showalldepth",
label="Show resting orders", value=F),
checkboxInput("showpercentiles",
label="Show liquidity percentiles", value=T)),
column(4,
selectInput("depthbias",
"Colour bias",
list("Log10"=2,
"Custom"=0),
selected=0),
conditionalPanel(
condition="input.depthbias == 0",
numericInput("depthbias.value", label="bias", value=0.1)))))),
tabPanel("Order events",
wellPanel(
plotOutput("quote.map.plot", height="800px"))
),
tabPanel("Cancellations",
wellPanel(
plotOutput("cancellation.volume.map.plot",
height="800px"),
checkboxInput("logvol",
label="Logarithmic scale",
value=T))),
tabPanel("Trades",
wellPanel(
dataTableOutput(outputId="trades.out"))),
tabPanel("Events",
wellPanel(
dataTableOutput(outputId="events.out"))),
tabPanel("About",
wellPanel(
h1("About"),
p("This experimental tool/demo has been developed using the",
a("Shiny", href="http://shiny.rstudio.com/"),
"web application framework for R."),
p("It is based on", tags$b(a("obAnalytics",
href="https://github.com/phil8192/ob-analytics")),
"- an R package created to explore and visualise
limit order book data."),
br(),
p("Copyright", HTML("©"), "2015, Phil Stubbings."),
p(a("[email protected]", href="mailto:[email protected]")),
p(a("http://parasec.net", href="http://parasec.net")))))))))