itchfeed 1.0.1__tar.gz → 1.0.2__tar.gz
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.
- {itchfeed-1.0.1/itchfeed.egg-info → itchfeed-1.0.2}/PKG-INFO +5 -4
- {itchfeed-1.0.1 → itchfeed-1.0.2}/README.md +3 -2
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itch/__init__.py +0 -1
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itch/messages.py +2 -2
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itch/parser.py +47 -53
- {itchfeed-1.0.1 → itchfeed-1.0.2/itchfeed.egg-info}/PKG-INFO +5 -4
- {itchfeed-1.0.1 → itchfeed-1.0.2}/setup.py +7 -5
- {itchfeed-1.0.1 → itchfeed-1.0.2}/LICENSE +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/MANIFEST.in +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itch/indicators.py +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itchfeed.egg-info/SOURCES.txt +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itchfeed.egg-info/dependency_links.txt +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itchfeed.egg-info/requires.txt +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/itchfeed.egg-info/top_level.txt +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/requirements.txt +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/setup.cfg +0 -0
- {itchfeed-1.0.1 → itchfeed-1.0.2}/tests/test_messages.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: itchfeed
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
4
4
|
Summary: Simple parser for ITCH messages
|
5
5
|
Home-page: https://github.com/bbalouki/itch
|
6
6
|
Download-URL: https://pypi.org/project/itchfeed/
|
@@ -9,7 +9,7 @@ Author-email: <bertin@bbstrader.com>
|
|
9
9
|
Maintainer: Bertin Balouki SIMYELI
|
10
10
|
License: The MIT License (MIT)
|
11
11
|
Project-URL: Source Code, https://github.com/bbalouki/itch
|
12
|
-
Keywords: Finance,Financial,Quantitative,Equities,Data,Feed,ETFs,Funds,Trading,Investing
|
12
|
+
Keywords: Finance,Financial,Quantitative,Equities,Totalview-ITCH,Totalview,Nasdaq-ITCH,Nasdaq,ITCH,Data,Feed,ETFs,Funds,Trading,Investing
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
14
14
|
Classifier: Intended Audience :: Developers
|
15
15
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
@@ -38,6 +38,7 @@ Dynamic: summary
|
|
38
38
|
[](https://pypi.org/project/itchfeed/)
|
39
39
|
[](https://pypi.python.org/pypi/itchfeed)
|
40
40
|
[](https://pypi.org/project/itchfeed/)
|
41
|
+
[](https://pepy.tech/projects/itchfeed)
|
41
42
|
[](https://www.codefactor.io/repository/github/bbalouki/itch)
|
42
43
|
[](https://www.linkedin.com/in/bertin-balouki-simyeli-15b17a1a6/)
|
43
44
|
[](https://paypal.me/bertinbalouki?country.x=SN&locale.x=en_US)
|
@@ -86,7 +87,7 @@ You can install this project using ``pip``
|
|
86
87
|
This is useful for processing historical ITCH data stored in files. The `MessageParser` handles buffering efficiently.
|
87
88
|
|
88
89
|
```python
|
89
|
-
from itch import MessageParser
|
90
|
+
from itch.parser import MessageParser
|
90
91
|
from itch.messages import AddOrderMessage, TradeMessage
|
91
92
|
|
92
93
|
# Initialize the parser. Optionally filter messages by type.
|
@@ -135,7 +136,7 @@ except Exception as e:
|
|
135
136
|
This is suitable for real-time processing, such as reading from a network stream.
|
136
137
|
|
137
138
|
```python
|
138
|
-
from itch import MessageParser
|
139
|
+
from itch.parser import MessageParser
|
139
140
|
from itch.messages import AddOrderMessage
|
140
141
|
from queue import Queue
|
141
142
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
[](https://pypi.org/project/itchfeed/)
|
3
3
|
[](https://pypi.python.org/pypi/itchfeed)
|
4
4
|
[](https://pypi.org/project/itchfeed/)
|
5
|
+
[](https://pepy.tech/projects/itchfeed)
|
5
6
|
[](https://www.codefactor.io/repository/github/bbalouki/itch)
|
6
7
|
[](https://www.linkedin.com/in/bertin-balouki-simyeli-15b17a1a6/)
|
7
8
|
[](https://paypal.me/bertinbalouki?country.x=SN&locale.x=en_US)
|
@@ -50,7 +51,7 @@ You can install this project using ``pip``
|
|
50
51
|
This is useful for processing historical ITCH data stored in files. The `MessageParser` handles buffering efficiently.
|
51
52
|
|
52
53
|
```python
|
53
|
-
from itch import MessageParser
|
54
|
+
from itch.parser import MessageParser
|
54
55
|
from itch.messages import AddOrderMessage, TradeMessage
|
55
56
|
|
56
57
|
# Initialize the parser. Optionally filter messages by type.
|
@@ -99,7 +100,7 @@ except Exception as e:
|
|
99
100
|
This is suitable for real-time processing, such as reading from a network stream.
|
100
101
|
|
101
102
|
```python
|
102
|
-
from itch import MessageParser
|
103
|
+
from itch.parser import MessageParser
|
103
104
|
from itch.messages import AddOrderMessage
|
104
105
|
from queue import Queue
|
105
106
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import struct
|
2
2
|
from dataclasses import make_dataclass
|
3
|
-
from typing import List, Tuple
|
3
|
+
from typing import Dict, List, Tuple, Type
|
4
4
|
|
5
5
|
MESSAGES = b"SAFECXDUBHRYPQINLVWKJhO"
|
6
6
|
|
@@ -1573,7 +1573,7 @@ class DLCRMessage(MarketMessage):
|
|
1573
1573
|
return message
|
1574
1574
|
|
1575
1575
|
|
1576
|
-
messages = {
|
1576
|
+
messages: Dict[bytes, Type[MarketMessage]] = {
|
1577
1577
|
b"S": SystemEventMessage,
|
1578
1578
|
b"R": StockDirectoryMessage,
|
1579
1579
|
b"H": StockTradingActionMessage,
|
@@ -1,8 +1,10 @@
|
|
1
1
|
from queue import Queue
|
2
2
|
from typing import BinaryIO, List
|
3
3
|
|
4
|
-
|
5
|
-
from itch.messages import
|
4
|
+
from itch.messages import MESSAGES, MarketMessage
|
5
|
+
from itch.messages import messages as msgs
|
6
|
+
|
7
|
+
|
6
8
|
class MessageParser(object):
|
7
9
|
"""
|
8
10
|
A market message parser for ITCH 5.0 data.
|
@@ -17,6 +19,43 @@ class MessageParser(object):
|
|
17
19
|
file: BinaryIO,
|
18
20
|
cachesize: int = 4096,
|
19
21
|
) -> List[MarketMessage]:
|
22
|
+
"""
|
23
|
+
Reads and parses market messages from a binary file-like object.
|
24
|
+
|
25
|
+
This method processes binary data in chunks, extracts individual messages
|
26
|
+
according to a specific format, and returns a list of successfully decoded
|
27
|
+
MarketMessage objects. Parsing stops either when the end of the file is
|
28
|
+
reached or when a system message with an end-of-messages event code is encountered.
|
29
|
+
|
30
|
+
Args:
|
31
|
+
file (BinaryIO):
|
32
|
+
A binary file-like object (opened in binary mode) from which market messages are read.
|
33
|
+
cachesize (int, optional):
|
34
|
+
The size (in bytes) of each data chunk read from the file. Defaults to 4096 bytes.
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
List[MarketMessage]:
|
38
|
+
A list of parsed MarketMessage objects that match the allowed message types
|
39
|
+
defined in self.message_type.
|
40
|
+
|
41
|
+
Raises:
|
42
|
+
ValueError:
|
43
|
+
If a message does not start with the expected 0x00 byte, indicating
|
44
|
+
an unexpected file format or possible corruption.
|
45
|
+
|
46
|
+
Message Format:
|
47
|
+
- Each message starts with a 0x00 byte.
|
48
|
+
- The following byte specifies the message length.
|
49
|
+
- The complete message consists of the first 2 bytes and 'message length' bytes of body.
|
50
|
+
- If a system message (message_type == b'S') with event_code == b'C' is encountered,
|
51
|
+
parsing stops immediately.
|
52
|
+
|
53
|
+
Example:
|
54
|
+
>>> with open('market_data.bin', 'rb') as binary_file:
|
55
|
+
>>> messages = reader.read_message_from_file(binary_file, cachesize=4096)
|
56
|
+
>>> for message in messages:
|
57
|
+
>>> print(message)
|
58
|
+
"""
|
20
59
|
max_message_size = 52
|
21
60
|
file_end_reached = False
|
22
61
|
|
@@ -126,54 +165,9 @@ class MessageParser(object):
|
|
126
165
|
All message type indicators are single ASCII characters.
|
127
166
|
"""
|
128
167
|
message_type = message[0:1]
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
return msg.StockTradingActionMessage(message)
|
136
|
-
case b"Y":
|
137
|
-
return msg.RegSHOMessage(message)
|
138
|
-
case b"L":
|
139
|
-
return msg.MarketParticipantPositionMessage(message)
|
140
|
-
case b"V":
|
141
|
-
return msg.MWCBDeclineLeveMessage(message)
|
142
|
-
case b"W":
|
143
|
-
return msg.MWCBStatusMessage(message)
|
144
|
-
case b"K":
|
145
|
-
return msg.IPOQuotingPeriodUpdateMessage(message)
|
146
|
-
case b"J":
|
147
|
-
return msg.LULDAuctionCollarMessage(message)
|
148
|
-
case b"h":
|
149
|
-
return msg.OperationalHaltMessage(message)
|
150
|
-
case b"A":
|
151
|
-
return msg.AddOrderNoMPIAttributionMessage(message)
|
152
|
-
case b"F":
|
153
|
-
return msg.AddOrderMPIDAttribution(message)
|
154
|
-
case b"E":
|
155
|
-
return msg.OrderExecutedMessage(message)
|
156
|
-
case b"C":
|
157
|
-
return msg.OrderExecutedWithPriceMessage(message)
|
158
|
-
case b"X":
|
159
|
-
return msg.OrderCancelMessage(message)
|
160
|
-
case b"D":
|
161
|
-
return msg.OrderDeleteMessage(message)
|
162
|
-
case b"U":
|
163
|
-
return msg.OrderReplaceMessage(message)
|
164
|
-
case b"P":
|
165
|
-
return msg.NonCrossTradeMessage(message)
|
166
|
-
case b"Q":
|
167
|
-
return msg.CrossTradeMessage(message)
|
168
|
-
case b"B":
|
169
|
-
return msg.BrokenTradeMessage(message)
|
170
|
-
case b"I":
|
171
|
-
return msg.NOIIMessage(message)
|
172
|
-
case b"N":
|
173
|
-
return msg.RetailPriceImprovementIndicator(message)
|
174
|
-
case b"O":
|
175
|
-
return msg.DLCRMessage(message)
|
176
|
-
case _:
|
177
|
-
raise ValueError(
|
178
|
-
f"Unknown message type: {message_type.decode(encoding='ascii')}"
|
179
|
-
)
|
168
|
+
try:
|
169
|
+
return msgs[message_type](message)
|
170
|
+
except Exception:
|
171
|
+
raise ValueError(
|
172
|
+
f"Unknown message type: {message_type.decode(encoding='ascii')}"
|
173
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: itchfeed
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
4
4
|
Summary: Simple parser for ITCH messages
|
5
5
|
Home-page: https://github.com/bbalouki/itch
|
6
6
|
Download-URL: https://pypi.org/project/itchfeed/
|
@@ -9,7 +9,7 @@ Author-email: <bertin@bbstrader.com>
|
|
9
9
|
Maintainer: Bertin Balouki SIMYELI
|
10
10
|
License: The MIT License (MIT)
|
11
11
|
Project-URL: Source Code, https://github.com/bbalouki/itch
|
12
|
-
Keywords: Finance,Financial,Quantitative,Equities,Data,Feed,ETFs,Funds,Trading,Investing
|
12
|
+
Keywords: Finance,Financial,Quantitative,Equities,Totalview-ITCH,Totalview,Nasdaq-ITCH,Nasdaq,ITCH,Data,Feed,ETFs,Funds,Trading,Investing
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
14
14
|
Classifier: Intended Audience :: Developers
|
15
15
|
Classifier: Intended Audience :: Financial and Insurance Industry
|
@@ -38,6 +38,7 @@ Dynamic: summary
|
|
38
38
|
[](https://pypi.org/project/itchfeed/)
|
39
39
|
[](https://pypi.python.org/pypi/itchfeed)
|
40
40
|
[](https://pypi.org/project/itchfeed/)
|
41
|
+
[](https://pepy.tech/projects/itchfeed)
|
41
42
|
[](https://www.codefactor.io/repository/github/bbalouki/itch)
|
42
43
|
[](https://www.linkedin.com/in/bertin-balouki-simyeli-15b17a1a6/)
|
43
44
|
[](https://paypal.me/bertinbalouki?country.x=SN&locale.x=en_US)
|
@@ -86,7 +87,7 @@ You can install this project using ``pip``
|
|
86
87
|
This is useful for processing historical ITCH data stored in files. The `MessageParser` handles buffering efficiently.
|
87
88
|
|
88
89
|
```python
|
89
|
-
from itch import MessageParser
|
90
|
+
from itch.parser import MessageParser
|
90
91
|
from itch.messages import AddOrderMessage, TradeMessage
|
91
92
|
|
92
93
|
# Initialize the parser. Optionally filter messages by type.
|
@@ -135,7 +136,7 @@ except Exception as e:
|
|
135
136
|
This is suitable for real-time processing, such as reading from a network stream.
|
136
137
|
|
137
138
|
```python
|
138
|
-
from itch import MessageParser
|
139
|
+
from itch.parser import MessageParser
|
139
140
|
from itch.messages import AddOrderMessage
|
140
141
|
from queue import Queue
|
141
142
|
|
@@ -12,7 +12,7 @@ with io.open(path.join(here, "README.md"), encoding="utf-8") as f:
|
|
12
12
|
with io.open(path.join(here, "requirements.txt"), encoding="utf-8") as f:
|
13
13
|
REQUIREMENTS = [line.rstrip() for line in f]
|
14
14
|
|
15
|
-
VERSION = "1.0.
|
15
|
+
VERSION = "1.0.2"
|
16
16
|
DESCRIPTION = "Simple parser for ITCH messages"
|
17
17
|
|
18
18
|
KEYWORDS = [
|
@@ -20,15 +20,17 @@ KEYWORDS = [
|
|
20
20
|
"Financial",
|
21
21
|
"Quantitative",
|
22
22
|
"Equities",
|
23
|
+
"Totalview-ITCH",
|
24
|
+
"Totalview",
|
25
|
+
"Nasdaq-ITCH",
|
26
|
+
"Nasdaq",
|
27
|
+
"ITCH",
|
23
28
|
"Data",
|
24
29
|
"Feed",
|
25
30
|
"ETFs",
|
26
31
|
"Funds",
|
27
32
|
"Trading",
|
28
33
|
"Investing",
|
29
|
-
"Portfolio",
|
30
|
-
"Optimization",
|
31
|
-
"Performance",
|
32
34
|
]
|
33
35
|
|
34
36
|
CLASSIFIERS = [
|
@@ -37,7 +39,7 @@ CLASSIFIERS = [
|
|
37
39
|
"Intended Audience :: Financial and Insurance Industry",
|
38
40
|
"Topic :: Office/Business :: Financial :: Investment",
|
39
41
|
"Programming Language :: Python :: 3",
|
40
|
-
"Operating System :: OS Independent"
|
42
|
+
"Operating System :: OS Independent",
|
41
43
|
]
|
42
44
|
|
43
45
|
INLCUDE = ["itch"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|