opencode-pyneruntime 6.6.4__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.
Files changed (261) hide show
  1. opencode_pyneruntime-6.6.4.dist-info/METADATA +281 -0
  2. opencode_pyneruntime-6.6.4.dist-info/RECORD +261 -0
  3. opencode_pyneruntime-6.6.4.dist-info/WHEEL +5 -0
  4. opencode_pyneruntime-6.6.4.dist-info/entry_points.txt +6 -0
  5. opencode_pyneruntime-6.6.4.dist-info/licenses/LICENSE +201 -0
  6. opencode_pyneruntime-6.6.4.dist-info/licenses/NOTICE +21 -0
  7. opencode_pyneruntime-6.6.4.dist-info/top_level.txt +1 -0
  8. pynecore/__init__.py +6 -0
  9. pynecore/cli/__init__.py +2 -0
  10. pynecore/cli/app.py +238 -0
  11. pynecore/cli/commands/__init__.py +343 -0
  12. pynecore/cli/commands/benchmark.py +186 -0
  13. pynecore/cli/commands/compile.py +198 -0
  14. pynecore/cli/commands/data.py +857 -0
  15. pynecore/cli/commands/debug.py +63 -0
  16. pynecore/cli/commands/optimize.py +956 -0
  17. pynecore/cli/commands/plugin.py +242 -0
  18. pynecore/cli/commands/run.py +2006 -0
  19. pynecore/cli/pluggable.py +132 -0
  20. pynecore/cli/utils/__init__.py +0 -0
  21. pynecore/cli/utils/api_error_handler.py +168 -0
  22. pynecore/cli/utils/broker_picker.py +330 -0
  23. pynecore/cli/utils/error_hook.py +28 -0
  24. pynecore/cli/utils/keyreader.py +178 -0
  25. pynecore/cli/utils/provider_picker.py +19 -0
  26. pynecore/cli/utils/symbol_browser.py +1149 -0
  27. pynecore/core/__init__.py +0 -0
  28. pynecore/core/aggregator.py +257 -0
  29. pynecore/core/bar_magnifier.py +168 -0
  30. pynecore/core/broker/__init__.py +64 -0
  31. pynecore/core/broker/defaults.py +113 -0
  32. pynecore/core/broker/disappearance.py +927 -0
  33. pynecore/core/broker/emulator.py +345 -0
  34. pynecore/core/broker/exceptions.py +346 -0
  35. pynecore/core/broker/idempotency.py +401 -0
  36. pynecore/core/broker/intent_builder.py +334 -0
  37. pynecore/core/broker/journal.py +1785 -0
  38. pynecore/core/broker/models.py +1600 -0
  39. pynecore/core/broker/native_failsafe_manager.py +1436 -0
  40. pynecore/core/broker/one_way_emulator.py +1128 -0
  41. pynecore/core/broker/position.py +787 -0
  42. pynecore/core/broker/run_identity.py +126 -0
  43. pynecore/core/broker/software_entry_stop_engine.py +351 -0
  44. pynecore/core/broker/software_partial_bracket_engine.py +1379 -0
  45. pynecore/core/broker/spot_inventory.py +1327 -0
  46. pynecore/core/broker/storage.py +2655 -0
  47. pynecore/core/broker/store_helpers.py +2161 -0
  48. pynecore/core/broker/sync_engine.py +16070 -0
  49. pynecore/core/broker/validation.py +382 -0
  50. pynecore/core/class_property.py +7 -0
  51. pynecore/core/config.py +392 -0
  52. pynecore/core/csv_file.py +547 -0
  53. pynecore/core/currency.py +262 -0
  54. pynecore/core/data_converter.py +1002 -0
  55. pynecore/core/datetime.py +296 -0
  56. pynecore/core/download_info.py +71 -0
  57. pynecore/core/download_runner.py +274 -0
  58. pynecore/core/htf_aggregator.py +181 -0
  59. pynecore/core/import_hook.py +358 -0
  60. pynecore/core/instance_state.py +494 -0
  61. pynecore/core/live_ltf_collector.py +442 -0
  62. pynecore/core/live_ltf_window.py +189 -0
  63. pynecore/core/live_runner.py +1347 -0
  64. pynecore/core/module_property.py +26 -0
  65. pynecore/core/ohlcv_file.py +1888 -0
  66. pynecore/core/overload.py +371 -0
  67. pynecore/core/pine_cast.py +113 -0
  68. pynecore/core/pine_export.py +95 -0
  69. pynecore/core/pine_method.py +244 -0
  70. pynecore/core/pine_range.py +86 -0
  71. pynecore/core/pine_udt.py +69 -0
  72. pynecore/core/plugin/__init__.py +394 -0
  73. pynecore/core/plugin/broker.py +781 -0
  74. pynecore/core/plugin/cli.py +96 -0
  75. pynecore/core/plugin/live_provider.py +208 -0
  76. pynecore/core/plugin/provider.py +331 -0
  77. pynecore/core/provider_string.py +148 -0
  78. pynecore/core/random.py +40 -0
  79. pynecore/core/resampler.py +686 -0
  80. pynecore/core/safe_convert.py +64 -0
  81. pynecore/core/script.py +1011 -0
  82. pynecore/core/script_runner.py +3202 -0
  83. pynecore/core/security.py +1749 -0
  84. pynecore/core/security_process.py +1253 -0
  85. pynecore/core/security_shm.py +456 -0
  86. pynecore/core/series.py +417 -0
  87. pynecore/core/strategy_stats.py +669 -0
  88. pynecore/core/symbol_map.py +134 -0
  89. pynecore/core/syminfo.py +505 -0
  90. pynecore/core/viz.py +591 -0
  91. pynecore/lib/__init__.py +1771 -0
  92. pynecore/lib/_fixnan.py +32 -0
  93. pynecore/lib/_math_stateful.py +202 -0
  94. pynecore/lib/_timeframe_change.py +101 -0
  95. pynecore/lib/adjustment.py +6 -0
  96. pynecore/lib/alert.py +39 -0
  97. pynecore/lib/alert.pyi +14 -0
  98. pynecore/lib/array.py +1051 -0
  99. pynecore/lib/barmerge.py +60 -0
  100. pynecore/lib/barstate.py +30 -0
  101. pynecore/lib/box.py +415 -0
  102. pynecore/lib/chart.py +128 -0
  103. pynecore/lib/color.py +152 -0
  104. pynecore/lib/color.pyi +50 -0
  105. pynecore/lib/currency.py +62 -0
  106. pynecore/lib/dayofweek.py +36 -0
  107. pynecore/lib/dayofweek.pyi +18 -0
  108. pynecore/lib/display.py +8 -0
  109. pynecore/lib/dividends.py +9 -0
  110. pynecore/lib/earnings.py +11 -0
  111. pynecore/lib/extend.py +6 -0
  112. pynecore/lib/font.py +5 -0
  113. pynecore/lib/footprint.py +79 -0
  114. pynecore/lib/format.py +11 -0
  115. pynecore/lib/hline.py +67 -0
  116. pynecore/lib/hline.pyi +24 -0
  117. pynecore/lib/label.py +409 -0
  118. pynecore/lib/line.py +433 -0
  119. pynecore/lib/linefill.py +93 -0
  120. pynecore/lib/location.py +11 -0
  121. pynecore/lib/log.py +362 -0
  122. pynecore/lib/map.py +150 -0
  123. pynecore/lib/math.py +385 -0
  124. pynecore/lib/matrix.py +708 -0
  125. pynecore/lib/order.py +8 -0
  126. pynecore/lib/pivotpointtype.py +8 -0
  127. pynecore/lib/plot.py +95 -0
  128. pynecore/lib/plot.pyi +33 -0
  129. pynecore/lib/polyline.py +91 -0
  130. pynecore/lib/position.py +15 -0
  131. pynecore/lib/request.py +281 -0
  132. pynecore/lib/runtime.py +5 -0
  133. pynecore/lib/scale.py +9 -0
  134. pynecore/lib/session.py +267 -0
  135. pynecore/lib/session.pyi +12 -0
  136. pynecore/lib/shape.py +18 -0
  137. pynecore/lib/size.py +12 -0
  138. pynecore/lib/splits.py +4 -0
  139. pynecore/lib/strategy/__init__.py +4778 -0
  140. pynecore/lib/strategy/closedtrades.py +347 -0
  141. pynecore/lib/strategy/closedtrades.pyi +53 -0
  142. pynecore/lib/strategy/commission.py +9 -0
  143. pynecore/lib/strategy/direction.py +9 -0
  144. pynecore/lib/strategy/oca.py +13 -0
  145. pynecore/lib/strategy/opentrades.py +281 -0
  146. pynecore/lib/strategy/opentrades.pyi +49 -0
  147. pynecore/lib/strategy/risk.py +109 -0
  148. pynecore/lib/string.py +649 -0
  149. pynecore/lib/syminfo.py +84 -0
  150. pynecore/lib/ta.py +2230 -0
  151. pynecore/lib/table.py +290 -0
  152. pynecore/lib/text.py +17 -0
  153. pynecore/lib/ticker.py +207 -0
  154. pynecore/lib/timeframe.py +293 -0
  155. pynecore/lib/volume_row.py +67 -0
  156. pynecore/lib/xloc.py +4 -0
  157. pynecore/lib/yloc.py +5 -0
  158. pynecore/providers/__init__.py +0 -0
  159. pynecore/providers/ccxt.py +664 -0
  160. pynecore/providers/replay.py +187 -0
  161. pynecore/pynesys/__init__.py +0 -0
  162. pynecore/pynesys/api.py +498 -0
  163. pynecore/pynesys/compiler.py +112 -0
  164. pynecore/standalone.py +99 -0
  165. pynecore/testing/__init__.py +1 -0
  166. pynecore/testing/broker_lab/__init__.py +41 -0
  167. pynecore/testing/broker_lab/__main__.py +5 -0
  168. pynecore/testing/broker_lab/cli.py +87 -0
  169. pynecore/testing/broker_lab/generate.py +47 -0
  170. pynecore/testing/broker_lab/model.py +84 -0
  171. pynecore/testing/broker_lab/reference.py +645 -0
  172. pynecore/testing/broker_lab/runner.py +372 -0
  173. pynecore/testing/broker_lab/scheduler.py +50 -0
  174. pynecore/testing/broker_lab/subprocess.py +73 -0
  175. pynecore/transformers/__init__.py +0 -0
  176. pynecore/transformers/builtin_shadow.py +136 -0
  177. pynecore/transformers/closure_arguments_transformer.py +428 -0
  178. pynecore/transformers/display_rewrite.py +140 -0
  179. pynecore/transformers/dynamic_default.py +147 -0
  180. pynecore/transformers/function_isolation.py +757 -0
  181. pynecore/transformers/import_lifter.py +61 -0
  182. pynecore/transformers/import_normalizer.py +328 -0
  183. pynecore/transformers/inline_series_hoist.py +178 -0
  184. pynecore/transformers/input_transformer.py +175 -0
  185. pynecore/transformers/lib_series.py +201 -0
  186. pynecore/transformers/locations.py +70 -0
  187. pynecore/transformers/module_properties.json +3387 -0
  188. pynecore/transformers/module_property.py +221 -0
  189. pynecore/transformers/ne_guard.py +70 -0
  190. pynecore/transformers/persistent.py +320 -0
  191. pynecore/transformers/persistent_series.py +76 -0
  192. pynecore/transformers/safe_convert_transformer.py +97 -0
  193. pynecore/transformers/safe_division_transformer.py +95 -0
  194. pynecore/transformers/script_requirements.py +308 -0
  195. pynecore/transformers/security.py +752 -0
  196. pynecore/transformers/security_instantiation.py +274 -0
  197. pynecore/transformers/series.py +275 -0
  198. pynecore/transformers/slot_layout.py +381 -0
  199. pynecore/transformers/type_checking_stripper.py +25 -0
  200. pynecore/transformers/unused_series_detector.py +267 -0
  201. pynecore/types/__init__.py +21 -0
  202. pynecore/types/alert.py +5 -0
  203. pynecore/types/barmerge.py +5 -0
  204. pynecore/types/base.py +39 -0
  205. pynecore/types/box.py +37 -0
  206. pynecore/types/chart.py +17 -0
  207. pynecore/types/color.py +107 -0
  208. pynecore/types/currency.py +5 -0
  209. pynecore/types/datetime.py +6 -0
  210. pynecore/types/display.py +5 -0
  211. pynecore/types/dividends.py +5 -0
  212. pynecore/types/earnings.py +5 -0
  213. pynecore/types/extend.py +5 -0
  214. pynecore/types/font.py +5 -0
  215. pynecore/types/footprint.py +41 -0
  216. pynecore/types/format.py +5 -0
  217. pynecore/types/hline.py +24 -0
  218. pynecore/types/ib_persistent.py +8 -0
  219. pynecore/types/ib_persistent.pyi +10 -0
  220. pynecore/types/label.py +35 -0
  221. pynecore/types/line.py +32 -0
  222. pynecore/types/linefill.py +13 -0
  223. pynecore/types/location.py +5 -0
  224. pynecore/types/matrix.py +999 -0
  225. pynecore/types/na.py +237 -0
  226. pynecore/types/na.pyi +83 -0
  227. pynecore/types/ohlcv.py +12 -0
  228. pynecore/types/order.py +5 -0
  229. pynecore/types/persistent.py +8 -0
  230. pynecore/types/persistent.pyi +13 -0
  231. pynecore/types/pine_types.py +11 -0
  232. pynecore/types/pine_types.pyi +15 -0
  233. pynecore/types/pivotpointtype.py +5 -0
  234. pynecore/types/plot.py +12 -0
  235. pynecore/types/plot_meta.py +60 -0
  236. pynecore/types/polyline.py +40 -0
  237. pynecore/types/position.py +5 -0
  238. pynecore/types/scale.py +5 -0
  239. pynecore/types/script_type.py +15 -0
  240. pynecore/types/series.py +23 -0
  241. pynecore/types/series.pyi +19 -0
  242. pynecore/types/session.py +35 -0
  243. pynecore/types/shape.py +5 -0
  244. pynecore/types/size.py +5 -0
  245. pynecore/types/source.py +33 -0
  246. pynecore/types/splits.py +5 -0
  247. pynecore/types/strategy.py +45 -0
  248. pynecore/types/table.py +87 -0
  249. pynecore/types/text.py +13 -0
  250. pynecore/types/type_checker.py +7 -0
  251. pynecore/types/type_checker.pyi +48 -0
  252. pynecore/types/volume_row.py +36 -0
  253. pynecore/types/weekdays.py +11 -0
  254. pynecore/types/xloc.py +5 -0
  255. pynecore/types/yloc.py +5 -0
  256. pynecore/utils/__init__.py +0 -0
  257. pynecore/utils/file_utils.py +50 -0
  258. pynecore/utils/rich/__init__.py +0 -0
  259. pynecore/utils/rich/date_column.py +25 -0
  260. pynecore/utils/sequence_view.py +92 -0
  261. pynecore/utils/stdlib_checker.py +17 -0
pynecore/lib/color.py ADDED
@@ -0,0 +1,152 @@
1
+ from ..types.color import Color
2
+ from ..types.na import NA
3
+
4
+ #
5
+ # Constants
6
+ #
7
+
8
+ aqua = Color('#00BCD4')
9
+ black = Color('#363A45')
10
+ blue = Color('#2962ff')
11
+ fuchsia = Color('#E040FB')
12
+ gray = Color('#787B86')
13
+ green = Color('#4CAF50')
14
+ lime = Color('#00E676')
15
+ maroon = Color('#880E4F')
16
+ navy = Color('#311B92')
17
+ olive = Color('#808000')
18
+ orange = Color('#FF9800')
19
+ purple = Color('#9C27B0')
20
+ red = Color('#F23645')
21
+ silver = Color('#B2B5BE')
22
+ teal = Color('#089981')
23
+ white = Color('#FFFFFF')
24
+ yellow = Color('#FDD835')
25
+
26
+
27
+ def r(color: Color) -> int:
28
+ """
29
+ Return the red component of a color
30
+
31
+ :param color: Color
32
+ :return: The red component of the color
33
+ """
34
+ return color.r
35
+
36
+
37
+ def g(color: Color) -> int:
38
+ """
39
+ Return the green component of a color
40
+
41
+ :param color: Color
42
+ :return: The green component of the color
43
+ """
44
+ return color.g
45
+
46
+
47
+ def b(color: Color) -> int:
48
+ """
49
+ Return the blue component of a color
50
+
51
+ :param color: Color
52
+ :return: The blue component of the color
53
+ """
54
+ return color.b
55
+
56
+
57
+ def t(color: Color) -> float:
58
+ """
59
+ Return the transparency of a color
60
+
61
+ :param color: Color
62
+ :return: The transparency of the color, 0-100 (0: not transparent, 100: invisible)
63
+ """
64
+ return color.t
65
+
66
+
67
+ # noinspection PyShadowingNames
68
+ def new(color: Color | str | NA[Color], transp: float | NA[float] = 0) -> Color | NA[Color]:
69
+ """
70
+ Return a new color with the same RGB values and a different transparency
71
+
72
+ :param color: A color object or a string in "#RRGGBB" or "#RRGGBBAA" format
73
+ :param transp: Transparency percentage (0-100, 0: not transparent, 100: invisible)
74
+ """
75
+ # Pine propagates na: a na color or na transparency yields a na color
76
+ if isinstance(color, NA) or isinstance(transp, NA) or transp != transp:
77
+ return NA(Color)
78
+ if isinstance(color, str):
79
+ color = Color(color)
80
+ # Build a fresh color so the caller's color (e.g. a color.* constant) is not mutated
81
+ result = Color(f'#{color.value:08X}')
82
+ result.t = transp
83
+ return result
84
+
85
+
86
+ # noinspection PyShadowingNames
87
+ def rgb(r: int, g: int, b: int, transp: float = 0) -> Color:
88
+ """
89
+ Return a new color with the given RGB values and transparency
90
+
91
+ :param r: Red value
92
+ :param g: Green value
93
+ :param b: Blue value
94
+ :param transp: Transparency percentage (0-100, 0: not transparent, 100: invisible)
95
+ """
96
+ return Color.rgb(r, g, b, transp)
97
+
98
+
99
+ def from_gradient(value: int | float | NA[float], bottom_value: int | float | NA[float],
100
+ top_value: int | float | NA[float],
101
+ bottom_color: Color | NA[Color], top_color: Color | NA[Color]) -> Color | NA[Color]:
102
+ """
103
+ Based on the relative position of value in the bottom_value to top_value range,
104
+ the function returns a color from the gradient defined by bottom_color to top_color.
105
+
106
+ :param value: Value to calculate the position-dependent color
107
+ :param bottom_value: Bottom position value corresponding to bottom_color
108
+ :param top_value: Top position value corresponding to top_color
109
+ :param bottom_color: Bottom position color
110
+ :param top_color: Top position color
111
+ :return: A color calculated from the linear gradient between bottom_color to top_color
112
+ """
113
+ # na value/bounds propagate: TradingView returns a na color for such a bar.
114
+ if (isinstance(value, NA) or value != value
115
+ or isinstance(bottom_value, NA) or bottom_value != bottom_value
116
+ or isinstance(top_value, NA) or top_value != top_value):
117
+ return NA(Color)
118
+
119
+ # Handle edge cases
120
+ if top_value == bottom_value:
121
+ return bottom_color
122
+
123
+ # Calculate the position as a ratio (0.0 to 1.0), clamped to [0, 1]
124
+ position = (value - bottom_value) / (top_value - bottom_value)
125
+ position = max(0.0, min(1.0, position))
126
+
127
+ # A na endpoint carries no hue (TV-verified: color.r/g/b(na)==0, color.t(na)==100).
128
+ # TradingView does NOT fade the visible RGB toward transparent-black; it keeps the
129
+ # solid endpoint's RGB and only fades transparency toward the na side (na transp=100),
130
+ # returning the literal na color exactly at the na endpoint's position.
131
+ bottom_na = isinstance(bottom_color, NA)
132
+ top_na = isinstance(top_color, NA)
133
+ if bottom_na and top_na:
134
+ return NA(Color)
135
+ if bottom_na:
136
+ if position <= 0.0:
137
+ return NA(Color)
138
+ transp = 100.0 + (top_color.t - 100.0) * position
139
+ return Color.rgb(top_color.r, top_color.g, top_color.b, transp)
140
+ if top_na:
141
+ if position >= 1.0:
142
+ return NA(Color)
143
+ transp = bottom_color.t + (100.0 - bottom_color.t) * position
144
+ return Color.rgb(bottom_color.r, bottom_color.g, bottom_color.b, transp)
145
+
146
+ # Both endpoints solid: interpolate RGB and transparency
147
+ red_comp = int(bottom_color.r + (top_color.r - bottom_color.r) * position)
148
+ green_comp = int(bottom_color.g + (top_color.g - bottom_color.g) * position)
149
+ blue_comp = int(bottom_color.b + (top_color.b - bottom_color.b) * position)
150
+ transp = bottom_color.t + (top_color.t - bottom_color.t) * position
151
+
152
+ return Color.rgb(red_comp, green_comp, blue_comp, transp)
pynecore/lib/color.pyi ADDED
@@ -0,0 +1,50 @@
1
+ """
2
+ IDE-facing view of the color module. Returns are plain ``Color`` (the NA-free
3
+ "plain T" policy — see types/persistent.pyi): in Pine semantics any color can
4
+ be na, so ``Color | NA[Color]`` returns only poison every downstream callsite.
5
+ Parameters stay permissive (accept NA), runtime (color.py) is unchanged.
6
+ """
7
+ from ..types.color import Color as Color
8
+ from ..types.na import NA
9
+
10
+ aqua: Color
11
+ black: Color
12
+ blue: Color
13
+ fuchsia: Color
14
+ gray: Color
15
+ green: Color
16
+ lime: Color
17
+ maroon: Color
18
+ navy: Color
19
+ olive: Color
20
+ orange: Color
21
+ purple: Color
22
+ red: Color
23
+ silver: Color
24
+ teal: Color
25
+ white: Color
26
+ yellow: Color
27
+
28
+
29
+ def r(color: Color | NA[Color]) -> int: ...
30
+
31
+
32
+ def g(color: Color | NA[Color]) -> int: ...
33
+
34
+
35
+ def b(color: Color | NA[Color]) -> int: ...
36
+
37
+
38
+ def t(color: Color | NA[Color]) -> float: ...
39
+
40
+
41
+ def new(color: Color | str | NA[Color], transp: float | NA[float] = 0) -> Color: ...
42
+
43
+
44
+ # noinspection PyShadowingNames
45
+ def rgb(r: int | float, g: int | float, b: int | float, transp: float = 0) -> Color: ...
46
+
47
+
48
+ def from_gradient(value: int | float | NA[float], bottom_value: int | float | NA[float],
49
+ top_value: int | float | NA[float],
50
+ bottom_color: Color | NA[Color], top_color: Color | NA[Color]) -> Color: ...
@@ -0,0 +1,62 @@
1
+ from ..types.currency import Currency
2
+
3
+ #
4
+ # Constants
5
+ #
6
+
7
+ AED = Currency('AED')
8
+ ARS = Currency('ARS')
9
+ AUD = Currency('AUD')
10
+ BDT = Currency('BDT')
11
+ BHD = Currency('BHD')
12
+ BRL = Currency('BRL')
13
+ BTC = Currency('BTC')
14
+ CAD = Currency('CAD')
15
+ CHF = Currency('CHF')
16
+ CLP = Currency('CLP')
17
+ CNY = Currency('CNY')
18
+ COP = Currency('COP')
19
+ CZK = Currency('CZK')
20
+ DKK = Currency('DKK')
21
+ EGP = Currency('EGP')
22
+ ETH = Currency('ETH')
23
+ EUR = Currency('EUR')
24
+ GBP = Currency('GBP')
25
+ HKD = Currency('HKD')
26
+ HUF = Currency('HUF')
27
+ IDR = Currency('IDR')
28
+ ILS = Currency('ILS')
29
+ INR = Currency('INR')
30
+ ISK = Currency('ISK')
31
+ JPY = Currency('JPY')
32
+ KES = Currency('KES')
33
+ KRW = Currency('KRW')
34
+ KWD = Currency('KWD')
35
+ LKR = Currency('LKR')
36
+ MAD = Currency('MAD')
37
+ MXN = Currency('MXN')
38
+ MYR = Currency('MYR')
39
+ NGN = Currency('NGN')
40
+ NOK = Currency('NOK')
41
+ NONE = Currency('NONE')
42
+ NZD = Currency('NZD')
43
+ PEN = Currency('PEN')
44
+ PHP = Currency('PHP')
45
+ PKR = Currency('PKR')
46
+ PLN = Currency('PLN')
47
+ QAR = Currency('QAR')
48
+ RON = Currency('RON')
49
+ RSD = Currency('RSD')
50
+ RUB = Currency('RUB')
51
+ SAR = Currency('SAR')
52
+ SEK = Currency('SEK')
53
+ SGD = Currency('SGD')
54
+ THB = Currency('THB')
55
+ TND = Currency('TND')
56
+ TRY = Currency('TRY')
57
+ TWD = Currency('TWD')
58
+ USD = Currency('USD')
59
+ USDT = Currency('USDT')
60
+ VES = Currency('VES')
61
+ VND = Currency('VND')
62
+ ZAR = Currency('ZAR')
@@ -0,0 +1,36 @@
1
+ from ..types.datetime import DayOfWeek
2
+ from ..core.module_property import module_function_property
3
+
4
+
5
+ #
6
+ # Constants
7
+ #
8
+
9
+ sunday = DayOfWeek()
10
+ monday = DayOfWeek()
11
+ tuesday = DayOfWeek()
12
+ wednesday = DayOfWeek()
13
+ thursday = DayOfWeek()
14
+ friday = DayOfWeek()
15
+ saturday = DayOfWeek()
16
+
17
+
18
+ #
19
+ # Module function
20
+ #
21
+
22
+ # noinspection PyShadowingNames,PyProtectedMember
23
+ @module_function_property
24
+ def dayofweek(time: int | None = None, timezone: str | None = None) -> int:
25
+ """
26
+ Day of the week
27
+
28
+ :param time: The time to get the day of the week from, if None the current time is used
29
+ :param timezone: The timezone of the time, if not specified the exchange timezone is used
30
+ :return: The day of the week, 1 is Sunday, 2 is Monday, ..., 7 is Saturday
31
+ """
32
+ from .. import lib
33
+ res = lib._get_dt(time, timezone).weekday() + 2
34
+ if res == 8:
35
+ res = 1
36
+ return res
@@ -0,0 +1,18 @@
1
+ from ..types.datetime import DayOfWeek
2
+
3
+
4
+ # IDE-facing view of the function-and-namespace module: user code reads the
5
+ # constants and calls the bare name; the AST transformer resolves both at runtime.
6
+ class DayOfWeekModule:
7
+ sunday: DayOfWeek
8
+ monday: DayOfWeek
9
+ tuesday: DayOfWeek
10
+ wednesday: DayOfWeek
11
+ thursday: DayOfWeek
12
+ friday: DayOfWeek
13
+ saturday: DayOfWeek
14
+
15
+ def __call__(self, time: int | None = None, timezone: str | None = None) -> int: ...
16
+
17
+
18
+ dayofweek: DayOfWeekModule
@@ -0,0 +1,8 @@
1
+ from ..types.display import Display
2
+
3
+ all: Display = Display() # noqa F821
4
+ data_window: Display = Display()
5
+ none: Display = Display()
6
+ pane: Display = Display()
7
+ price_scale: Display = Display()
8
+ status_line: Display = Display()
@@ -0,0 +1,9 @@
1
+ from ..types.na import na_float
2
+ from ..types.dividends import Dividends
3
+
4
+ gross = Dividends("gross")
5
+ net = Dividends("net")
6
+
7
+ future_amount = na_float
8
+ future_ex_date = na_float
9
+ future_pay_date = na_float
@@ -0,0 +1,11 @@
1
+ from ..types.na import NA, na_float
2
+ from ..types.earnings import Earnings
3
+
4
+ actual = Earnings("actual")
5
+ estimate = Earnings("estimate")
6
+ standardized = Earnings("standardized")
7
+
8
+ future_eps = na_float
9
+ future_time = NA(int)
10
+ future_revenue = na_float
11
+ future_period_end_time = NA(int)
pynecore/lib/extend.py ADDED
@@ -0,0 +1,6 @@
1
+ from ..types.extend import Extend
2
+
3
+ both: Extend = Extend('b')
4
+ left: Extend = Extend('l')
5
+ none: Extend = Extend('n')
6
+ right: Extend = Extend('r')
pynecore/lib/font.py ADDED
@@ -0,0 +1,5 @@
1
+ from ..types.font import FontFamilyEnum
2
+
3
+ # Font family constants
4
+ family_default = FontFamilyEnum('default')
5
+ family_monospace = FontFamilyEnum('monospace')
@@ -0,0 +1,79 @@
1
+ from ..types.footprint import Footprint
2
+ from ..types.volume_row import VolumeRow
3
+
4
+
5
+ # noinspection PyShadowingBuiltins
6
+ def buy_volume(id: Footprint) -> float:
7
+ """
8
+ Total buy volume for the bar.
9
+
10
+ :param id: Footprint object
11
+ :return: Buy volume
12
+ """
13
+ return id.buy_volume()
14
+
15
+
16
+ # noinspection PyShadowingBuiltins
17
+ def sell_volume(id: Footprint) -> float:
18
+ """
19
+ Total sell volume for the bar.
20
+
21
+ :param id: Footprint object
22
+ :return: Sell volume
23
+ """
24
+ return id.sell_volume()
25
+
26
+
27
+ # noinspection PyShadowingBuiltins
28
+ def delta(id: Footprint) -> float:
29
+ """
30
+ Volume delta (buy - sell) for the bar.
31
+
32
+ :param id: Footprint object
33
+ :return: Volume delta
34
+ """
35
+ return id.delta()
36
+
37
+
38
+ # noinspection PyShadowingBuiltins
39
+ def total_volume(id: Footprint) -> float:
40
+ """
41
+ Total volume (buy + sell) for the bar.
42
+
43
+ :param id: Footprint object
44
+ :return: Total volume
45
+ """
46
+ return id.total_volume()
47
+
48
+
49
+ # noinspection PyShadowingBuiltins
50
+ def vah(id: Footprint) -> VolumeRow:
51
+ """
52
+ Value Area High row.
53
+
54
+ :param id: Footprint object
55
+ :return: VolumeRow for VAH
56
+ """
57
+ return id.vah()
58
+
59
+
60
+ # noinspection PyShadowingBuiltins
61
+ def val(id: Footprint) -> VolumeRow:
62
+ """
63
+ Value Area Low row.
64
+
65
+ :param id: Footprint object
66
+ :return: VolumeRow for VAL
67
+ """
68
+ return id.val()
69
+
70
+
71
+ # noinspection PyShadowingBuiltins
72
+ def poc(id: Footprint) -> VolumeRow:
73
+ """
74
+ Point of Control row.
75
+
76
+ :param id: Footprint object
77
+ :return: VolumeRow for POC
78
+ """
79
+ return id.poc()
pynecore/lib/format.py ADDED
@@ -0,0 +1,11 @@
1
+ from ..types.format import Format
2
+
3
+ #
4
+ # Constants
5
+ #
6
+
7
+ inherit = Format("inherit")
8
+ mintick = Format("mintick")
9
+ percent = Format("percent")
10
+ price = Format("price")
11
+ volume = Format("volume")
pynecore/lib/hline.py ADDED
@@ -0,0 +1,67 @@
1
+ """
2
+ Horizontal line
3
+
4
+ The module is both a function (``hline(...)``) and a namespace (``hline.style_solid``);
5
+ call sites are routed to :func:`hline` by the module property AST transformer.
6
+ """
7
+ from ..types.hline import HLineEnum, HLine
8
+ from ..types.plot_meta import PlotMeta
9
+
10
+ from . import color as _color, display as _display
11
+ from .. import lib
12
+
13
+
14
+ #
15
+ # Constants
16
+ #
17
+
18
+ style_solid = HLineEnum('style_solid')
19
+ style_dotted = HLineEnum('style_dotted')
20
+ style_dashed = HLineEnum('style_dashed')
21
+
22
+
23
+ #
24
+ # Module function
25
+ #
26
+
27
+ def hline(
28
+ price: float,
29
+ title: str = "",
30
+ color: _color.Color = _color.blue,
31
+ linestyle: HLineEnum = style_solid,
32
+ linewidth: int = 1,
33
+ editable: bool = True,
34
+ display: _display.Display = _display.all
35
+ ) -> HLine:
36
+ """
37
+ Renders a horizontal line at a given fixed price level.
38
+
39
+ :param price: Price value at which the object will be rendered. Required argument.
40
+ :param title: Title of the object
41
+ :param color: Color of the rendered line. Must be a constant value (not an expression)
42
+ :param linestyle: Style of the rendered line. Possible values are: hline.style_solid, hline.style_dotted, hline.style_dashed
43
+ :param linewidth: Width of the rendered line. Default value is 1
44
+ :param editable: If true then hline style will be editable in Format dialog. Default is true
45
+ :param display: Controls where the hline is displayed. Possible values are: display.none, display.all. Default is display.all
46
+ :return: An hline object, that can be used in fill
47
+ """
48
+ n = lib._viz_seq.get('hline', 0)
49
+ lib._viz_seq['hline'] = n + 1
50
+ hid = f'hline#{n}'
51
+ t = title or None
52
+ if hid not in lib._plot_meta:
53
+ meta = PlotMeta(id=hid, kind='hline', title=t, price=price, color=color,
54
+ linestyle=linestyle, linewidth=linewidth, editable=editable,
55
+ display=display)
56
+ lib._plot_meta[hid] = meta
57
+ lib._plot_meta_new.append(meta)
58
+ return HLine(
59
+ price=price,
60
+ title=t,
61
+ color=color,
62
+ linestyle=linestyle,
63
+ linewidth=linewidth,
64
+ editable=editable,
65
+ display=display,
66
+ id=hid
67
+ )
pynecore/lib/hline.pyi ADDED
@@ -0,0 +1,24 @@
1
+ from ..types.hline import HLineEnum, HLine
2
+ from . import color as _color, display as _display
3
+
4
+
5
+ # IDE-facing view of the function-and-namespace module: user code reads the
6
+ # constants and calls the bare name; the AST transformer resolves both at runtime.
7
+ class HLineModule:
8
+ style_solid: HLineEnum
9
+ style_dotted: HLineEnum
10
+ style_dashed: HLineEnum
11
+
12
+ def __call__(
13
+ self,
14
+ price: float,
15
+ title: str = ...,
16
+ color: _color.Color = ...,
17
+ linestyle: HLineEnum = ...,
18
+ linewidth: int = ...,
19
+ editable: bool = ...,
20
+ display: _display.Display = ...
21
+ ) -> HLine: ...
22
+
23
+
24
+ hline: HLineModule