bn-lightweight-charts 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,14 @@
19
19
  Cantarell, "Helvetica Neue", sans-serif;
20
20
  }
21
21
 
22
+ td.dt0, td.dt1, td.dt {
23
+ cursor: pointer;
24
+ text-decoration: underline;
25
+ }
26
+ td.dt0, td.dt1{
27
+ color: blue;
28
+ }
29
+
22
30
  .tableview {
23
31
  background: darkgrey;
24
32
  color: black;
@@ -165,6 +173,30 @@
165
173
  return []
166
174
  }
167
175
  }
176
+
177
+ function scrollToTime(chart, stm0, stm1)
178
+ {
179
+ const tm0 = (new Date((stm0+":00").replace(' ','T')+'Z')).getTime()/1000
180
+ const tm1 = stm1 ? (new Date((stm1+":00").replace(' ','T')+'Z')).getTime()/1000 : null
181
+
182
+ const scale = chart.timeScale()
183
+ const tc0 = scale.timeToCoordinate(tm0)
184
+ if (tc0) {
185
+ const idx0 = scale.coordinateToLogical(tc0)
186
+ if (tm1) {
187
+ const tc1 = scale.timeToCoordinate(tm1)
188
+ if (tc1) {
189
+ const idx1 = scale.coordinateToLogical(tc1)
190
+ scale.setVisibleLogicalRange({ from: idx0 - 5, to: idx1 + 5 });
191
+ document.querySelector("#nav-home-tab").click();
192
+ }
193
+ }
194
+ else {
195
+ scale.setVisibleLogicalRange({ from: idx0 - 5, to: idx0 + 200 + 5 });
196
+ document.querySelector("#nav-home-tab").click();
197
+ }
198
+ }
199
+ }
168
200
  </script>
169
201
  </body>
170
202
  </html>
@@ -259,8 +259,8 @@ class HTMLChart_BN(StaticLWC):
259
259
  }}
260
260
  const pos = v.size > 0 ? 'Long' : 'Short';
261
261
  _html += `<tr><td>${{v.ref}}</td> <td>${{pos}}</td><td>${{v.tradeid}}</td>`
262
- +`<td>${{v.dateopen}}</td><td>${{v.priceopen}}</td>`
263
- +`<td>${{v.dateclose}}</td><td>${{v.priceclose}}</td>`
262
+ +`<td class="dt0">${{v.dateopen}}</td><td>${{v.priceopen}}</td>`
263
+ +`<td class="dt1">${{v.dateclose}}</td><td>${{v.priceclose}}</td>`
264
264
  +`<td>${{v.pnlcomm}}</td><td>${{v.return_pct}}</td><td>${{v.commission}}</td>`
265
265
  +`<td>${{v.barlen}}</td></tr>`;
266
266
  }}
@@ -274,7 +274,7 @@ class HTMLChart_BN(StaticLWC):
274
274
  state = 1;
275
275
  }}
276
276
  const pos = v.o_ordtype===0 ? 'Buy' : 'Sell';
277
- _html += `<tr><td>${{v.o_ref}}</td><td>${{v.o_datetime}}</td><td>${{pos}}</td>`
277
+ _html += `<tr><td>${{v.o_ref}}</td><td class="dt">${{v.o_datetime}}</td><td>${{pos}}</td>`
278
278
  +`<td>${{v.o_price}}</td><td>${{v.o_size}}</td></tr>`;
279
279
  }}
280
280
  }}
@@ -314,6 +314,25 @@ class HTMLChart_BN(StaticLWC):
314
314
  }}
315
315
  }}
316
316
  document.querySelectorAll('#slist a')[0]?.click()
317
+
318
+ document.querySelector('#trades tbody').ondblclick = (e) => {{
319
+ const n = e.target;
320
+ const chart = {self.id}.chart;
321
+ if (n.nodeName==='TD' && n.classList.contains('dt0')) {{
322
+ const dt0 = n.innerText
323
+ const dt1 = n.parentNode.querySelector('td.dt1')?.innerText
324
+ scrollToTime(chart, dt0, dt1)
325
+ }}
326
+ else if (n.nodeName==='TD' && n.classList.contains('dt1')) {{
327
+ const dt1 = n.innerText
328
+ const dt0 = n.parentNode.querySelector('td.dt0')?.innerText
329
+ scrollToTime(chart, dt0, dt1)
330
+ }}
331
+ else if (n.nodeName==='TD' && n.classList.contains('dt')) {{
332
+ const dt0 = n.innerText
333
+ scrollToTime(chart, dt0)
334
+ }}
335
+ }}
317
336
  \n</script></body></html>
318
337
  '''
319
338
  return html_code
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bn-lightweight-charts
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Python framework for TradingView's Lightweight Charts JavaScript library.
5
5
  Project-URL: Homepage, https://github.com/smalinin/bn_lightweight-charts-python
6
6
  Project-URL: Source, https://github.com/smalinin/bn_lightweight-charts-python
@@ -7,13 +7,13 @@ bn_lightweight_charts/table.py,sha256=72OMLQrUlWfJ7iz7VurexmWrXGzV1vkr_tpjPkm3DU
7
7
  bn_lightweight_charts/toolbox.py,sha256=PhvpXOW_tDAxDcG94uIGBK_f6gFjNH9h1xHKzQNo5zU,1521
8
8
  bn_lightweight_charts/topbar.py,sha256=nSC5_geDvJfjAJ3eBtZs7cRElhXBt7ODDBnJIGnhdJM,4660
9
9
  bn_lightweight_charts/util.py,sha256=KAvHsw-1NY0CUKynUnoQWTvuTGaKWa2_-4DI9ajYNpI,8074
10
- bn_lightweight_charts/widgets.py,sha256=YmT5MKWhVegflsWMCeb78hfdxnSwB3yCU29g2jNT060,13967
10
+ bn_lightweight_charts/widgets.py,sha256=yiMDDfvOslPRyqV1OMa6RUidioGsV4lnjUQ_izxJNRA,14826
11
11
  bn_lightweight_charts/js/bundle.js,sha256=AQyl4kOKB7g4t0wEyvaynUcMyXulUksGMjf1Bk42FKA,50708
12
12
  bn_lightweight_charts/js/index.html,sha256=aErKo-Pbn6esUJ5zwl66NvGhOp00Br3kP6Bejxw9sG4,1475
13
- bn_lightweight_charts/js/index_bn.html,sha256=JLZVPnYycpyi_-geWTemBD5fE9DQ2XHu08iwa6bIS6M,7230
13
+ bn_lightweight_charts/js/index_bn.html,sha256=7RGt-6spy0HDhIhG509HChCnZ5RjruxuKfjkYqYqKDQ,8326
14
14
  bn_lightweight_charts/js/lightweight-charts.js,sha256=19vIfLfo_MW1TWxMB1NbNp82m9S84zrJd0A3R1CQl6U,180587
15
15
  bn_lightweight_charts/js/styles.css,sha256=hpr57ZOGU_Wibag2rrB6GyvObQkr6d8ySyaSLs9UnZI,4811
16
- bn_lightweight_charts-1.0.0.dist-info/METADATA,sha256=cCVFLjoPLPGSQrr3M5FgV_F_GToOxdW5XRI9996pvHE,9994
17
- bn_lightweight_charts-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
- bn_lightweight_charts-1.0.0.dist-info/licenses/LICENSE,sha256=c1BNniz3_GfGwKHblopMfeUQ2uiORYkfH33m7el-x7o,1094
19
- bn_lightweight_charts-1.0.0.dist-info/RECORD,,
16
+ bn_lightweight_charts-1.1.0.dist-info/METADATA,sha256=ASAwc77sz9XSDtOBHxvBRAOK6pvAxAFqb-l0Wa-gDk8,9994
17
+ bn_lightweight_charts-1.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
+ bn_lightweight_charts-1.1.0.dist-info/licenses/LICENSE,sha256=c1BNniz3_GfGwKHblopMfeUQ2uiORYkfH33m7el-x7o,1094
19
+ bn_lightweight_charts-1.1.0.dist-info/RECORD,,