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.
- opencode_pyneruntime-6.6.4.dist-info/METADATA +281 -0
- opencode_pyneruntime-6.6.4.dist-info/RECORD +261 -0
- opencode_pyneruntime-6.6.4.dist-info/WHEEL +5 -0
- opencode_pyneruntime-6.6.4.dist-info/entry_points.txt +6 -0
- opencode_pyneruntime-6.6.4.dist-info/licenses/LICENSE +201 -0
- opencode_pyneruntime-6.6.4.dist-info/licenses/NOTICE +21 -0
- opencode_pyneruntime-6.6.4.dist-info/top_level.txt +1 -0
- pynecore/__init__.py +6 -0
- pynecore/cli/__init__.py +2 -0
- pynecore/cli/app.py +238 -0
- pynecore/cli/commands/__init__.py +343 -0
- pynecore/cli/commands/benchmark.py +186 -0
- pynecore/cli/commands/compile.py +198 -0
- pynecore/cli/commands/data.py +857 -0
- pynecore/cli/commands/debug.py +63 -0
- pynecore/cli/commands/optimize.py +956 -0
- pynecore/cli/commands/plugin.py +242 -0
- pynecore/cli/commands/run.py +2006 -0
- pynecore/cli/pluggable.py +132 -0
- pynecore/cli/utils/__init__.py +0 -0
- pynecore/cli/utils/api_error_handler.py +168 -0
- pynecore/cli/utils/broker_picker.py +330 -0
- pynecore/cli/utils/error_hook.py +28 -0
- pynecore/cli/utils/keyreader.py +178 -0
- pynecore/cli/utils/provider_picker.py +19 -0
- pynecore/cli/utils/symbol_browser.py +1149 -0
- pynecore/core/__init__.py +0 -0
- pynecore/core/aggregator.py +257 -0
- pynecore/core/bar_magnifier.py +168 -0
- pynecore/core/broker/__init__.py +64 -0
- pynecore/core/broker/defaults.py +113 -0
- pynecore/core/broker/disappearance.py +927 -0
- pynecore/core/broker/emulator.py +345 -0
- pynecore/core/broker/exceptions.py +346 -0
- pynecore/core/broker/idempotency.py +401 -0
- pynecore/core/broker/intent_builder.py +334 -0
- pynecore/core/broker/journal.py +1785 -0
- pynecore/core/broker/models.py +1600 -0
- pynecore/core/broker/native_failsafe_manager.py +1436 -0
- pynecore/core/broker/one_way_emulator.py +1128 -0
- pynecore/core/broker/position.py +787 -0
- pynecore/core/broker/run_identity.py +126 -0
- pynecore/core/broker/software_entry_stop_engine.py +351 -0
- pynecore/core/broker/software_partial_bracket_engine.py +1379 -0
- pynecore/core/broker/spot_inventory.py +1327 -0
- pynecore/core/broker/storage.py +2655 -0
- pynecore/core/broker/store_helpers.py +2161 -0
- pynecore/core/broker/sync_engine.py +16070 -0
- pynecore/core/broker/validation.py +382 -0
- pynecore/core/class_property.py +7 -0
- pynecore/core/config.py +392 -0
- pynecore/core/csv_file.py +547 -0
- pynecore/core/currency.py +262 -0
- pynecore/core/data_converter.py +1002 -0
- pynecore/core/datetime.py +296 -0
- pynecore/core/download_info.py +71 -0
- pynecore/core/download_runner.py +274 -0
- pynecore/core/htf_aggregator.py +181 -0
- pynecore/core/import_hook.py +358 -0
- pynecore/core/instance_state.py +494 -0
- pynecore/core/live_ltf_collector.py +442 -0
- pynecore/core/live_ltf_window.py +189 -0
- pynecore/core/live_runner.py +1347 -0
- pynecore/core/module_property.py +26 -0
- pynecore/core/ohlcv_file.py +1888 -0
- pynecore/core/overload.py +371 -0
- pynecore/core/pine_cast.py +113 -0
- pynecore/core/pine_export.py +95 -0
- pynecore/core/pine_method.py +244 -0
- pynecore/core/pine_range.py +86 -0
- pynecore/core/pine_udt.py +69 -0
- pynecore/core/plugin/__init__.py +394 -0
- pynecore/core/plugin/broker.py +781 -0
- pynecore/core/plugin/cli.py +96 -0
- pynecore/core/plugin/live_provider.py +208 -0
- pynecore/core/plugin/provider.py +331 -0
- pynecore/core/provider_string.py +148 -0
- pynecore/core/random.py +40 -0
- pynecore/core/resampler.py +686 -0
- pynecore/core/safe_convert.py +64 -0
- pynecore/core/script.py +1011 -0
- pynecore/core/script_runner.py +3202 -0
- pynecore/core/security.py +1749 -0
- pynecore/core/security_process.py +1253 -0
- pynecore/core/security_shm.py +456 -0
- pynecore/core/series.py +417 -0
- pynecore/core/strategy_stats.py +669 -0
- pynecore/core/symbol_map.py +134 -0
- pynecore/core/syminfo.py +505 -0
- pynecore/core/viz.py +591 -0
- pynecore/lib/__init__.py +1771 -0
- pynecore/lib/_fixnan.py +32 -0
- pynecore/lib/_math_stateful.py +202 -0
- pynecore/lib/_timeframe_change.py +101 -0
- pynecore/lib/adjustment.py +6 -0
- pynecore/lib/alert.py +39 -0
- pynecore/lib/alert.pyi +14 -0
- pynecore/lib/array.py +1051 -0
- pynecore/lib/barmerge.py +60 -0
- pynecore/lib/barstate.py +30 -0
- pynecore/lib/box.py +415 -0
- pynecore/lib/chart.py +128 -0
- pynecore/lib/color.py +152 -0
- pynecore/lib/color.pyi +50 -0
- pynecore/lib/currency.py +62 -0
- pynecore/lib/dayofweek.py +36 -0
- pynecore/lib/dayofweek.pyi +18 -0
- pynecore/lib/display.py +8 -0
- pynecore/lib/dividends.py +9 -0
- pynecore/lib/earnings.py +11 -0
- pynecore/lib/extend.py +6 -0
- pynecore/lib/font.py +5 -0
- pynecore/lib/footprint.py +79 -0
- pynecore/lib/format.py +11 -0
- pynecore/lib/hline.py +67 -0
- pynecore/lib/hline.pyi +24 -0
- pynecore/lib/label.py +409 -0
- pynecore/lib/line.py +433 -0
- pynecore/lib/linefill.py +93 -0
- pynecore/lib/location.py +11 -0
- pynecore/lib/log.py +362 -0
- pynecore/lib/map.py +150 -0
- pynecore/lib/math.py +385 -0
- pynecore/lib/matrix.py +708 -0
- pynecore/lib/order.py +8 -0
- pynecore/lib/pivotpointtype.py +8 -0
- pynecore/lib/plot.py +95 -0
- pynecore/lib/plot.pyi +33 -0
- pynecore/lib/polyline.py +91 -0
- pynecore/lib/position.py +15 -0
- pynecore/lib/request.py +281 -0
- pynecore/lib/runtime.py +5 -0
- pynecore/lib/scale.py +9 -0
- pynecore/lib/session.py +267 -0
- pynecore/lib/session.pyi +12 -0
- pynecore/lib/shape.py +18 -0
- pynecore/lib/size.py +12 -0
- pynecore/lib/splits.py +4 -0
- pynecore/lib/strategy/__init__.py +4778 -0
- pynecore/lib/strategy/closedtrades.py +347 -0
- pynecore/lib/strategy/closedtrades.pyi +53 -0
- pynecore/lib/strategy/commission.py +9 -0
- pynecore/lib/strategy/direction.py +9 -0
- pynecore/lib/strategy/oca.py +13 -0
- pynecore/lib/strategy/opentrades.py +281 -0
- pynecore/lib/strategy/opentrades.pyi +49 -0
- pynecore/lib/strategy/risk.py +109 -0
- pynecore/lib/string.py +649 -0
- pynecore/lib/syminfo.py +84 -0
- pynecore/lib/ta.py +2230 -0
- pynecore/lib/table.py +290 -0
- pynecore/lib/text.py +17 -0
- pynecore/lib/ticker.py +207 -0
- pynecore/lib/timeframe.py +293 -0
- pynecore/lib/volume_row.py +67 -0
- pynecore/lib/xloc.py +4 -0
- pynecore/lib/yloc.py +5 -0
- pynecore/providers/__init__.py +0 -0
- pynecore/providers/ccxt.py +664 -0
- pynecore/providers/replay.py +187 -0
- pynecore/pynesys/__init__.py +0 -0
- pynecore/pynesys/api.py +498 -0
- pynecore/pynesys/compiler.py +112 -0
- pynecore/standalone.py +99 -0
- pynecore/testing/__init__.py +1 -0
- pynecore/testing/broker_lab/__init__.py +41 -0
- pynecore/testing/broker_lab/__main__.py +5 -0
- pynecore/testing/broker_lab/cli.py +87 -0
- pynecore/testing/broker_lab/generate.py +47 -0
- pynecore/testing/broker_lab/model.py +84 -0
- pynecore/testing/broker_lab/reference.py +645 -0
- pynecore/testing/broker_lab/runner.py +372 -0
- pynecore/testing/broker_lab/scheduler.py +50 -0
- pynecore/testing/broker_lab/subprocess.py +73 -0
- pynecore/transformers/__init__.py +0 -0
- pynecore/transformers/builtin_shadow.py +136 -0
- pynecore/transformers/closure_arguments_transformer.py +428 -0
- pynecore/transformers/display_rewrite.py +140 -0
- pynecore/transformers/dynamic_default.py +147 -0
- pynecore/transformers/function_isolation.py +757 -0
- pynecore/transformers/import_lifter.py +61 -0
- pynecore/transformers/import_normalizer.py +328 -0
- pynecore/transformers/inline_series_hoist.py +178 -0
- pynecore/transformers/input_transformer.py +175 -0
- pynecore/transformers/lib_series.py +201 -0
- pynecore/transformers/locations.py +70 -0
- pynecore/transformers/module_properties.json +3387 -0
- pynecore/transformers/module_property.py +221 -0
- pynecore/transformers/ne_guard.py +70 -0
- pynecore/transformers/persistent.py +320 -0
- pynecore/transformers/persistent_series.py +76 -0
- pynecore/transformers/safe_convert_transformer.py +97 -0
- pynecore/transformers/safe_division_transformer.py +95 -0
- pynecore/transformers/script_requirements.py +308 -0
- pynecore/transformers/security.py +752 -0
- pynecore/transformers/security_instantiation.py +274 -0
- pynecore/transformers/series.py +275 -0
- pynecore/transformers/slot_layout.py +381 -0
- pynecore/transformers/type_checking_stripper.py +25 -0
- pynecore/transformers/unused_series_detector.py +267 -0
- pynecore/types/__init__.py +21 -0
- pynecore/types/alert.py +5 -0
- pynecore/types/barmerge.py +5 -0
- pynecore/types/base.py +39 -0
- pynecore/types/box.py +37 -0
- pynecore/types/chart.py +17 -0
- pynecore/types/color.py +107 -0
- pynecore/types/currency.py +5 -0
- pynecore/types/datetime.py +6 -0
- pynecore/types/display.py +5 -0
- pynecore/types/dividends.py +5 -0
- pynecore/types/earnings.py +5 -0
- pynecore/types/extend.py +5 -0
- pynecore/types/font.py +5 -0
- pynecore/types/footprint.py +41 -0
- pynecore/types/format.py +5 -0
- pynecore/types/hline.py +24 -0
- pynecore/types/ib_persistent.py +8 -0
- pynecore/types/ib_persistent.pyi +10 -0
- pynecore/types/label.py +35 -0
- pynecore/types/line.py +32 -0
- pynecore/types/linefill.py +13 -0
- pynecore/types/location.py +5 -0
- pynecore/types/matrix.py +999 -0
- pynecore/types/na.py +237 -0
- pynecore/types/na.pyi +83 -0
- pynecore/types/ohlcv.py +12 -0
- pynecore/types/order.py +5 -0
- pynecore/types/persistent.py +8 -0
- pynecore/types/persistent.pyi +13 -0
- pynecore/types/pine_types.py +11 -0
- pynecore/types/pine_types.pyi +15 -0
- pynecore/types/pivotpointtype.py +5 -0
- pynecore/types/plot.py +12 -0
- pynecore/types/plot_meta.py +60 -0
- pynecore/types/polyline.py +40 -0
- pynecore/types/position.py +5 -0
- pynecore/types/scale.py +5 -0
- pynecore/types/script_type.py +15 -0
- pynecore/types/series.py +23 -0
- pynecore/types/series.pyi +19 -0
- pynecore/types/session.py +35 -0
- pynecore/types/shape.py +5 -0
- pynecore/types/size.py +5 -0
- pynecore/types/source.py +33 -0
- pynecore/types/splits.py +5 -0
- pynecore/types/strategy.py +45 -0
- pynecore/types/table.py +87 -0
- pynecore/types/text.py +13 -0
- pynecore/types/type_checker.py +7 -0
- pynecore/types/type_checker.pyi +48 -0
- pynecore/types/volume_row.py +36 -0
- pynecore/types/weekdays.py +11 -0
- pynecore/types/xloc.py +5 -0
- pynecore/types/yloc.py +5 -0
- pynecore/utils/__init__.py +0 -0
- pynecore/utils/file_utils.py +50 -0
- pynecore/utils/rich/__init__.py +0 -0
- pynecore/utils/rich/date_column.py +25 -0
- pynecore/utils/sequence_view.py +92 -0
- 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: ...
|
pynecore/lib/currency.py
ADDED
|
@@ -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
|
pynecore/lib/display.py
ADDED
pynecore/lib/earnings.py
ADDED
|
@@ -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
pynecore/lib/font.py
ADDED
|
@@ -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
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
|