Initial Commit
This commit is contained in:
commit
265d54a484
36 changed files with 109235 additions and 0 deletions
10724
src/main/resources/web/css/bootstrap.css
vendored
Normal file
10724
src/main/resources/web/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
7
src/main/resources/web/css/bootstrap.min.css
vendored
Normal file
7
src/main/resources/web/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
78
src/main/resources/web/index.tmpl
Normal file
78
src/main/resources/web/index.tmpl
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<title>Trader</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap.min.js">
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="apple-touch-icon" href="/docs/5.0/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
|
||||
<link rel="icon" href="/docs/5.0/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
|
||||
<link rel="icon" href="/docs/5.0/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
|
||||
<link rel="manifest" href="/docs/5.0/assets/img/favicons/manifest.json">
|
||||
<link rel="mask-icon" href="/docs/5.0/assets/img/favicons/safari-pinned-tab.svg" color="#7952b3">
|
||||
<link rel="icon" href="/docs/5.0/assets/img/favicons/favicon.ico">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
|
||||
<a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="#">Company name</a>
|
||||
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
|
||||
<ul class="navbar-nav px-3">
|
||||
<li class="nav-item text-nowrap">
|
||||
<a class="nav-link" href="#">Sign out</a>
|
||||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
|
||||
<div class="position-sticky pt-3">
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">
|
||||
<span data-feather="home"></span>
|
||||
Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<span data-feather="file"></span>
|
||||
Orders
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||
<span>Saved reports</span>
|
||||
<a class="link-secondary" href="#" aria-label="Add a new report">
|
||||
<span data-feather="plus-circle"></span>
|
||||
</a>
|
||||
</h6>
|
||||
<ul class="nav flex-column mb-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">
|
||||
<span data-feather="file-text"></span>
|
||||
Current month
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
|
||||
{{content}}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
6650
src/main/resources/web/js/bootstrap.bundle.js
vendored
Normal file
6650
src/main/resources/web/js/bootstrap.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
7
src/main/resources/web/js/bootstrap.bundle.min.js
vendored
Normal file
7
src/main/resources/web/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
90225
src/main/resources/web/js/echarts.js
Normal file
90225
src/main/resources/web/js/echarts.js
Normal file
File diff suppressed because it is too large
Load diff
45
src/main/resources/web/js/echarts.min.js
vendored
Normal file
45
src/main/resources/web/js/echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
0
src/main/resources/web/js/main.js
Normal file
0
src/main/resources/web/js/main.js
Normal file
226
src/main/resources/web/js/main_chart.js
Normal file
226
src/main/resources/web/js/main_chart.js
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
var echarts = require('echarts');
|
||||
|
||||
var ROOT_PATH = 'https://echarts.apache.org/examples';
|
||||
var UP_COLOR = '#00da3c';
|
||||
var DOWN_COLOR = '#ec0000';
|
||||
|
||||
|
||||
$.get(ROOT_PATH + '/data/asset/data/stock-DJI.json', function (rawData) {
|
||||
var data = splitData(rawData);
|
||||
initTradeChart(elementID, data)
|
||||
}
|
||||
|
||||
|
||||
function splitData(rawData) {
|
||||
var categoryData = [];
|
||||
var values = [];
|
||||
var volumes = [];
|
||||
for (var i = 0; i < rawData.length; i++) {
|
||||
categoryData.push(rawData[i].splice(0, 1)[0]);
|
||||
values.push(rawData[i]);
|
||||
|
||||
volumes.push([
|
||||
i,
|
||||
rawData[i][4],
|
||||
rawData[i][0] > rawData[i][1] ? 1 : -1
|
||||
]);
|
||||
}
|
||||
|
||||
return {
|
||||
categoryData: categoryData,
|
||||
values: values,
|
||||
volumes: volumes
|
||||
};
|
||||
}
|
||||
|
||||
function calculateMovingAverage(dayCount, data) {
|
||||
var result = [];
|
||||
for (var i = 0, len = data.values.length; i < len; i++) {
|
||||
if (i < dayCount) {
|
||||
result.push('-');
|
||||
continue;
|
||||
}
|
||||
var sum = 0;
|
||||
for (var j = 0; j < dayCount; j++) {
|
||||
sum += data.values[i - j][1];
|
||||
}
|
||||
result.push(+(sum / dayCount).toFixed(3));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function initTradeChart(elementID, data) {
|
||||
var chartDom = document.getElementById(elementID);
|
||||
var myChart = echarts.init(chartDom);
|
||||
|
||||
myChart.setOption({
|
||||
animation: false,
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
},
|
||||
borderWidth: 1,
|
||||
borderColor: '#ccc',
|
||||
padding: 10,
|
||||
textStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
position: function (pos, params, el, elRect, size) {
|
||||
var obj = {top: 10};
|
||||
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 30;
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
axisPointer: {
|
||||
link: {xAxisIndex: 'all'},
|
||||
label: {
|
||||
backgroundColor: '#777'
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
show: false,
|
||||
seriesIndex: 1,
|
||||
dimension: 2,
|
||||
pieces: [{
|
||||
value: 1,
|
||||
color: DOWN_COLOR
|
||||
}, {
|
||||
value: -1,
|
||||
color: UP_COLOR
|
||||
}]
|
||||
},
|
||||
grid: [
|
||||
{
|
||||
left: '10%',
|
||||
right: '8%',
|
||||
height: '50%'
|
||||
},
|
||||
{
|
||||
left: '10%',
|
||||
right: '8%',
|
||||
top: '58%',
|
||||
height: '13%'
|
||||
}
|
||||
],
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
data: data.categoryData,
|
||||
scale: true,
|
||||
boundaryGap: false,
|
||||
axisLine: {onZero: false},
|
||||
splitLine: {show: false},
|
||||
splitNumber: 20,
|
||||
min: 'dataMin',
|
||||
max: 'dataMax',
|
||||
axisPointer: {
|
||||
z: 100
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
gridIndex: 1,
|
||||
data: data.categoryData,
|
||||
scale: true,
|
||||
boundaryGap: false,
|
||||
axisLine: {onZero: false},
|
||||
axisTick: {show: false},
|
||||
splitLine: {show: false},
|
||||
axisLabel: {show: false},
|
||||
splitNumber: 20,
|
||||
min: 'dataMin',
|
||||
max: 'dataMax'
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
scale: true,
|
||||
},
|
||||
{
|
||||
scale: true,
|
||||
gridIndex: 1,
|
||||
splitNumber: 2,
|
||||
axisLabel: {show: false},
|
||||
axisLine: {show: false},
|
||||
axisTick: {show: false},
|
||||
splitLine: {show: false}
|
||||
}
|
||||
],
|
||||
dataZoom: [
|
||||
{
|
||||
type: 'inside',
|
||||
xAxisIndex: [0, 1],
|
||||
start: 98,
|
||||
end: 100
|
||||
},
|
||||
{
|
||||
show: true,
|
||||
xAxisIndex: [0, 1],
|
||||
type: 'slider',
|
||||
top: '85%',
|
||||
start: 98,
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: 'Dow-Jones index',
|
||||
type: 'candlestick',
|
||||
data: data.values,
|
||||
itemStyle: {
|
||||
color: UP_COLOR,
|
||||
color0: DOWN_COLOR,
|
||||
borderColor: null,
|
||||
borderColor0: null
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function (param) {
|
||||
param = param[0];
|
||||
return [
|
||||
'Date: ' + param.name + '<hr size=1 style="margin: 3px 0">',
|
||||
'Open: ' + param.data[0] + '<br/>',
|
||||
'Close: ' + param.data[1] + '<br/>',
|
||||
'Lowest: ' + param.data[2] + '<br/>',
|
||||
'Highest: ' + param.data[3] + '<br/>'
|
||||
].join('');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Volume',
|
||||
type: 'bar',
|
||||
xAxisIndex: 1,
|
||||
yAxisIndex: 1,
|
||||
data: data.volumes
|
||||
},
|
||||
{
|
||||
name: 'MA5',
|
||||
type: 'line',
|
||||
data: calculateMA(7, data),
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
opacity: 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'MA20',
|
||||
type: 'line',
|
||||
data: calculateMA(20, data),
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
opacity: 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'MA50',
|
||||
type: 'line',
|
||||
data: calculateMA(50, data),
|
||||
smooth: true,
|
||||
lineStyle: {
|
||||
opacity: 0.5
|
||||
}
|
||||
},
|
||||
]
|
||||
}, true);
|
||||
});
|
||||
27
src/main/resources/web/page_market_overview.tmpl
Normal file
27
src/main/resources/web/page_market_overview.tmpl
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<h1">Market Overview</h1>
|
||||
</div>
|
||||
|
||||
<h2>Open Trades</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1,001</td>
|
||||
<td>random</td>
|
||||
<td>data</td>
|
||||
<td>placeholder</td>
|
||||
<td>text</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
47
src/main/resources/web/page_market_symbol.tmpl
Normal file
47
src/main/resources/web/page_market_symbol.tmpl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<h1>Sign {{sign_name}}</h1>
|
||||
</div>
|
||||
|
||||
<canvas id="sign_chart" class="my-4 w-100" id="myChart" width="900" height="380"></canvas>
|
||||
|
||||
<h2>Open Trades</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
<th>Header</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1,001</td>
|
||||
<td>random</td>
|
||||
<td>data</td>
|
||||
<td>placeholder</td>
|
||||
<td>text</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1,002</td>
|
||||
<td>placeholder</td>
|
||||
<td>irrelevant</td>
|
||||
<td>visual</td>
|
||||
<td>layout</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1,003</td>
|
||||
<td>data</td>
|
||||
<td>rich</td>
|
||||
<td>dashboard</td>
|
||||
<td>tabular</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
initTradeChart("sign_chart", [])
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue