Skip to content

Commit fc0e52b

Browse files
author
Aleksandr Salynskii
authored
[EN-1328] Corrected prints and changed to python3 in basic_usage.rst
1 parent 985d5b8 commit fc0e52b

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

docs/basic_usage.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Basic Usage
66
Import package
77
~~~~~~~~~~~~~~
88

9-
.. code:: ipython3
9+
.. code:: python3
1010
1111
import dxfeed as dx
1212
from datetime import datetime # for timed subscription
@@ -16,56 +16,56 @@ Configure and create connection with Endpoint class
1616

1717
Create instance of Endpoint class which will connect provided address.
1818

19-
.. code:: ipython3
19+
.. code:: python3
2020
2121
endpoint = dx.Endpoint('demo.dxfeed.com:7300')
2222
2323
Endpoint instance contains information about the connection,
2424
e.g. connection address or status
2525

26-
.. code:: ipython3
26+
.. code:: python3
2727
2828
print(f'Connected address: {endpoint.address}')
2929
print(f'Connection status: {endpoint.connection_status}')
3030
3131
.. code:: text
3232
33-
demo.dxfeed.com:7300
34-
Connected and authorized
33+
Connected address: demo.dxfeed.com:7300
34+
Connection status: Connected and authorized
3535
3636
Configure and create subscription
3737
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3838

3939
You should specify event type. For timed subscription (conflated stream)
4040
you should also provide time to start subscription from.
4141

42-
.. code:: ipython3
42+
.. code:: python3
4343
4444
trade_sub = endpoint.create_subscription('Trade', data_len=-1)
4545
4646
**Attach default listener** - function that process incoming events
4747

48-
.. code:: ipython3
48+
.. code:: python3
4949
5050
trade_sub = trade_sub.attach_listener()
5151
5252
**Add tikers** you want to recieve events for
5353

54-
.. code:: ipython3
54+
.. code:: python3
5555
5656
trade_sub = trade_sub.add_symbols(['C', 'AAPL'])
5757
5858
For timed subscription you may provide either datetime object or string.
5959
String might be incomlete, in this case you will get warning with how
6060
your provided date parsed automatically
6161

62-
.. code:: ipython3
62+
.. code:: python3
6363
6464
tns_sub = endpoint.create_subscription('TimeAndSale', date_time=datetime.now()) \
6565
.attach_listener() \
6666
.add_symbols(['AMZN'])
6767
68-
.. code:: ipython3
68+
.. code:: python3
6969
7070
candle_sub = endpoint.create_subscription('Candle', date_time='2020-04-16 13:05')
7171
candle_sub = candle_sub.attach_listener()
@@ -74,15 +74,15 @@ your provided date parsed automatically
7474
Subscription instance properties
7575
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7676

77-
.. code:: ipython3
77+
.. code:: python3
7878
7979
print(f'Subscription event type: {tns_sub.event_type}')
8080
print(f'Subscription symbols: {candle_sub.symbols}')
8181
8282
.. code:: text
8383
84-
TimeAndSale
85-
['AAPL', 'MSFT']
84+
Subscription event type: TimeAndSale
85+
Subscription symbols: ['AAPL', 'MSFT']
8686
8787
Access data
8888
~~~~~~~~~~~
@@ -91,26 +91,26 @@ Data is stored as deque. Its length is configured with data_len
9191
parameter and by default is 100000. When you call method below you
9292
extracts all data recieved to the moment and clears the buffer in class.
9393

94-
.. code:: ipython3
94+
.. code:: python3
9595
9696
candle_sub.get_data()
9797
9898
Close connection
9999
~~~~~~~~~~~~~~~~
100100

101-
.. code:: ipython3
101+
.. code:: python3
102102
103103
endpoint.close_connection()
104104
print(f'Connection status: {endpoint.connection_status}')
105105
106106
.. code:: text
107107
108-
Not connected
108+
Connection status: Not connected
109109
110110
Transform data to pandas DataFrame
111111
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112112

113-
.. code:: ipython3
113+
.. code:: python3
114114
115115
trade_df = trade_sub.to_dataframe()
116116
tns_df = tns_sub.to_dataframe()

0 commit comments

Comments
 (0)