onesecondtrader 0.14.2__py3-none-any.whl → 0.16.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.
- onesecondtrader/__init__.py +0 -12
- onesecondtrader/indicators.py +102 -0
- onesecondtrader/ontology.py +18 -0
- {onesecondtrader-0.14.2.dist-info → onesecondtrader-0.16.0.dist-info}/METADATA +2 -1
- onesecondtrader-0.16.0.dist-info/RECORD +7 -0
- onesecondtrader/brokers/__init__.py +0 -0
- onesecondtrader/brokers/base_broker.py +0 -99
- onesecondtrader/brokers/simulated_broker.py +0 -10
- onesecondtrader/core/__init__.py +0 -0
- onesecondtrader/core/models.py +0 -188
- onesecondtrader/core/portfolio.py +0 -359
- onesecondtrader/core/py.typed +0 -0
- onesecondtrader/datafeeds/__init__.py +0 -0
- onesecondtrader/datafeeds/base_datafeed.py +0 -54
- onesecondtrader/datafeeds/csv_datafeed.py +0 -297
- onesecondtrader/indicators/__init__.py +0 -0
- onesecondtrader/indicators/base_indicator.py +0 -136
- onesecondtrader/indicators/moving_averages.py +0 -132
- onesecondtrader/messaging/__init__.py +0 -9
- onesecondtrader/messaging/eventbus.py +0 -499
- onesecondtrader/messaging/events.py +0 -868
- onesecondtrader/monitoring/__init__.py +0 -0
- onesecondtrader/monitoring/console.py +0 -14
- onesecondtrader/monitoring/py.typed +0 -0
- onesecondtrader/py.typed +0 -0
- onesecondtrader/strategies/__init__.py +0 -0
- onesecondtrader/strategies/base_strategy.py +0 -46
- onesecondtrader-0.14.2.dist-info/RECORD +0 -27
- {onesecondtrader-0.14.2.dist-info → onesecondtrader-0.16.0.dist-info}/WHEEL +0 -0
- {onesecondtrader-0.14.2.dist-info → onesecondtrader-0.16.0.dist-info}/licenses/LICENSE +0 -0
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"""Console logging utilities for OneSecondTrader.
|
|
2
|
-
|
|
3
|
-
Simple console logging configuration for terminal output.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import logging
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
logging.basicConfig(
|
|
10
|
-
level=logging.DEBUG,
|
|
11
|
-
format="%(asctime)s - %(levelname)s - %(threadName)s - %(message)s",
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
logger = logging.getLogger("onesecondtrader")
|
|
File without changes
|
onesecondtrader/py.typed
DELETED
|
File without changes
|
|
File without changes
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import abc
|
|
2
|
-
import threading
|
|
3
|
-
from onesecondtrader.messaging.eventbus import EventBus, system_event_bus
|
|
4
|
-
from onesecondtrader.core import models
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Strategy(abc.ABC):
|
|
8
|
-
def __init__(self, name: str, event_bus: EventBus | None = None):
|
|
9
|
-
self.name = name
|
|
10
|
-
self.event_bus = event_bus if event_bus else system_event_bus
|
|
11
|
-
self._lock = threading.Lock()
|
|
12
|
-
self._active_symbols: set[str] = set()
|
|
13
|
-
self._close_only_symbols: set[str] = set()
|
|
14
|
-
self._close_open_positions_only: bool = False
|
|
15
|
-
self._close_mode: models.StrategyShutdownMode | None = None
|
|
16
|
-
|
|
17
|
-
def __repr__(self) -> str:
|
|
18
|
-
return f"{type(self).__name__}(name='{self.name}')"
|
|
19
|
-
|
|
20
|
-
def request_close(
|
|
21
|
-
self, mode: models.StrategyShutdownMode = models.StrategyShutdownMode.SOFT
|
|
22
|
-
) -> None:
|
|
23
|
-
# Minimalist soft/hard close signalling; subclasses act on this
|
|
24
|
-
self._close_open_positions_only = True
|
|
25
|
-
self._close_mode = mode
|
|
26
|
-
|
|
27
|
-
@abc.abstractmethod
|
|
28
|
-
def is_flat(self) -> bool:
|
|
29
|
-
raise NotImplementedError
|
|
30
|
-
|
|
31
|
-
def add_symbols(self, symbols: list[str]) -> None:
|
|
32
|
-
"""
|
|
33
|
-
Add symbols to the strategy. Thread-safe and idempotent.
|
|
34
|
-
"""
|
|
35
|
-
clean = [s.strip() for s in symbols if s and s.strip()]
|
|
36
|
-
with self._lock:
|
|
37
|
-
self._active_symbols.update(clean)
|
|
38
|
-
|
|
39
|
-
def remove_symbols(self, symbols: list[str]) -> None:
|
|
40
|
-
"""
|
|
41
|
-
Remove symbols from the strategy. Thread-safe and idempotent.
|
|
42
|
-
"""
|
|
43
|
-
clean = [s.strip() for s in symbols if s and s.strip()]
|
|
44
|
-
with self._lock:
|
|
45
|
-
for sym in clean:
|
|
46
|
-
self._active_symbols.discard(sym)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
onesecondtrader/__init__.py,sha256=TNqlT20sH46-J7F6giBxwWYG1-wFZZt7toDbZeQK6KQ,210
|
|
2
|
-
onesecondtrader/brokers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
onesecondtrader/brokers/base_broker.py,sha256=PtLyFEXY5VisnFqJabOkRGEsSS05SUSTc7JIAzk-OA8,2948
|
|
4
|
-
onesecondtrader/brokers/simulated_broker.py,sha256=ptbDkGG7NDKpqPn5ZkthALI2p533J9twS9hDQCaMeOY,242
|
|
5
|
-
onesecondtrader/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
onesecondtrader/core/models.py,sha256=fPI9gpgAhd2JREoo77jwf2x-QZTrSLg8_SWYKLSqwGQ,4721
|
|
7
|
-
onesecondtrader/core/portfolio.py,sha256=7MOASfqz6qykMSadu2cfYAzLTZrtOw5q6b04hk4tt-0,15950
|
|
8
|
-
onesecondtrader/core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
onesecondtrader/datafeeds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
onesecondtrader/datafeeds/base_datafeed.py,sha256=WViw7tzsVoZku-V-DxbqKSjNPkvaiA8G-J5Rs9eKKn8,1299
|
|
11
|
-
onesecondtrader/datafeeds/csv_datafeed.py,sha256=WMoZpoian_93CdAzo36hJoF15T0ywRADfuFQcfsPQNc,10957
|
|
12
|
-
onesecondtrader/indicators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
onesecondtrader/indicators/base_indicator.py,sha256=eGv5_WYOSsuLXX8MbnyE3_Y8owH-2bpUT_GczOXDHVE,4359
|
|
14
|
-
onesecondtrader/indicators/moving_averages.py,sha256=ddZy640Z2aVgeiZ4SFRWsHDFaOBCW7u3mqBmc1wZrmQ,4678
|
|
15
|
-
onesecondtrader/messaging/__init__.py,sha256=8LMFnw7KsnctDxyC8ZybDHgcdMB8fSy56Fad9Ozj6Bw,243
|
|
16
|
-
onesecondtrader/messaging/eventbus.py,sha256=sEp5ebYNRHiqTRXaTqytZ2PV2wKDXj5NlWNi1OKn2_4,19447
|
|
17
|
-
onesecondtrader/messaging/events.py,sha256=ggP5wDTqeFxLijTukEoDEMnH4VZsVaYjHny-XXKsnls,27377
|
|
18
|
-
onesecondtrader/monitoring/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
onesecondtrader/monitoring/console.py,sha256=1mrojXkyL4ro7ebkvDMGNQiCL-93WEylRuwnfmEKzVs,299
|
|
20
|
-
onesecondtrader/monitoring/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
onesecondtrader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
onesecondtrader/strategies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
onesecondtrader/strategies/base_strategy.py,sha256=chmJyX8jVe-H24zmFDKeqClrGv-EJFtBlKzLcQe5mmM,1650
|
|
24
|
-
onesecondtrader-0.14.2.dist-info/METADATA,sha256=1Qvu0gEoIIrQSGGqWCvEzKEVdye_p-hgPbNyvsy7Hh4,9638
|
|
25
|
-
onesecondtrader-0.14.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
26
|
-
onesecondtrader-0.14.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
27
|
-
onesecondtrader-0.14.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|