onesecondtrader 0.12.0__py3-none-any.whl → 0.12.1__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.
@@ -16,8 +16,7 @@ class BaseIndicator(abc.ABC):
16
16
  Base class for all indicators.
17
17
 
18
18
  If new market data is received, the indicator is updated by calling the
19
- `<indicator_instance>.update(incoming_bar)` method.
20
-
19
+ `update(incoming_bar)` method.
21
20
  When programming a new indicator, only the `name` property and the
22
21
  `_compute_indicator()` method need to be implemented.
23
22
 
@@ -84,6 +83,15 @@ class BaseIndicator(abc.ABC):
84
83
  """
85
84
  pass
86
85
 
86
+ @property
87
+ def latest(self) -> float:
88
+ """
89
+ The latest (most recent) indicator value.
90
+
91
+ Equivalent to self[0]. Returns numpy.nan when no value is available yet.
92
+ """
93
+ return self[0]
94
+
87
95
  def update(self, incoming_bar: models.Bar) -> None:
88
96
  """
89
97
  Updates the indicator based on an incoming closed bar by calling
@@ -93,6 +101,14 @@ class BaseIndicator(abc.ABC):
93
101
  with self._lock:
94
102
  self._history.append(new_value)
95
103
 
104
+ @abc.abstractmethod
105
+ def _compute_indicator(self, incoming_bar: models.Bar) -> float:
106
+ """
107
+ Computes the new indicator value based on an incoming closed bar.
108
+ This method must be implemented by subclasses.
109
+ """
110
+ pass
111
+
96
112
  def __getitem__(self, index: int) -> float:
97
113
  """
98
114
  Return the indicator value at the given index with tolerant indexing.
@@ -118,20 +134,3 @@ class BaseIndicator(abc.ABC):
118
134
  return self._history[normalized]
119
135
  except IndexError:
120
136
  return np.nan
121
-
122
- @property
123
- def latest(self) -> float:
124
- """
125
- The latest (most recent) indicator value.
126
-
127
- Equivalent to self[0]. Returns numpy.nan when no value is available yet.
128
- """
129
- return self[0]
130
-
131
- @abc.abstractmethod
132
- def _compute_indicator(self, incoming_bar: models.Bar) -> float:
133
- """
134
- Computes the new indicator value based on an incoming closed bar.
135
- This method must be implemented by subclasses.
136
- """
137
- pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onesecondtrader
3
- Version: 0.12.0
3
+ Version: 0.12.1
4
4
  Summary: The Trading Infrastructure Toolkit for Python. Research, simulate, and deploy algorithmic trading strategies — all in one place.
5
5
  License-File: LICENSE
6
6
  Author: Nils P. Kujath
@@ -6,7 +6,7 @@ onesecondtrader/datafeeds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
6
6
  onesecondtrader/datafeeds/base_datafeed.py,sha256=QGXtkVUVN7PsDYeIH8h7Hi_kiDDFcqRyW8K8LzZkRTk,1394
7
7
  onesecondtrader/datafeeds/csv_datafeed.py,sha256=WMoZpoian_93CdAzo36hJoF15T0ywRADfuFQcfsPQNc,10957
8
8
  onesecondtrader/indicators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- onesecondtrader/indicators/base_indicator.py,sha256=ipN2uLavRAGvl7Z3z9Zxdzb2MydaZOuJXX86ksalnck,4381
9
+ onesecondtrader/indicators/base_indicator.py,sha256=eGv5_WYOSsuLXX8MbnyE3_Y8owH-2bpUT_GczOXDHVE,4359
10
10
  onesecondtrader/messaging/__init__.py,sha256=9GBHlh6pXweknEacXVBvzpdoTJgVyb3ROLqe1Fhz2ww,179
11
11
  onesecondtrader/messaging/eventbus.py,sha256=R2K85INeYVwJ1tMOybC3WpRraK0ZKVe8WehCbAzzznU,19359
12
12
  onesecondtrader/messaging/events.py,sha256=eaWXQQIUnRNOR-9n5-6lyLbZ6bUtzjD4GI567U_vh4g,23625
@@ -14,7 +14,7 @@ onesecondtrader/monitoring/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
14
14
  onesecondtrader/monitoring/console.py,sha256=1mrojXkyL4ro7ebkvDMGNQiCL-93WEylRuwnfmEKzVs,299
15
15
  onesecondtrader/monitoring/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  onesecondtrader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- onesecondtrader-0.12.0.dist-info/METADATA,sha256=H7yohZt3jchO0dUtQuOoEWKJ6GKSM-wCv06qlkYgeNM,9638
18
- onesecondtrader-0.12.0.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
19
- onesecondtrader-0.12.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
- onesecondtrader-0.12.0.dist-info/RECORD,,
17
+ onesecondtrader-0.12.1.dist-info/METADATA,sha256=saYuNOGorryGgxVFS3BArfldAK4uUtKWarPNjmKsa8Q,9638
18
+ onesecondtrader-0.12.1.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
19
+ onesecondtrader-0.12.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
20
+ onesecondtrader-0.12.1.dist-info/RECORD,,