pinets 0.3.0 → 0.6.1

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.
Files changed (200) hide show
  1. package/README.md +50 -3
  2. package/dist/pinets.dev.browser.js +6429 -1434
  3. package/dist/pinets.dev.cjs +6525 -1418
  4. package/dist/pinets.dev.cjs.map +1 -1
  5. package/dist/pinets.dev.es.js +6527 -1415
  6. package/dist/pinets.dev.es.js.map +1 -1
  7. package/dist/pinets.min.browser.js +16 -11
  8. package/dist/pinets.min.cjs +16 -11
  9. package/dist/pinets.min.es.js +6 -1
  10. package/dist/types/Context.class.d.ts +79 -17
  11. package/dist/types/PineTS.class.d.ts +13 -1
  12. package/dist/types/marketData/Binance/BinanceProvider.class.d.ts +2 -1
  13. package/dist/types/marketData/IProvider.d.ts +43 -0
  14. package/dist/types/marketData/Mock/MockProvider.class.d.ts +13 -1
  15. package/dist/types/namespaces/Barstate.d.ts +13 -0
  16. package/dist/types/namespaces/Core.d.ts +16 -0
  17. package/dist/types/namespaces/Log.d.ts +10 -0
  18. package/dist/types/namespaces/Str.d.ts +23 -0
  19. package/dist/types/namespaces/Timeframe.d.ts +17 -0
  20. package/dist/types/namespaces/Types.d.ts +86 -0
  21. package/dist/types/namespaces/array/PineArrayObject.d.ts +102 -1
  22. package/dist/types/namespaces/array/array.index.d.ts +1 -129
  23. package/dist/types/namespaces/array/methods/avg.d.ts +2 -1
  24. package/dist/types/namespaces/array/methods/binary_search.d.ts +2 -0
  25. package/dist/types/namespaces/array/methods/binary_search_leftmost.d.ts +2 -0
  26. package/dist/types/namespaces/array/methods/binary_search_rightmost.d.ts +2 -0
  27. package/dist/types/namespaces/array/methods/covariance.d.ts +2 -1
  28. package/dist/types/namespaces/array/methods/every.d.ts +1 -1
  29. package/dist/types/namespaces/array/methods/fill.d.ts +2 -1
  30. package/dist/types/namespaces/array/methods/from.d.ts +1 -1
  31. package/dist/types/namespaces/array/methods/join.d.ts +5 -0
  32. package/dist/types/namespaces/array/methods/median.d.ts +2 -0
  33. package/dist/types/namespaces/array/methods/mode.d.ts +2 -0
  34. package/dist/types/namespaces/array/methods/new.d.ts +2 -1
  35. package/dist/types/namespaces/array/methods/new_float.d.ts +2 -1
  36. package/dist/types/namespaces/array/methods/new_int.d.ts +2 -1
  37. package/dist/types/namespaces/array/methods/percentile_linear_interpolation.d.ts +3 -0
  38. package/dist/types/namespaces/array/methods/percentile_nearest_rank.d.ts +2 -0
  39. package/dist/types/namespaces/array/methods/percentrank.d.ts +2 -0
  40. package/dist/types/namespaces/array/methods/push.d.ts +2 -1
  41. package/dist/types/namespaces/array/methods/range.d.ts +2 -1
  42. package/dist/types/namespaces/array/methods/set.d.ts +2 -1
  43. package/dist/types/namespaces/array/methods/some.d.ts +1 -1
  44. package/dist/types/namespaces/array/methods/sort.d.ts +2 -1
  45. package/dist/types/namespaces/array/methods/sort_indices.d.ts +2 -1
  46. package/dist/types/namespaces/array/methods/stdev.d.ts +2 -1
  47. package/dist/types/namespaces/array/methods/sum.d.ts +2 -1
  48. package/dist/types/namespaces/array/methods/unshift.d.ts +2 -1
  49. package/dist/types/namespaces/array/methods/variance.d.ts +2 -1
  50. package/dist/types/namespaces/array/utils.d.ts +5 -0
  51. package/dist/types/namespaces/input/methods/any.d.ts +1 -2
  52. package/dist/types/namespaces/input/methods/bool.d.ts +1 -2
  53. package/dist/types/namespaces/input/methods/color.d.ts +1 -2
  54. package/dist/types/namespaces/input/methods/enum.d.ts +1 -2
  55. package/dist/types/namespaces/input/methods/float.d.ts +1 -2
  56. package/dist/types/namespaces/input/methods/int.d.ts +1 -2
  57. package/dist/types/namespaces/input/methods/param.d.ts +1 -1
  58. package/dist/types/namespaces/input/methods/price.d.ts +1 -2
  59. package/dist/types/namespaces/input/methods/session.d.ts +1 -2
  60. package/dist/types/namespaces/input/methods/source.d.ts +1 -2
  61. package/dist/types/namespaces/input/methods/string.d.ts +1 -2
  62. package/dist/types/namespaces/input/methods/symbol.d.ts +1 -2
  63. package/dist/types/namespaces/input/methods/text_area.d.ts +1 -2
  64. package/dist/types/namespaces/input/methods/time.d.ts +1 -2
  65. package/dist/types/namespaces/input/methods/timeframe.d.ts +1 -2
  66. package/dist/types/namespaces/input/types.d.ts +12 -1
  67. package/dist/types/namespaces/input/utils.d.ts +14 -0
  68. package/dist/types/namespaces/map/PineMapObject.d.ts +26 -0
  69. package/dist/types/namespaces/map/map.index.d.ts +7 -0
  70. package/dist/types/namespaces/map/methods/clear.d.ts +3 -0
  71. package/dist/types/namespaces/map/methods/contains.d.ts +3 -0
  72. package/dist/types/namespaces/map/methods/copy.d.ts +3 -0
  73. package/dist/types/namespaces/map/methods/get.d.ts +3 -0
  74. package/dist/types/namespaces/map/methods/keys.d.ts +4 -0
  75. package/dist/types/namespaces/map/methods/new.d.ts +3 -0
  76. package/dist/types/namespaces/map/methods/param.d.ts +1 -0
  77. package/dist/types/namespaces/map/methods/put.d.ts +3 -0
  78. package/dist/types/namespaces/map/methods/put_all.d.ts +3 -0
  79. package/dist/types/namespaces/map/methods/remove.d.ts +3 -0
  80. package/dist/types/namespaces/map/methods/size.d.ts +3 -0
  81. package/dist/types/namespaces/map/methods/values.d.ts +4 -0
  82. package/dist/types/namespaces/math/math.index.d.ts +18 -0
  83. package/dist/types/namespaces/math/methods/abs.d.ts +2 -1
  84. package/dist/types/namespaces/math/methods/e.d.ts +5 -0
  85. package/dist/types/namespaces/math/methods/phi.d.ts +5 -0
  86. package/dist/types/namespaces/math/methods/pi.d.ts +5 -0
  87. package/dist/types/namespaces/math/methods/round_to_mintick.d.ts +2 -0
  88. package/dist/types/namespaces/math/methods/rphi.d.ts +5 -0
  89. package/dist/types/namespaces/math/methods/sign.d.ts +2 -0
  90. package/dist/types/namespaces/matrix/PineMatrixObject.d.ts +102 -0
  91. package/dist/types/namespaces/matrix/matrix.index.d.ts +7 -0
  92. package/dist/types/namespaces/matrix/methods/add_col.d.ts +3 -0
  93. package/dist/types/namespaces/matrix/methods/add_row.d.ts +3 -0
  94. package/dist/types/namespaces/matrix/methods/avg.d.ts +3 -0
  95. package/dist/types/namespaces/matrix/methods/col.d.ts +4 -0
  96. package/dist/types/namespaces/matrix/methods/columns.d.ts +3 -0
  97. package/dist/types/namespaces/matrix/methods/concat.d.ts +3 -0
  98. package/dist/types/namespaces/matrix/methods/copy.d.ts +3 -0
  99. package/dist/types/namespaces/matrix/methods/det.d.ts +3 -0
  100. package/dist/types/namespaces/matrix/methods/diff.d.ts +3 -0
  101. package/dist/types/namespaces/matrix/methods/eigenvalues.d.ts +4 -0
  102. package/dist/types/namespaces/matrix/methods/eigenvectors.d.ts +3 -0
  103. package/dist/types/namespaces/matrix/methods/elements_count.d.ts +3 -0
  104. package/dist/types/namespaces/matrix/methods/fill.d.ts +3 -0
  105. package/dist/types/namespaces/matrix/methods/get.d.ts +3 -0
  106. package/dist/types/namespaces/matrix/methods/inv.d.ts +3 -0
  107. package/dist/types/namespaces/matrix/methods/is_antidiagonal.d.ts +3 -0
  108. package/dist/types/namespaces/matrix/methods/is_antisymmetric.d.ts +3 -0
  109. package/dist/types/namespaces/matrix/methods/is_binary.d.ts +3 -0
  110. package/dist/types/namespaces/matrix/methods/is_diagonal.d.ts +3 -0
  111. package/dist/types/namespaces/matrix/methods/is_identity.d.ts +3 -0
  112. package/dist/types/namespaces/matrix/methods/is_square.d.ts +3 -0
  113. package/dist/types/namespaces/matrix/methods/is_stochastic.d.ts +3 -0
  114. package/dist/types/namespaces/matrix/methods/is_symmetric.d.ts +3 -0
  115. package/dist/types/namespaces/matrix/methods/is_triangular.d.ts +3 -0
  116. package/dist/types/namespaces/matrix/methods/is_zero.d.ts +3 -0
  117. package/dist/types/namespaces/matrix/methods/kron.d.ts +3 -0
  118. package/dist/types/namespaces/matrix/methods/max.d.ts +3 -0
  119. package/dist/types/namespaces/matrix/methods/median.d.ts +3 -0
  120. package/dist/types/namespaces/matrix/methods/min.d.ts +3 -0
  121. package/dist/types/namespaces/matrix/methods/mode.d.ts +3 -0
  122. package/dist/types/namespaces/matrix/methods/mult.d.ts +4 -0
  123. package/dist/types/namespaces/matrix/methods/new.d.ts +3 -0
  124. package/dist/types/namespaces/matrix/methods/param.d.ts +1 -0
  125. package/dist/types/namespaces/matrix/methods/pinv.d.ts +3 -0
  126. package/dist/types/namespaces/matrix/methods/pow.d.ts +3 -0
  127. package/dist/types/namespaces/matrix/methods/rank.d.ts +3 -0
  128. package/dist/types/namespaces/matrix/methods/remove_col.d.ts +4 -0
  129. package/dist/types/namespaces/matrix/methods/remove_row.d.ts +4 -0
  130. package/dist/types/namespaces/matrix/methods/reshape.d.ts +3 -0
  131. package/dist/types/namespaces/matrix/methods/reverse.d.ts +3 -0
  132. package/dist/types/namespaces/matrix/methods/row.d.ts +4 -0
  133. package/dist/types/namespaces/matrix/methods/rows.d.ts +3 -0
  134. package/dist/types/namespaces/matrix/methods/set.d.ts +3 -0
  135. package/dist/types/namespaces/matrix/methods/sort.d.ts +3 -0
  136. package/dist/types/namespaces/matrix/methods/submatrix.d.ts +3 -0
  137. package/dist/types/namespaces/matrix/methods/sum.d.ts +3 -0
  138. package/dist/types/namespaces/matrix/methods/swap_columns.d.ts +3 -0
  139. package/dist/types/namespaces/matrix/methods/swap_rows.d.ts +3 -0
  140. package/dist/types/namespaces/matrix/methods/trace.d.ts +3 -0
  141. package/dist/types/namespaces/matrix/methods/transpose.d.ts +3 -0
  142. package/dist/types/namespaces/request/methods/security.d.ts +1 -1
  143. package/dist/types/namespaces/request/methods/security_lower_tf.d.ts +9 -0
  144. package/dist/types/namespaces/request/request.index.d.ts +3 -0
  145. package/dist/types/namespaces/request/types/barmerge.type.d.ts +7 -0
  146. package/dist/types/namespaces/request/utils/findLTFContextIdx.d.ts +1 -0
  147. package/dist/types/namespaces/ta/getters/obv.d.ts +12 -0
  148. package/dist/types/namespaces/ta/methods/accdist.d.ts +7 -0
  149. package/dist/types/namespaces/ta/methods/alma.d.ts +18 -0
  150. package/dist/types/namespaces/ta/methods/atr.d.ts +2 -1
  151. package/dist/types/namespaces/ta/methods/barssince.d.ts +6 -0
  152. package/dist/types/namespaces/ta/methods/bb.d.ts +17 -0
  153. package/dist/types/namespaces/ta/methods/bbw.d.ts +9 -0
  154. package/dist/types/namespaces/ta/methods/cci.d.ts +20 -0
  155. package/dist/types/namespaces/ta/methods/cmo.d.ts +17 -0
  156. package/dist/types/namespaces/ta/methods/cog.d.ts +18 -0
  157. package/dist/types/namespaces/ta/methods/correlation.d.ts +7 -0
  158. package/dist/types/namespaces/ta/methods/cross.d.ts +15 -0
  159. package/dist/types/namespaces/ta/methods/cum.d.ts +14 -0
  160. package/dist/types/namespaces/ta/methods/dmi.d.ts +24 -0
  161. package/dist/types/namespaces/ta/methods/falling.d.ts +15 -0
  162. package/dist/types/namespaces/ta/methods/highestbars.d.ts +7 -0
  163. package/dist/types/namespaces/ta/methods/iii.d.ts +7 -0
  164. package/dist/types/namespaces/ta/methods/kc.d.ts +12 -0
  165. package/dist/types/namespaces/ta/methods/kcw.d.ts +11 -0
  166. package/dist/types/namespaces/ta/methods/lowestbars.d.ts +7 -0
  167. package/dist/types/namespaces/ta/methods/macd.d.ts +18 -0
  168. package/dist/types/namespaces/ta/methods/mfi.d.ts +15 -0
  169. package/dist/types/namespaces/ta/methods/mode.d.ts +6 -0
  170. package/dist/types/namespaces/ta/methods/nvi.d.ts +10 -0
  171. package/dist/types/namespaces/ta/methods/obv.d.ts +12 -0
  172. package/dist/types/namespaces/ta/methods/percentile_linear_interpolation.d.ts +6 -0
  173. package/dist/types/namespaces/ta/methods/percentile_nearest_rank.d.ts +7 -0
  174. package/dist/types/namespaces/ta/methods/percentrank.d.ts +6 -0
  175. package/dist/types/namespaces/ta/methods/pvi.d.ts +10 -0
  176. package/dist/types/namespaces/ta/methods/pvt.d.ts +12 -0
  177. package/dist/types/namespaces/ta/methods/range.d.ts +7 -0
  178. package/dist/types/namespaces/ta/methods/rising.d.ts +15 -0
  179. package/dist/types/namespaces/ta/methods/sar.d.ts +12 -0
  180. package/dist/types/namespaces/ta/methods/stoch.d.ts +21 -0
  181. package/dist/types/namespaces/ta/methods/supertrend.d.ts +23 -0
  182. package/dist/types/namespaces/ta/methods/swma.d.ts +14 -0
  183. package/dist/types/namespaces/ta/methods/tr.d.ts +2 -0
  184. package/dist/types/namespaces/ta/methods/tsi.d.ts +17 -0
  185. package/dist/types/namespaces/ta/methods/valuewhen.d.ts +6 -0
  186. package/dist/types/namespaces/ta/methods/vwap.d.ts +14 -0
  187. package/dist/types/namespaces/ta/methods/wad.d.ts +11 -0
  188. package/dist/types/namespaces/ta/methods/wpr.d.ts +17 -0
  189. package/dist/types/namespaces/ta/methods/wvad.d.ts +7 -0
  190. package/dist/types/namespaces/ta/ta.index.d.ts +120 -5
  191. package/dist/types/transpiler/analysis/ScopeManager.d.ts +11 -0
  192. package/dist/types/transpiler/index.d.ts +4 -1
  193. package/dist/types/transpiler/settings.d.ts +4 -0
  194. package/dist/types/transpiler/transformers/InjectionTransformer.d.ts +6 -0
  195. package/dist/types/transpiler/transformers/MainTransformer.d.ts +4 -1
  196. package/dist/types/transpiler/transformers/NormalizationTransformer.d.ts +15 -0
  197. package/dist/types/transpiler/transformers/WrapperTransformer.d.ts +9 -0
  198. package/dist/types/transpiler/utils/ASTFactory.d.ts +2 -0
  199. package/dist/types/types/PineTypes.d.ts +11 -0
  200. package/package.json +6 -4
package/README.md CHANGED
@@ -4,14 +4,58 @@
4
4
  [![Documentation](https://img.shields.io/badge/docs-github--pages-blue?style=flat-square)](https://quantforgeorg.github.io/PineTS/)
5
5
  [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/QuantForge?style=flat-square&logo=reddit)](https://www.reddit.com/r/QuantForge/)
6
6
 
7
+ ---
8
+
7
9
  This project aims to provide a Javascript/Typescript port for Tradingview's Pine Script.
8
10
  The current version does not run Pine Script directly, instead it runs a close Javascript equivalent called PineTS.
9
11
 
10
12
  PineTS makes it possible to migrate Pine Script v5+ indicators to Javascript/Typescript, in order to run them in a Javascript environment.
11
13
 
12
- ## Disclaimer
14
+ > _Disclaimer : PineTS is an independent project and is not affiliated with, endorsed by, or associated with TradingView or Pine Script™. All trademarks and registered trademarks mentioned belong to their respective owners._
15
+
16
+ ---
17
+
18
+ ## Pine Script API Coverage
19
+
20
+ ### Data
21
+
22
+ [![syminfo](./.github/badges/api-syminfo.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/syminfo.html)
23
+ [![session](./.github/badges/api-session.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/session.html)
24
+ [![timeframe](./.github/badges/api-timeframe.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/timeframe.html)
25
+ [![barstate](./.github/badges/api-barstate.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/barstate.html)
26
+ [![ticker](./.github/badges/api-ticker.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/ticker.html)
27
+ [![builtin](./.github/badges/api-builtin.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/builtin.html)
28
+
29
+ ### Calculation
13
30
 
14
- PineTS is an independent project and is not affiliated with, endorsed by, or associated with TradingView or Pine Script™. All trademarks and registered trademarks mentioned belong to their respective owners.
31
+ [![ta](./.github/badges/api-ta.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/ta.html)
32
+ [![math](./.github/badges/api-math.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/math.html)
33
+ [![array](./.github/badges/api-array.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/array.html)
34
+ [![map](./.github/badges/api-map.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/map.html)
35
+ [![matrix](./.github/badges/api-matrix.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/matrix.html)
36
+ [![request](./.github/badges/api-request.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/request.html)
37
+ [![types](./.github/badges/api-types.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/types.html)
38
+ [![strategy](./.github/badges/api-strategy.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/strategy.html)
39
+ [![input](./.github/badges/api-input.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/input.html)
40
+
41
+ ### Visualization
42
+
43
+ [![color](./.github/badges/api-color.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/color.html)
44
+ [![plots](./.github/badges/api-plots.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/plots.html)
45
+ [![chart](./.github/badges/api-chart.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/chart.html)
46
+ [![label](./.github/badges/api-label.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/label.html)
47
+ [![line](./.github/badges/api-line.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/line.html)
48
+ [![polyline](./.github/badges/api-polyline.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/polyline.html)
49
+ [![box](./.github/badges/api-box.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/box.html)
50
+ [![table](./.github/badges/api-table.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/table.html)
51
+ [![linefill](./.github/badges/api-linefill.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/linefill.html)
52
+
53
+ ### Logging
54
+
55
+ [![log](./.github/badges/api-log.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/log.html)
56
+ [![str](./.github/badges/api-str.svg)](https://quantforgeorg.github.io/PineTS/api-coverage/str.html)
57
+
58
+ ---
15
59
 
16
60
  ## Overview
17
61
 
@@ -28,6 +72,7 @@ PineTS is used to generate plot data, and tradingview light weight chart is used
28
72
  ## Key Features
29
73
 
30
74
  - **Pine Script Compatibility**: Supports Pine Script v5+ syntax and functionality
75
+ - **High Precision**: Aims for the same precision as Pine Script (up to the 8th digit)
31
76
  - **Time-Series Processing**: Handles historical data and series operations
32
77
  - **Technical Analysis Functions**: Comprehensive set of TA indicators and calculations
33
78
  - **Mathematical Operations**: Advanced mathematical functions and precision handling
@@ -66,7 +111,7 @@ npm install pinets
66
111
 
67
112
  Original Pine Script:
68
113
 
69
- <table>
114
+ <table width="100%">
70
115
  <tr>
71
116
  <td>
72
117
 
@@ -156,6 +201,8 @@ const { result } = await pineTS.run((context) => {
156
201
 
157
202
  ## Project Goals
158
203
 
204
+ PineTS aims for **full coverage** of Pine Script functions and capabilities. The ultimate goal is to enable running **original Pine Script code directly** without manual conversion to PineTS syntax.
205
+
159
206
  - Runtime Transpiler
160
207
  - Core Pine Script functions and variables
161
208
  - Series and scope management