ok
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -30,4 +30,5 @@ share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
MANIFEST
|
||||
strat.log
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
INFO: Started server process [56033]
|
||||
INFO: Waiting for application startup.
|
||||
INFO: Application startup complete.
|
||||
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
|
||||
INFO: Shutting down
|
||||
INFO: Waiting for application shutdown.
|
||||
INFO: Application shutdown complete.
|
||||
INFO: Finished server process [56033]
|
||||
@ -7,243 +7,240 @@
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<script src="/static/js/jquery.dataTables.min.js"></script>
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="mainConteiner">
|
||||
<div class="realtime">
|
||||
<h1>Realtime chart</h1>
|
||||
<h2>Your ID: <span id="ws-id"></span></h2>
|
||||
<h3>Status: <span id="status">Not connected</span></h3>
|
||||
<form action="" onsubmit="sendMessage(event)">
|
||||
<label>Runner ID: <input type="text" id="runnerId" autocomplete="off" value=""/></label>
|
||||
<button onclick="connect(event)" id="bt-conn">Connect</button>
|
||||
<button onclick="disconnect(event)" id="bt-disc" style="display: None">Disconnect</button>
|
||||
<hr>
|
||||
<label>Message: <input type="text" id="messageText" autocomplete="off"/></label>
|
||||
<button>Send</button>
|
||||
</form>
|
||||
<ul id='messages'>
|
||||
</ul>
|
||||
<div id="chart"></div>
|
||||
<div id="conteiner"></div>
|
||||
</div>
|
||||
|
||||
<div id="controls">
|
||||
<label>API-KEY: <input type="password" id="api-key" autocomplete="off"/></label>
|
||||
<button onclick="store_api_key(event)" id="bt-store">Store</button>
|
||||
</div>
|
||||
<div id="runner-table">
|
||||
<button id="button_pause" class="btn btn-success">Pause/Unpause</button>
|
||||
<button id="button_stop" class="btn btn-success">Stop</button>
|
||||
<button id="button_stopall" class="btn btn-success">Stop All</button>
|
||||
<button id="button_refresh" class="btn btn-success">Refresh</button>
|
||||
|
||||
<table id="runnerTable" class="display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Started</th>
|
||||
<th>Mode</th>
|
||||
<th>Account</th>
|
||||
<th>Paused</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="runnerModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="stopForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Stop Strategy</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group"
|
||||
<label for="runnerid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="runnerid" name="runnerid" placeholder="id">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" name="stop" id="stop" class="btn btn-info" value="stop" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main" class="mainConteiner flex-container">
|
||||
<div id="chartContainer" class="flex-items">
|
||||
<h4>Status: <span id="status">Not connected</span></h4>
|
||||
<div id="formular">
|
||||
<form action="">
|
||||
<input type="text" id="runnerId" autocomplete="off" placeholder="StrategyID" value=""/>
|
||||
<button onclick="connect(event)" id="bt-conn" class="btn btn-success">Connect</button>
|
||||
<button onclick="disconnect(event)" id="bt-disc" style="display: None" class="btn btn-success">Disconnect</button>
|
||||
<!-- <label>Message: --> <input type="text" id="messageText" autocomplete="off" placeholder="WS out message"/>
|
||||
<button onclick="sendMessage(event)" id="bt.send" class="btn btn-success">Send</button>
|
||||
</form>
|
||||
</div>
|
||||
<ul id='messages'>
|
||||
</ul>
|
||||
<div id="chart"></div>
|
||||
<div class="legend" id="legend"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="stratin-table">
|
||||
<button id="button_add" class="btn btn-success">Add</button><button id="button_edit" class="btn btn-success">Edit</button><button id="button_delete" class="btn btn-success">Delete</button><button id="button_run" class="btn btn-success">Run Strategy</button>
|
||||
<table id="stratinTable" class="display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Id2</th>
|
||||
<th>Name</th>
|
||||
<th>Symbol</th>
|
||||
<th>class</th>
|
||||
<th>script</th>
|
||||
<th>OR</th>
|
||||
<th>CR</th>
|
||||
<th>Stratvars</th>
|
||||
<th>add_data</th>
|
||||
<th>note</th>
|
||||
<th>history</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="recordModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="recordForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Add Record</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group"
|
||||
<label for="id" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="id" name="id" placeholder="id" readonly>
|
||||
<div id="runner-table" class="flex-items">
|
||||
<div id="controls">
|
||||
<label>API-KEY: <input type="password" id="api-key" autocomplete="off"/></label>
|
||||
<button onclick="store_api_key(event)" id="bt-store" class="btn btn-success">Store</button>
|
||||
<button id="button_pause" class="btn btn-success">Pause/Unpause</button>
|
||||
<button id="button_stop" class="btn btn-success">Stop</button>
|
||||
<button id="button_stopall" class="btn btn-success">Stop All</button>
|
||||
<button id="button_refresh" class="btn btn-success">Refresh</button>
|
||||
</div>
|
||||
<div id="runner-table">
|
||||
<table id="runnerTable" class="display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Started</th>
|
||||
<th>Mode</th>
|
||||
<th>Account</th>
|
||||
<th>Paused</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="runnerModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="stopForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Stop Strategy</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="runnerid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="runnerid" name="runnerid" placeholder="id">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" name="stop" id="stop" class="btn btn-info" value="stop" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
<label for="id2" class="control-label">Id2</label>
|
||||
<input type="text" class="form-control" id="id2" name="id2" placeholder="id2" required>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
<label for="name" class="control-label">Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="symbol" class="control-label">symbol</label>
|
||||
<input type="text" class="form-control" id="symbol" name="symbol" placeholder="Symbol" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="class_name" class="control-label">class_name</label>
|
||||
<input type="text" class="form-control" id="class_name" name="class_name" placeholder="class_name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="script" class="control-label">script</label>
|
||||
<input type="text" class="form-control" id="script" name="script" placeholder="script" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="open_rush" class="control-label">open_rush</label>
|
||||
<input type="number" class="form-control" id="open_rush" name="open_rush" placeholder="open_rush" value=0 required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="close_rush" class="control-label">close_rush</label>
|
||||
<input type="number" class="form-control" id="close_rush" name="close_rush" placeholder="close_rush" value=0 required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="stratvars_conf" class="control-label">stratvars_conf</label>
|
||||
<textarea class="form-control" rows="8" id="stratvars_conf" name="stratvars_conf" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="add_data_conf" class="control-label">add_data_conf</label>
|
||||
<textarea class="form-control" rows="7" id="add_data_conf" name="add_data_conf" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="note" class="control-label">note</label>
|
||||
<textarea class="form-control" rows="2" id="note" name="note"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="history" class="control-label">history</label>
|
||||
<textarea class="form-control" rows="3" id="history" name="history"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<!--<input type="hidden" name="id" id="id" />-->
|
||||
<!--<input type="hidden" name="action" id="action" value="" />-->
|
||||
<input type="submit" name="save" id="save" class="btn btn-info" value="Save" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="delModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="delForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Delete Record</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group"
|
||||
<label for="delid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="delid" name="delid" placeholder="id">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" name="delete" id="delete" class="btn btn-info" value="Delete" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
<div id="stratin-table" class="flex-items">
|
||||
<div id="stratin-table">
|
||||
<button id="button_add" class="btn btn-success">Add</button><button id="button_edit" class="btn btn-success">Edit</button><button id="button_delete" class="btn btn-success">Delete</button><button id="button_run" class="btn btn-success">Run Strategy</button>
|
||||
<table id="stratinTable" class="display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Id2</th>
|
||||
<th>Name</th>
|
||||
<th>Symbol</th>
|
||||
<th>class</th>
|
||||
<th>script</th>
|
||||
<th>OR</th>
|
||||
<th>CR</th>
|
||||
<th>Stratvars</th>
|
||||
<th>add_data</th>
|
||||
<th>note</th>
|
||||
<th>history</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="recordModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="recordForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Add Record</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="id" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="id" name="id" placeholder="id" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="id2" class="control-label">Id2</label>
|
||||
<input type="text" class="form-control" id="id2" name="id2" placeholder="id2" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="name" class="control-label">Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="symbol" class="control-label">symbol</label>
|
||||
<input type="text" class="form-control" id="symbol" name="symbol" placeholder="Symbol" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="class_name" class="control-label">class_name</label>
|
||||
<input type="text" class="form-control" id="class_name" name="class_name" placeholder="class_name" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="script" class="control-label">script</label>
|
||||
<input type="text" class="form-control" id="script" name="script" placeholder="script" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="open_rush" class="control-label">open_rush</label>
|
||||
<input type="number" class="form-control" id="open_rush" name="open_rush" placeholder="open_rush" value=0 required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="close_rush" class="control-label">close_rush</label>
|
||||
<input type="number" class="form-control" id="close_rush" name="close_rush" placeholder="close_rush" value=0 required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="stratvars_conf" class="control-label">stratvars_conf</label>
|
||||
<textarea class="form-control" rows="8" id="stratvars_conf" name="stratvars_conf" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="add_data_conf" class="control-label">add_data_conf</label>
|
||||
<textarea class="form-control" rows="7" id="add_data_conf" name="add_data_conf" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="note" class="control-label">note</label>
|
||||
<textarea class="form-control" rows="2" id="note" name="note"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="history" class="control-label">history</label>
|
||||
<textarea class="form-control" rows="3" id="history" name="history"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<!--<input type="hidden" name="id" id="id" />-->
|
||||
<!--<input type="hidden" name="action" id="action" value="" />-->
|
||||
<input type="submit" name="save" id="save" class="btn btn-info" value="Save" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="runModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="runForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Run strategy</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group"
|
||||
<label for="runid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="runid" name="runid" placeholder="id" readonly>
|
||||
</div>
|
||||
<div id="delModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="delForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Delete Record</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="delid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="delid" name="delid" placeholder="id">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" name="delete" id="delete" class="btn btn-info" value="Delete" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
<label for="mode" class="control-label">Mode</label>
|
||||
<select class="form-control" id="mode" name="mode"><option value="paper">paper</option><option value="live">live</option><option value="backtest">backtest</option></select>
|
||||
</div>
|
||||
<div class="form-group"
|
||||
<label for="account" class="control-label">Account</label>
|
||||
<select class="form-control" id="account" name="account"><option value="ACCOUNT1">ACCOUNT1</option><option value="ACCOUNT2">ACCOUNT2</option></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="debug" class="control-label">debug</label>
|
||||
<select class="form-control" id="debug" name="debug"><option value="true">true</option><option value="false" selected>false</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bt_from" class="control-label">bt_from</label>
|
||||
<input type="datetime-local" class="form-control" id="bt_from" name="bt_from" placeholder="2023-04-06T09:00:00Z">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bt_to" class="control-label">bt_to</label>
|
||||
<input type="datetime-local" class="form-control" id="bt_to" name="bt_to" placeholder="2023-04-06T09:00:00Z">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cash" class="control-label">cash</label>
|
||||
<input type="number" class="form-control" id="cash" name="cash" placeholder="cash" value=0>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<!--<input type="hidden" name="id" id="id" />-->
|
||||
<!--<input type="hidden" name="action" id="action" value="" />-->
|
||||
<input type="submit" name="run" id="run" class="btn btn-info" value="Run" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="runModal" class="modal fade">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" id="runForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><i class="fa fa-plus"></i> Run strategy</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="runid" class="control-label">Id</label>
|
||||
<input type="text" class="form-control" id="runid" name="runid" placeholder="id" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mode" class="control-label">Mode</label>
|
||||
<select class="form-control" id="mode" name="mode"><option value="paper">paper</option><option value="live">live</option><option value="backtest">backtest</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="account" class="control-label">Account</label>
|
||||
<select class="form-control" id="account" name="account"><option value="ACCOUNT1">ACCOUNT1</option><option value="ACCOUNT2">ACCOUNT2</option></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="debug" class="control-label">debug</label>
|
||||
<select class="form-control" id="debug" name="debug"><option value="true">true</option><option value="false" selected>false</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bt_from" class="control-label">bt_from</label>
|
||||
<input type="datetime-local" class="form-control" id="bt_from" name="bt_from" placeholder="2023-04-06T09:00:00Z">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bt_to" class="control-label">bt_to</label>
|
||||
<input type="datetime-local" class="form-control" id="bt_to" name="bt_to" placeholder="2023-04-06T09:00:00Z">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cash" class="control-label">cash</label>
|
||||
<input type="number" class="form-control" id="cash" name="cash" placeholder="cash" value=0>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<!--<input type="hidden" name="id" id="id" />-->
|
||||
<!--<input type="hidden" name="action" id="action" value="" />-->
|
||||
<input type="submit" name="run" id="run" class="btn btn-info" value="Run" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript" src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"
|
||||
></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script>
|
||||
<script src="/static/js/mywebsocket.js"></script>
|
||||
<script src="/static/js/mychart.js"></script>
|
||||
<script src="/static/js/mytables.js"></script>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//const chartOptions = { layout: { textColor: 'black', background: { type: 'solid', color: 'white' } } };
|
||||
const chartOptions = { width: 800, height: 600}
|
||||
const chart = LightweightCharts.createChart(document.getElementById('conteiner'), chartOptions);
|
||||
const chartOptions = { width: 1200, height: 600}
|
||||
const chart = LightweightCharts.createChart(document.getElementById('chart'), chartOptions);
|
||||
chart.applyOptions({ timeScale: { visible: true, timeVisible: true, secondsVisible: true }, crosshair: {
|
||||
mode: LightweightCharts.CrosshairMode.Normal, labelVisible: true
|
||||
}})
|
||||
@ -28,15 +28,12 @@ const vwapSeries = chart.addLineSeries({
|
||||
|
||||
|
||||
//TBD dynamicky zobrazovat vsechny indikatory
|
||||
document.getElementById('conteiner').style.display = 'inline-block';
|
||||
var cont = document.getElementById('conteiner');
|
||||
var legend = document.createElement('div');
|
||||
legend.classList.add('legend');
|
||||
cont.appendChild(legend);
|
||||
//document.getElementById('chart').style.display = 'inline-block';
|
||||
var legendlist = document.getElementById('legend');
|
||||
var firstRow = document.createElement('div');
|
||||
firstRow.innerText = '-';
|
||||
// firstRow.style.color = 'white';
|
||||
legend.appendChild(firstRow);
|
||||
legendlist.appendChild(firstRow);
|
||||
|
||||
function pad(n) {
|
||||
var s = ('0' + n);
|
||||
@ -49,7 +46,15 @@ chart.subscribeCrosshairMove((param) => {
|
||||
const vwap = data.value !== undefined ? data.value : data.close;
|
||||
const bars = param.seriesData.get(candlestickSeries);
|
||||
const volumes = param.seriesData.get(volumeSeries);
|
||||
firstRow.innerText = 'VWAP' + ' ' + vwap.toFixed(2) + " O" + bars.open + " H" + bars.high + " L" + bars.low + " C" + bars.close + " V" + volumes.value;
|
||||
firstRow.innerText = "";
|
||||
//iterate of custom indicators dictionary to get values of custom lines
|
||||
// var customIndicator = {name: key, series: null}
|
||||
indList.forEach(function (item) {
|
||||
const ind = param.seriesData.get(item.series)
|
||||
firstRow.innerText += item.name + " " + ind.value + " ";
|
||||
});
|
||||
|
||||
firstRow.innerText += 'vwap' + ' ' + vwap.toFixed(2) + " o" + bars.open + " h" + bars.high + " l" + bars.low + " c" + bars.close + " v" + volumes.value;
|
||||
}
|
||||
else {
|
||||
firstRow.innerText = '-';
|
||||
|
||||
@ -9,10 +9,6 @@ function store_api_key(event) {
|
||||
}
|
||||
|
||||
function get_status(id) {
|
||||
|
||||
// for (val of stratinRecords.rows().iterator()) {
|
||||
// window.alert(JSON.stringify(val))
|
||||
// }
|
||||
var status = "stopped"
|
||||
runnerRecords.rows().iterator('row', function ( context, index ) {
|
||||
var data = this.row(index).data();
|
||||
@ -32,6 +28,18 @@ function get_status(id) {
|
||||
return status
|
||||
}
|
||||
|
||||
function is_running(id) {
|
||||
var running = false
|
||||
runnerRecords.rows().iterator('row', function ( context, index ) {
|
||||
var data = this.row(index).data();
|
||||
//window.alert(JSON.stringify(data))
|
||||
if (data.id == id) {
|
||||
running = true
|
||||
}
|
||||
//window.alert("found") }
|
||||
});
|
||||
return running
|
||||
}
|
||||
// alert(JSON.stringify(stratinRecords.data()))
|
||||
// arr = stratinRecords.data()
|
||||
// foreach(row in arr.rows) {
|
||||
@ -263,7 +271,13 @@ var stratinRecords =
|
||||
return '<i class="fas fa-check-circle">'+status+'</i>'
|
||||
},
|
||||
}],
|
||||
paging: false
|
||||
paging: false,
|
||||
// createdRow: function( row, data, dataIndex){
|
||||
// if (is_running(data.id) ){
|
||||
// alert("runner");
|
||||
// $(row).addClass('highlight');
|
||||
// }
|
||||
//}
|
||||
} );
|
||||
|
||||
//runner table
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
var indList = []
|
||||
var ws = null;
|
||||
function connect(event) {
|
||||
var runnerId = document.getElementById("runnerId")
|
||||
var indList = []
|
||||
try {
|
||||
ws = new WebSocket("ws://localhost:8000/runners/" + runnerId.value + "/ws?api_key=" + API_KEY);
|
||||
}
|
||||
@ -10,7 +10,7 @@ function connect(event) {
|
||||
}
|
||||
ws.onopen = function(event) {
|
||||
document.getElementById("status").textContent = "Connected to" + runnerId.value
|
||||
document.getElementById("bt-disc").style.display = "block"
|
||||
document.getElementById("bt-disc").style.display = "initial"
|
||||
document.getElementById("bt-conn").style.display = "none"
|
||||
}
|
||||
ws.onmessage = function(event) {
|
||||
@ -89,7 +89,7 @@ function connect(event) {
|
||||
ws.onclose = function(event) {
|
||||
document.getElementById("status").textContent = "Disconnected from" + runnerId.value
|
||||
document.getElementById("bt-disc").style.display = "none"
|
||||
document.getElementById("bt-conn").style.display = "block"
|
||||
document.getElementById("bt-conn").style.display = "initial"
|
||||
}
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
33
v2realbot/static/main.css
Normal file
33
v2realbot/static/main.css
Normal file
@ -0,0 +1,33 @@
|
||||
.flex-container {
|
||||
display: inline-grid;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: stretch;
|
||||
align-content: normal;
|
||||
}
|
||||
|
||||
.flex-items{
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: auto;
|
||||
align-self: auto;
|
||||
order: 0;
|
||||
margin-inline-start: 50px;
|
||||
}
|
||||
|
||||
.chartContainer {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.legend {
|
||||
position: absolute;
|
||||
color: #050505;
|
||||
left: 60px;
|
||||
top: 99px;
|
||||
z-index: 1;
|
||||
font-size: 16px;
|
||||
line-height: 18px;
|
||||
font-weight: 300;
|
||||
}
|
||||
Reference in New Issue
Block a user