Skip to content

Commit a111a65

Browse files
committed
Update doc for new parsing options.
1 parent b8e638b commit a111a65

File tree

6 files changed

+253
-23
lines changed

6 files changed

+253
-23
lines changed

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
# (source start file, target name, title,
149149
# author, documentclass [howto, manual, or own class]).
150150
latex_documents = [
151-
(master_doc, 'SimpleFIX.tex', u'SimpleFIX Documentation',
151+
(master_doc, 'SimpleFIX.tex', u'SimpleFIX Programmer\'s Guide',
152152
u'David Arnold', 'manual'),
153153
]
154154

@@ -158,7 +158,7 @@
158158
# One entry per manual page. List of tuples
159159
# (source start file, name, description, authors, manual section).
160160
man_pages = [
161-
(master_doc, 'simplefix', u'SimpleFIX Documentation',
161+
(master_doc, 'simplefix', u'Programmer\'s Guide',
162162
[author], 1)
163163
]
164164

doc/creating.rst

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ Creating Messages
44

55
To create a FIX message, first create an instance of the FixMessage class.
66

7-
7+
.. index:: FixMessage
88
.. code-block:: python
9+
:linenos:
910
1011
messsage = simplefix.FixMessage()
1112
13+
.. index:: header
1214

1315
You can then add fields to the message as required. You should add the
1416
standard header tags 8, 34, 35, 49, 52, and 56 to all messages, unless
@@ -17,10 +19,13 @@ you're deliberately creating a malformed message for testing or similar.
1719
Simple Fields
1820
.............
1921

22+
.. index:: append_pair
23+
2024
For most tags, using ``append_pair()`` is the easiest way to add a field
2125
to the message.
2226

2327
.. code-block:: python
28+
:linenos:
2429
2530
message.append_pair(1, "MC435967")
2631
message.append_pair(54, 1)
@@ -29,16 +34,20 @@ to the message.
2934
Note that any type of value can be used: it will be explicitly converted
3035
to a string before encoding the message.
3136

37+
.. index:: BeginString, BodyLength, MsgType, Checksum
38+
3239
With a few exceptions, the message retains the order in which fields are
33-
added. The exceptions are that fields BeginString (8), Length (9),
40+
added. The exceptions are that fields BeginString (8), BodyLength (9),
3441
MsgType (35), and Checksum (10) are encoded in their required locations,
3542
regardless of what order they were added to the Message.
3643

3744
Header Fields
3845
.............
3946

40-
The Message class does not distinguish header fields from body fields,
41-
with one exception.
47+
The ``FixMessage`` class does not distinguish header fields from body
48+
fields, with one exception.
49+
50+
.. index:: append_pair, header
4251

4352
To enable fields to be added to the FIX header after body fields have
4453
already been added, there's an optional keyword parameter to the
@@ -47,10 +56,13 @@ already been added, there's an optional keyword parameter to the
4756
any previously added header fields, starting at the beginning of the
4857
message.
4958

59+
.. index:: MsgSeqNum, SendingTime
60+
5061
This is normally used for setting things like MsgSeqNum (34) and
5162
SendingTime (52) immediately prior to encoding and sending the message.
5263

5364
.. code-block:: python
65+
:linenos:
5466
5567
message.append_pair(8, "FIX.4.4")
5668
message.append_pair(35, 0)
@@ -65,19 +77,24 @@ the message. After encoding, the order of fields would be: 8, 9, 35,
6577
34, 52, 49, 56, 112, 10.
6678

6779
It's not necessary, but field 49 and 56 could also be written with
68-
``header`` set ``True``, in which case, they'd precede 34 ane 52 when
80+
``header`` set ``True``, in which case, they'd precede 34 and 52 when
6981
encoded.
7082

71-
See ``append_time()`` below for details of that method.
83+
.. index:: append_utc_timestamp
84+
85+
See ``append_utc_timestamp()`` below for details of that method.
7286

7387
Pre-composed Pairs
7488
..................
7589

90+
.. index:: append_string, append_strings
91+
7692
In some cases, your FIX application might have the message content
7793
as pre-composed "tag=value" strings. In this case, as an optimisation,
7894
the ``append_string()`` or ``append_strings()`` methods can be used.
7995

8096
.. code-block:: python
97+
:linenos:
8198
8299
BEGIN_STRING = "8=FIX.4.2"
83100
STR_SEQ = ["49=SENDER", "56=TARGET"]
@@ -92,31 +109,42 @@ body fields.
92109
Timestamps
93110
..........
94111

112+
.. index:: UTCTimestamp, UTCTimeOnly, TZTimestamp, TZTimeOnly
113+
95114
The FIX protocol defines four time types: UTCTimestamp, UTCTimeOnly,
96115
TZTimestamp, and TZTimeOnly. Field values of these types can be added
97116
using dedicated functions, avoiding the need to translate and format
98117
time values in the application code.
99118

119+
.. index:: append_utc_timestamp, append_tz_timestamp
120+
.. index:: append_utc_time_only, append_tz_time_only
100121
.. code-block:: python
122+
:linenos:
101123
102124
message.append_utc_timestamp(52, precision=6, header=True)
103125
message.append_tz_timestamp(1132, my_datetime)
104126
message.append_utc_time_only(1495, start_time)
105127
message.append_tz_time_only(1079, maturity_time)
106128
129+
.. index:: time, datetime
130+
107131
The first parameter to these functions is the field's tag number. The
108132
second parameter is optional: if None or not supplied, it defaults to the
109133
current time, otherwise it must be a Unix epoch time (like from
110134
``time.time()``), or a ``datetime`` instance.
111135

136+
.. index:: precision, second, milliseconds, microseconds, header
137+
112138
There are two keyword parameters: ``precision`` which can be 0 for just
113139
seconds, 3 for milliseconds, or 6 for microseconds; and ``header`` to
114140
insert this field in the header rather than the body.
115141

116142
In addition, there are a set of methods for creating correctly formatted
117143
time only values from their components:
118144

145+
.. index:: append_utc_time_only_parts, append_tz_time_only_parts
119146
.. code-block:: python
147+
:linenos:
120148
121149
message.append_utc_time_only_parts(1495, 7, 0, 0, 0, 0)
122150
message.append_tz_time_only_parts(1079, 20, 0, 0, offset=-300)
@@ -125,6 +153,8 @@ As usual, the first parameter to these functions is the field's tag number.
125153
The next three parameters are the hour, minute, and seconds of the time value,
126154
followed by optional milliseconds and microseconds values.
127155

156+
.. index:: timezone
157+
128158
The timezone for the TZTimeOnly field is set using an offset value, the
129159
number of minutes east of UTC. Thus CET will be offset 60 minutes, and
130160
New York offset -240 minutes (four hours west).
@@ -136,7 +166,9 @@ to manage the formatting itself.
136166
Repeating Groups
137167
................
138168

139-
There is no specific support for creating repeating groups in Messages.
169+
.. index:: repeating group
170+
171+
There is no specific support for creating repeating groups in FixMessages.
140172
The count field must be appended first, followed by the group's member's
141173
fields.
142174

@@ -146,15 +178,20 @@ but note that the count fields are not added automatically.
146178
Data Fields
147179
...........
148180

181+
.. index:: data, raw data
182+
149183
There are numerous defined fields in the FIX protocol that use the *data*
150184
type. These fields consist of two parts: a length, which must come first,
151185
immediately followed by the value field, whose value may include the ASCII
152186
SOH character, the ASCII NUL character, and in fact any 8-bit byte value.
153187

188+
.. index:: append_data
189+
154190
To append a data field to a message, the ``append_data()`` method can be
155191
used. It will correctly add both the length field and the value field.
156192

157193
.. code-block:: python
194+
:linenos:
158195
159196
message.append_data(95, 96, "RAW DATA \x00\x01 VALUE")
160197

doc/getting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Installation
44
============
55

66
simplefix has a few dependencies. Firstly, it is known to run on
7-
Python_ 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7. It will not run on
8-
Python 2.5 or earlier.
7+
Python_ 3.3 through to 3.10. It will not run on Python 2.7 or
8+
earlier versions.
99

1010
You can install it using pip_::
1111

doc/import.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Importing
44
You can import the *simplefix* module maintaining its internal structure,
55
or you can import some or all bindings directly.
66

7+
.. index:: simplefix, FixMessage
78
.. code-block:: python
89
:linenos:
910
@@ -22,6 +23,8 @@ Or
2223
message = FixMessage()
2324
2425
26+
.. index:: import, namespace
27+
2528
Note that the "import \*" form is explicitly supported, with the exposed
2629
namespace explicitly managed to contain only the public features of the
2730
package.

doc/index.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,3 @@ SimpleFIX
1313
creating
1414
encoding
1515
parsing
16-
17-
Indices and tables
18-
==================
19-
20-
* :ref:`genindex`
21-
* :ref:`modindex`
22-
* :ref:`search`

0 commit comments

Comments
 (0)