diff --git a/v2realbot/static/js/mychart.js b/v2realbot/static/js/mychart.js index b5832d0..d0a64e5 100644 --- a/v2realbot/static/js/mychart.js +++ b/v2realbot/static/js/mychart.js @@ -59,7 +59,11 @@ chart.subscribeCrosshairMove((param) => { }); firstRow.innerText += ' vwap' + ' ' + vwap.toFixed(2) + " O" + bars.open + " H" + bars.high + " L" + bars.low + " C" + bars.close + " V" + volumes.value + ""; - } + + //display timestamp in trade-timestamp input field + $('#trade-timestamp').val(param.time) + + } else { firstRow.innerText = '-'; } diff --git a/v2realbot/static/js/mytables.js b/v2realbot/static/js/mytables.js index 39eea32..3ee103c 100644 --- a/v2realbot/static/js/mytables.js +++ b/v2realbot/static/js/mytables.js @@ -9,6 +9,11 @@ function findCommonElements3(arr1, arr2) { return arr1.some(item => arr2.includes(item)) } +function set_timestamp(timestamp) { + //console.log(timestamp); + $('#trade-timestamp').val(timestamp); +} + //KEY shortcuts Mousetrap.bind('e', function() { $( "#button_edit" ).trigger( "click" ); @@ -222,6 +227,14 @@ $(document).ready(function () { }) }); + //on hover of each logline move timestamp to trade history input field + // $('.line').click(function () { + // timestamp = $(this).data("timestamp"); + // console.log(timestamp); + // $('#trade-timestamp').val(timestamp); + // }) + + //button refresh $('#button_refresh').click(function () { runnerRecords.ajax.reload(); diff --git a/v2realbot/static/js/mywebsocket.js b/v2realbot/static/js/mywebsocket.js index 5b503c3..395349a 100644 --- a/v2realbot/static/js/mywebsocket.js +++ b/v2realbot/static/js/mywebsocket.js @@ -82,7 +82,7 @@ function connect(event) { logcnt++; - row = '
'+logLine.time + " " + logLine.event + ' - '+ (logLine.message == undefined ? "" : logLine.message) +'
' + row = '
'+logLine.time + " " + logLine.event + ' - '+ (logLine.message == undefined ? "" : logLine.message) +'
' str_row = JSON.stringify(logLine.details, null, 2) //row_detail = '
' + str_row + '
' @@ -91,6 +91,7 @@ function connect(event) { var lines = document.getElementById('lines') var line = document.createElement('div') line.classList.add("line") + line.dataset.timestamp = logLine.time line.insertAdjacentHTML( 'beforeend', row ); line.insertAdjacentHTML( 'beforeend', row_detail ); diff --git a/v2realbot/strategy/__pycache__/StrategyOrderLimitVykladaci.cpython-310.pyc b/v2realbot/strategy/__pycache__/StrategyOrderLimitVykladaci.cpython-310.pyc index d78b5eb..9a896e1 100644 Binary files a/v2realbot/strategy/__pycache__/StrategyOrderLimitVykladaci.cpython-310.pyc and b/v2realbot/strategy/__pycache__/StrategyOrderLimitVykladaci.cpython-310.pyc differ diff --git a/v2realbot/strategy/__pycache__/base.cpython-310.pyc b/v2realbot/strategy/__pycache__/base.cpython-310.pyc index 56b12a1..5ab3345 100644 Binary files a/v2realbot/strategy/__pycache__/base.cpython-310.pyc and b/v2realbot/strategy/__pycache__/base.cpython-310.pyc differ diff --git a/v2realbot/strategy/base.py b/v2realbot/strategy/base.py index 5c9cf49..6799f2e 100644 --- a/v2realbot/strategy/base.py +++ b/v2realbot/strategy/base.py @@ -106,7 +106,7 @@ class Strategy: #propojujeme notifice s interfacem (pro callback) self.order_notifs.connect_callback(self) self.state = StrategyState(name=self.name, symbol = self.symbol, stratvars = self.stratvars, interface=self.interface, rectype=self.rectype) - + elif mode == Mode.BT: self.dataloader = Trade_Offline_Streamer(start, end, btdata=self.btdata) self.bt = Backtester(symbol = self.symbol, order_fill_callback= self.order_updates, btdata=self.btdata, cash=cash, bp_from=start, bp_to=end) @@ -121,6 +121,7 @@ class Strategy: return -1 self.mode = mode + self.state.mode = self.mode """SAVE record to respective STATE variables (bar or trades) ukládáme i index pro případné indikátory - pro zobrazení v grafu @@ -517,8 +518,12 @@ class StrategyState: self.iter_log_list = [] self.profit = 0 self.tradeList = [] + self.mode = None def ilog(self, e: str = None, msg: str = None, **kwargs): + if self.mode == Mode.LIVE or self.mode == Mode.PAPER: + self.time = datetime.now().timestamp() + if e is None: if msg is None: row = dict(time=self.time, details=kwargs)