@@ -8,6 +8,13 @@ processing incoming events (see Custom Event Handler example).
88
99This tutorial is for cases that are not covered by previous tutorials.
1010
11+ .. note ::
12+ This tutorial is converted from jupyter notebook. It uses built-in Jupyter magic functions (details:
13+ https://ipython.readthedocs.io/en/7.15.0/interactive/magics.html) which
14+ start with ``% `` or ``%% `` sign. These function allows us to use only
15+ Jupyter Notebook for the demostration. You are free to use any
16+ IDE/editor without magics.
17+
1118Pipeline
1219~~~~~~~~
1320
@@ -36,7 +43,7 @@ package**
3643
3744 .. code :: text
3845
39- C:\python-api\examples\Low_level_API\custom_listener
46+ C:\job\ python-api\examples\Low_level_API\custom_listener
4047
4148
4249 Create .pyx file with the whole logic
@@ -61,8 +68,8 @@ price and ticker
6168 py_data = <EventHandler> user_data
6269
6370 for i in range(data_count):
64- py_data.__update ([unicode_from_dxf_const_string_t(symbol_name),
65- trades[i].price])
71+ py_data.cython_internal_update_method ([unicode_from_dxf_const_string_t(symbol_name),
72+ trades[i].price])
6673
6774 tc = FuncWrapper.make_from_ptr(trade_custom_listener)
6875
@@ -72,7 +79,7 @@ price and ticker
7279 Writing cust.pyx
7380
7481
75- .. code :: ipython3
82+ .. code :: python3
7683
7784 !ls
7885
@@ -129,7 +136,7 @@ Create setup.py to build the binary file
129136Build the binary file
130137^^^^^^^^^^^^^^^^^^^^^
131138
132- .. code :: ipython3
139+ .. code :: python3
133140
134141 !python setup.py build_ext --inplace
135142
@@ -140,14 +147,13 @@ Build the binary file
140147 [1/1] Cythonizing cust.pyx
141148 running build_ext
142149 building 'cust' extension
143- creating build
144150 ...
145151 Generating code
146152 Finished generating code
147153 copying build\lib.win-amd64-3.7\cust.cp37-win_amd64.pyd ->
148154
149155
150- .. code :: ipython3
156+ .. code :: python3
151157
152158 !ls
153159
@@ -197,31 +203,28 @@ Attach custom handler
197203.. code :: python3
198204
199205 handler = CustomHandler()
206+ handler.columns = ['Symbol', 'Price']
200207 sub.set_event_handler(handler)
201208
202209 Attach custom listener
203210
204211.. code :: python3
205212
206- dxc.dxf_attach_custom_listener(sub, cust.tc, ['Symbol', 'Price'] )
213+ dxc.dxf_attach_custom_listener(sub, cust.tc)
207214 dxc.dxf_add_symbols(sub, ['AAPL', 'MSFT'])
208215
209216 Get data
210217
211218.. code :: python3
212219
213- handler.get_data()[-5 :]
220+ handler.get_data()[-3 :]
214221
215222
216223
217224
218225 .. code :: text
219226
220- [['AAPL', 335.23],
221- ['AAPL', 335.23],
222- ['AAPL', 335.23],
223- ['MSFT', 186.71],
224- ['MSFT', 186.71]]
227+ [['MSFT', 196.14], ['MSFT', 196.27], ['MSFT', 196.33]]
225228
226229
227230
0 commit comments