onesecondtrader 0.45.0__py3-none-any.whl → 0.46.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/events/base.py +6 -4
- onesecondtrader/events/requests/__init__.py +9 -0
- onesecondtrader/events/requests/order_cancellation.py +23 -0
- onesecondtrader/events/requests/order_modification.py +29 -0
- onesecondtrader/events/requests/order_submission.py +33 -0
- onesecondtrader/models/bar_fields.py +7 -7
- onesecondtrader/models/bar_period.py +6 -6
- onesecondtrader/models/order_types.py +6 -6
- onesecondtrader/models/trade_sides.py +4 -4
- {onesecondtrader-0.45.0.dist-info → onesecondtrader-0.46.0.dist-info}/METADATA +1 -1
- onesecondtrader-0.46.0.dist-info/RECORD +16 -0
- onesecondtrader-0.45.0.dist-info/RECORD +0 -12
- {onesecondtrader-0.45.0.dist-info → onesecondtrader-0.46.0.dist-info}/WHEEL +0 -0
- {onesecondtrader-0.45.0.dist-info → onesecondtrader-0.46.0.dist-info}/licenses/LICENSE +0 -0
onesecondtrader/events/base.py
CHANGED
|
@@ -9,10 +9,12 @@ class EventBase:
|
|
|
9
9
|
"""
|
|
10
10
|
Base class for immutable event message objects, using Unix epoch nanoseconds.
|
|
11
11
|
|
|
12
|
-
| Field
|
|
13
|
-
|
|
14
|
-
| ts_event_ns | int | Time at which the represented fact occurred, as UTC epoch nanoseconds. |
|
|
15
|
-
| ts_created_ns | int | Time at which the event object was created, as UTC epoch nanoseconds. |
|
|
12
|
+
| Field | Type | Semantics |
|
|
13
|
+
|-----------------|--------|------------------------------------------------------------------------|
|
|
14
|
+
| `ts_event_ns` | `int` | Time at which the represented fact occurred, as UTC epoch nanoseconds. |
|
|
15
|
+
| `ts_created_ns` | `int` | Time at which the event object was created, as UTC epoch nanoseconds. |
|
|
16
|
+
|
|
17
|
+
If not provided, `ts_created_ns` is assigned automatically at object creation.
|
|
16
18
|
"""
|
|
17
19
|
|
|
18
20
|
ts_event_ns: int
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from .order_submission import OrderSubmissionRequest
|
|
2
|
+
from .order_cancellation import OrderCancellationRequest
|
|
3
|
+
from .order_modification import OrderModificationRequest
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"OrderSubmissionRequest",
|
|
7
|
+
"OrderCancellationRequest",
|
|
8
|
+
"OrderModificationRequest",
|
|
9
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
import uuid
|
|
5
|
+
|
|
6
|
+
from onesecondtrader import events
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
|
|
10
|
+
class OrderCancellationRequest(events.EventBase):
|
|
11
|
+
"""
|
|
12
|
+
Event representing a request to cancel an existing order.
|
|
13
|
+
|
|
14
|
+
| Field | Type | Semantics |
|
|
15
|
+
|-------------------|-------------|---------------------------------------------------------------------|
|
|
16
|
+
| `ts_event_ns` | `int` | Time at which the cancellation request was issued, as UTC epoch ns. |
|
|
17
|
+
| `ts_created_ns` | `int` | Time at which the event object was created, as UTC epoch ns. |
|
|
18
|
+
| `system_order_id` | `uuid.UUID` | System-assigned identifier of the order to be cancelled. |
|
|
19
|
+
| `symbol` | `str` | Identifier of the traded instrument. |
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
system_order_id: uuid.UUID
|
|
23
|
+
symbol: str
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
import uuid
|
|
5
|
+
|
|
6
|
+
from onesecondtrader import events
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
|
|
10
|
+
class OrderModificationRequest(events.EventBase):
|
|
11
|
+
"""
|
|
12
|
+
Event representing a request to modify an existing order.
|
|
13
|
+
|
|
14
|
+
| Field | Type | Semantics |
|
|
15
|
+
|-------------------|-------------------|------------------------------------------------------------------------------|
|
|
16
|
+
| `ts_event_ns` | `int` | Time at which the modification request was issued, as UTC epoch nanoseconds. |
|
|
17
|
+
| `ts_created_ns` | `int` | Time at which the event object was created, as UTC epoch nanoseconds. |
|
|
18
|
+
| `system_order_id` | `uuid.UUID` | System-assigned identifier of the order to be modified. |
|
|
19
|
+
| `symbol` | `str` | Identifier of the traded instrument. |
|
|
20
|
+
| `quantity` | `float` or `None` | Updated order quantity, if modified. |
|
|
21
|
+
| `limit_price` | `float` or `None` | Updated limit price, if modified. |
|
|
22
|
+
| `stop_price` | `float` or `None` | Updated stop price, if modified. |
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
system_order_id: uuid.UUID
|
|
26
|
+
symbol: str
|
|
27
|
+
quantity: float | None = None
|
|
28
|
+
limit_price: float | None = None
|
|
29
|
+
stop_price: float | None = None
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
import uuid
|
|
5
|
+
|
|
6
|
+
from onesecondtrader import events, models
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclasses.dataclass(kw_only=True, frozen=True, slots=True)
|
|
10
|
+
class OrderSubmissionRequest(events.EventBase):
|
|
11
|
+
"""
|
|
12
|
+
Event representing a request to submit a new order to a broker.
|
|
13
|
+
|
|
14
|
+
| Field | Type | Semantics |
|
|
15
|
+
|-------------------|--------------------------|----------------------------------------------------------------------------|
|
|
16
|
+
| `ts_event_ns` | `int` | Time at which the submission request was issued, as UTC epoch nanoseconds. |
|
|
17
|
+
| `ts_created_ns` | `int` | Time at which the event object was created, as UTC epoch nanoseconds. |
|
|
18
|
+
| `system_order_id` | `uuid.UUID` | System-assigned unique identifier for the order submission. |
|
|
19
|
+
| `symbol` | `str` | Identifier of the traded instrument. |
|
|
20
|
+
| `order_type` | `models.OrderType` | Execution constraint of the order. |
|
|
21
|
+
| `side` | `models.TradeSide` | Direction of the trade. |
|
|
22
|
+
| `quantity` | `float` | Requested order quantity. |
|
|
23
|
+
| `limit_price` | `float` or `None` | Limit price, if applicable to the order type. |
|
|
24
|
+
| `stop_price` | `float` or `None` | Stop price, if applicable to the order type. |
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
system_order_id: uuid.UUID = dataclasses.field(default_factory=uuid.uuid4)
|
|
28
|
+
symbol: str
|
|
29
|
+
order_type: models.OrderType
|
|
30
|
+
side: models.TradeSide
|
|
31
|
+
quantity: float
|
|
32
|
+
limit_price: float | None = None
|
|
33
|
+
stop_price: float | None = None
|
|
@@ -7,13 +7,13 @@ class BarField(enum.Enum):
|
|
|
7
7
|
"""
|
|
8
8
|
Enumeration of bar fields used as indicator inputs.
|
|
9
9
|
|
|
10
|
-
| Value
|
|
11
|
-
|
|
12
|
-
| OPEN | Bar's opening value. |
|
|
13
|
-
| HIGH | Bar's highest value. |
|
|
14
|
-
| LOW | Bar's lowest value. |
|
|
15
|
-
| CLOSE | Bar's closing value. |
|
|
16
|
-
| VOLUME | Bar's traded volume. |
|
|
10
|
+
| Value | Semantics |
|
|
11
|
+
|----------|------------------------------------|
|
|
12
|
+
| `OPEN` | Bar's opening value. |
|
|
13
|
+
| `HIGH` | Bar's highest value. |
|
|
14
|
+
| `LOW` | Bar's lowest value. |
|
|
15
|
+
| `CLOSE` | Bar's closing value. |
|
|
16
|
+
| `VOLUME` | Bar's traded volume. |
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
OPEN = enum.auto()
|
|
@@ -7,12 +7,12 @@ class BarPeriod(enum.Enum):
|
|
|
7
7
|
"""
|
|
8
8
|
Enumeration of bar aggregation periods.
|
|
9
9
|
|
|
10
|
-
| Value
|
|
11
|
-
|
|
12
|
-
| SECOND | Duration of 1 second.|
|
|
13
|
-
| MINUTE | Duration of 1 minute.|
|
|
14
|
-
| HOUR | Duration of 1 hour. |
|
|
15
|
-
| DAY | Duration of 1 day. |
|
|
10
|
+
| Value | Semantics |
|
|
11
|
+
|----------|----------------------|
|
|
12
|
+
| `SECOND` | Duration of 1 second.|
|
|
13
|
+
| `MINUTE` | Duration of 1 minute.|
|
|
14
|
+
| `HOUR` | Duration of 1 hour. |
|
|
15
|
+
| `DAY` | Duration of 1 day. |
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
SECOND = enum.auto()
|
|
@@ -7,12 +7,12 @@ class OrderType(enum.Enum):
|
|
|
7
7
|
"""
|
|
8
8
|
Enumeration of order execution types.
|
|
9
9
|
|
|
10
|
-
| Value
|
|
11
|
-
|
|
12
|
-
| LIMIT
|
|
13
|
-
| MARKET
|
|
14
|
-
| STOP
|
|
15
|
-
| STOP_LIMIT
|
|
10
|
+
| Value | Semantics |
|
|
11
|
+
|--------------|-------------------------------------------------------------|
|
|
12
|
+
| `LIMIT` | Executable only at the specified limit price or better. |
|
|
13
|
+
| `MARKET` | Executable immediately at the best available market price. |
|
|
14
|
+
| `STOP` | Becomes a market order once the stop price is reached. |
|
|
15
|
+
| `STOP_LIMIT` | Becomes a limit order once the stop price is reached. |
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
LIMIT = enum.auto()
|
|
@@ -10,10 +10,10 @@ class TradeSide(enum.Enum):
|
|
|
10
10
|
`OrderSide` specifies the direction of change applied to the (net) signed position
|
|
11
11
|
quantity from the perspective of the trading account.
|
|
12
12
|
|
|
13
|
-
| Value
|
|
14
|
-
|
|
15
|
-
| BUY | Increases the signed position quantity. |
|
|
16
|
-
| SELL | Decreases the signed position quantity. |
|
|
13
|
+
| Value | Semantics |
|
|
14
|
+
|---------|------------------------------------------------|
|
|
15
|
+
| `BUY` | Increases the signed position quantity. |
|
|
16
|
+
| `SELL` | Decreases the signed position quantity. |
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
BUY = enum.auto()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onesecondtrader
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.46.0
|
|
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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
onesecondtrader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
onesecondtrader/events/__init__.py,sha256=CTGyob-p2-VbvRZo4u21LbSYfk0cs78eEBRNsjW_CcE,127
|
|
3
|
+
onesecondtrader/events/base.py,sha256=WpLo1bSKJe7Poh2IuDDCiBYZo9vE8mkq3cQlUpyTXsY,850
|
|
4
|
+
onesecondtrader/events/requests/__init__.py,sha256=efXBe231UVtO7K5nMDP-MInG2aOTCDqkkCdjUhXwdKg,276
|
|
5
|
+
onesecondtrader/events/requests/order_cancellation.py,sha256=bycQlLJ4GvOtpeRGbIy5munH8cGZrJUaCLdahA9UesE,1004
|
|
6
|
+
onesecondtrader/events/requests/order_modification.py,sha256=eHwelFaLb_62n0riR_DTRXIFrYZpug-j0-jJCo-K2XQ,1576
|
|
7
|
+
onesecondtrader/events/requests/order_submission.py,sha256=wUFJXlF5EcP14nQKPBoqO_yIfnCEko7Pb1NpNG2dNgQ,1987
|
|
8
|
+
onesecondtrader/models/__init__.py,sha256=8eqxqKF49g_dgTG9EqT2czd_jnSafIG6wyniXPYFvF8,285
|
|
9
|
+
onesecondtrader/models/bar_fields.py,sha256=GnLBL08ueUr35w2dAbKwOBWrdBS98OC9r0T2NifwTH8,646
|
|
10
|
+
onesecondtrader/models/bar_period.py,sha256=J8ncVtcAxR52uD0nbC8Knds_GUP5wiuNj5rAKq4vv-4,475
|
|
11
|
+
onesecondtrader/models/order_types.py,sha256=SiJamarLQ7zkHzHLLbd86I_TeZrQJ4QEIMqNHj4dxXU,737
|
|
12
|
+
onesecondtrader/models/trade_sides.py,sha256=FPnkNeNm70fpkB4HxzYo0PwR6n_T6qdWXMINU0KR6Po,583
|
|
13
|
+
onesecondtrader-0.46.0.dist-info/METADATA,sha256=FX8ZKVZ5usN_7qPS1ZK7y_-rxnKazdTqVEarrAihdrc,9951
|
|
14
|
+
onesecondtrader-0.46.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
15
|
+
onesecondtrader-0.46.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
16
|
+
onesecondtrader-0.46.0.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
onesecondtrader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
onesecondtrader/events/__init__.py,sha256=CTGyob-p2-VbvRZo4u21LbSYfk0cs78eEBRNsjW_CcE,127
|
|
3
|
-
onesecondtrader/events/base.py,sha256=5s4_SOkbMBSGkNAG_1LOD4wbn2jbT7CGBZvsUvKhckc,750
|
|
4
|
-
onesecondtrader/models/__init__.py,sha256=8eqxqKF49g_dgTG9EqT2czd_jnSafIG6wyniXPYFvF8,285
|
|
5
|
-
onesecondtrader/models/bar_fields.py,sha256=zqQhbzFglIUXtUH0cog2Q-GtiRCM2Ej6WC3gvWIbS7c,632
|
|
6
|
-
onesecondtrader/models/bar_period.py,sha256=n7heAAWGfBjO1knx9MnbFC6Mq2OjQGe4Xr6Cp2WxB38,463
|
|
7
|
-
onesecondtrader/models/order_types.py,sha256=_VKDY1eohXgZwwaG_St4tgcq1FfACJsvmgpNesSEX-k,731
|
|
8
|
-
onesecondtrader/models/trade_sides.py,sha256=gk7oTn5wJ_Xg52Uxd_0jS1fnl9ccirHAQ4Wtc2B4-JY,575
|
|
9
|
-
onesecondtrader-0.45.0.dist-info/METADATA,sha256=s0gFuTwJQl9P3uBfZLl1wq7smgoYYB1Wc69XSlSqJfU,9951
|
|
10
|
-
onesecondtrader-0.45.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
11
|
-
onesecondtrader-0.45.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
12
|
-
onesecondtrader-0.45.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|