Skip to content

Commit c642e26

Browse files
exception handling in user code (not ready)
1 parent 919f39f commit c642e26

File tree

16 files changed

+50
-41
lines changed

16 files changed

+50
-41
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ with BinanceWebSocketApiManager(exchange='binance.com') as ubwa:
114114

115115
Basically that's it, but there are more options.
116116

117-
### Convert received raw webstream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
117+
### Convert received stream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
118118

119119
```
120120
unicorn_fied_stream_data = UnicornFy.binance_com_websocket(data)
@@ -126,7 +126,7 @@ or
126126
ubwa.create_stream(['trade'], ['btcusdt'], output="UnicornFy")
127127
```
128128

129-
### [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
129+
## [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
130130

131131
```
132132
markets = ['engbtc', 'zileth']
@@ -178,24 +178,27 @@ guide on
178178
[how to process requests via the Binance WebSocket API](https://medium.lucit.tech/create-and-cancel-orders-via-websocket-on-binance-7f828831404)!
179179

180180
## Stop `ubwa` after usage to avoid memory leaks
181+
181182
When you instantiate UBWA with `with`, `ubwa.stop_manager()` is automatically executed upon exiting the `with`-block.
183+
182184
```
183185
with BinanceWebSocketApiManager() as ubwa:
184186
ubwa.create_stream(channels="trade", markets="btcusdt", stream_label="TRADES")
185187
```
186188

187189
Without `with`, you must explicitly execute `ubwa.stop_manager()` yourself.
190+
188191
```
189192
ubwa.stop_manager()
190193
```
191194

192-
## STREAM SIGNALS - know the state of your streams
195+
## `stream_signals` - know the state of your streams
193196
Usually you want to know when a stream is working and when it is not. This can be useful to know that your own system is
194197
currently "blind" and you may want to close open positions to be on the safe side, know that indicators will now provide
195198
incorrect values or that you have to reload the missing data via REST as an alternative.
196199

197200
For this purpose, the UNICORN Binance WebSocket API provides so-called
198-
[STREAM SIGNALS](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
201+
[`stream_signals`](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
199202
, which are used to tell your code in real time when a stream is connected, when it received its first data record, when
200203
it was disconnected and stopped, and when the stream cannot be restored.
201204

dev/sphinx/source/readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ with BinanceWebSocketApiManager(exchange='binance.com') as ubwa:
114114

115115
Basically that's it, but there are more options.
116116

117-
### Convert received raw webstream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
117+
### Convert received stream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
118118

119119
```
120120
unicorn_fied_stream_data = UnicornFy.binance_com_websocket(data)
@@ -126,7 +126,7 @@ or
126126
ubwa.create_stream(['trade'], ['btcusdt'], output="UnicornFy")
127127
```
128128

129-
### [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
129+
## [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
130130

131131
```
132132
markets = ['engbtc', 'zileth']
@@ -178,24 +178,27 @@ guide on
178178
[how to process requests via the Binance WebSocket API](https://medium.lucit.tech/create-and-cancel-orders-via-websocket-on-binance-7f828831404)!
179179

180180
## Stop `ubwa` after usage to avoid memory leaks
181+
181182
When you instantiate UBWA with `with`, `ubwa.stop_manager()` is automatically executed upon exiting the `with`-block.
183+
182184
```
183185
with BinanceWebSocketApiManager() as ubwa:
184186
ubwa.create_stream(channels="trade", markets="btcusdt", stream_label="TRADES")
185187
```
186188

187189
Without `with`, you must explicitly execute `ubwa.stop_manager()` yourself.
190+
188191
```
189192
ubwa.stop_manager()
190193
```
191194

192-
## STREAM SIGNALS - know the state of your streams
195+
## `stream_signals` - know the state of your streams
193196
Usually you want to know when a stream is working and when it is not. This can be useful to know that your own system is
194197
currently "blind" and you may want to close open positions to be on the safe side, know that indicators will now provide
195198
incorrect values or that you have to reload the missing data via REST as an alternative.
196199

197200
For this purpose, the UNICORN Binance WebSocket API provides so-called
198-
[STREAM SIGNALS](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
201+
[`stream_signals`](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
199202
, which are used to tell your code in real time when a stream is connected, when it received its first data record, when
200203
it was disconnected and stopped, and when the stream cannot be restored.
201204

docs/_modules/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ <h3>Navigation</h3>
254254
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
255255
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
256256
See <a href="/license.html">License</a> for more information.<br />
257-
Last updated on May 04 2024 at 11:22 (CET).
257+
Last updated on May 04 2024 at 11:34 (CET).
258258
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
259259
<br />
260260
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/_sources/readme.md.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ with BinanceWebSocketApiManager(exchange='binance.com') as ubwa:
114114

115115
Basically that's it, but there are more options.
116116

117-
### Convert received raw webstream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
117+
### Convert received stream data into well-formed Python dictionaries with [UnicornFy](https://www.lucit.tech/unicorn-fy.html):
118118

119119
```
120120
unicorn_fied_stream_data = UnicornFy.binance_com_websocket(data)
@@ -126,7 +126,7 @@ or
126126
ubwa.create_stream(['trade'], ['btcusdt'], output="UnicornFy")
127127
```
128128

129-
### [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
129+
## [Subscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.subscribe_to_stream) / [unsubscribe](https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.unsubscribe_from_stream) new markets and channels:
130130

131131
```
132132
markets = ['engbtc', 'zileth']
@@ -178,24 +178,27 @@ guide on
178178
[how to process requests via the Binance WebSocket API](https://medium.lucit.tech/create-and-cancel-orders-via-websocket-on-binance-7f828831404)!
179179

180180
## Stop `ubwa` after usage to avoid memory leaks
181+
181182
When you instantiate UBWA with `with`, `ubwa.stop_manager()` is automatically executed upon exiting the `with`-block.
183+
182184
```
183185
with BinanceWebSocketApiManager() as ubwa:
184186
ubwa.create_stream(channels="trade", markets="btcusdt", stream_label="TRADES")
185187
```
186188

187189
Without `with`, you must explicitly execute `ubwa.stop_manager()` yourself.
190+
188191
```
189192
ubwa.stop_manager()
190193
```
191194

192-
## STREAM SIGNALS - know the state of your streams
195+
## `stream_signals` - know the state of your streams
193196
Usually you want to know when a stream is working and when it is not. This can be useful to know that your own system is
194197
currently "blind" and you may want to close open positions to be on the safe side, know that indicators will now provide
195198
incorrect values or that you have to reload the missing data via REST as an alternative.
196199

197200
For this purpose, the UNICORN Binance WebSocket API provides so-called
198-
[STREAM SIGNALS](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
201+
[`stream_signals`](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/%60stream_signals%60)
199202
, which are used to tell your code in real time when a stream is connected, when it received its first data record, when
200203
it was disconnected and stopped, and when the stream cannot be restored.
201204

docs/changelog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,7 +3954,7 @@ <h3>Navigation</h3>
39543954
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
39553955
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
39563956
See <a href="/license.html">License</a> for more information.<br />
3957-
Last updated on May 04 2024 at 11:22 (CET).
3957+
Last updated on May 04 2024 at 11:34 (CET).
39583958
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
39593959
<br />
39603960
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/code_of_conduct.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ <h3>Navigation</h3>
399399
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
400400
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
401401
See <a href="/license.html">License</a> for more information.<br />
402-
Last updated on May 04 2024 at 11:22 (CET).
402+
Last updated on May 04 2024 at 11:34 (CET).
403403
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
404404
<br />
405405
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/contributing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ <h3>Navigation</h3>
338338
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
339339
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
340340
See <a href="/license.html">License</a> for more information.<br />
341-
Last updated on May 04 2024 at 11:22 (CET).
341+
Last updated on May 04 2024 at 11:34 (CET).
342342
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
343343
<br />
344344
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/genindex.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ <h3>Navigation</h3>
779779
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
780780
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
781781
See <a href="/license.html">License</a> for more information.<br />
782-
Last updated on May 04 2024 at 11:22 (CET).
782+
Last updated on May 04 2024 at 11:34 (CET).
783783
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
784784
<br />
785785
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,16 @@ <h1>Welcome to unicorn-binance-websocket-api’s documentation!<a class="headerl
179179
<li class="toctree-l3"><a class="reference internal" href="readme.html#and-4-more-lines-to-print-out-the-data">And 4 more lines to print out the data:</a></li>
180180
<li class="toctree-l3"><a class="reference internal" href="readme.html#or-with-a-callback-function-just-do">Or with a callback function just do:</a></li>
181181
<li class="toctree-l3"><a class="reference internal" href="readme.html#or-await-the-webstream-data-in-an-asyncio-coroutine">Or await the webstream data in an asyncio coroutine:</a></li>
182-
<li class="toctree-l3"><a class="reference internal" href="readme.html#convert-received-raw-webstream-data-into-well-formed-python-dictionaries-with-unicornfy">Convert received raw webstream data into well-formed Python dictionaries with UnicornFy:</a></li>
183-
<li class="toctree-l3"><a class="reference internal" href="readme.html#subscribe-unsubscribe-new-markets-and-channels">Subscribe / unsubscribe new markets and channels:</a></li>
182+
<li class="toctree-l3"><a class="reference internal" href="readme.html#convert-received-stream-data-into-well-formed-python-dictionaries-with-unicornfy">Convert received stream data into well-formed Python dictionaries with UnicornFy:</a></li>
184183
</ul>
185184
</li>
185+
<li class="toctree-l2"><a class="reference internal" href="readme.html#subscribe-unsubscribe-new-markets-and-channels">Subscribe / unsubscribe new markets and channels:</a></li>
186186
<li class="toctree-l2"><a class="reference internal" href="readme.html#send-requests-to-binance-websocket-api">Send Requests to Binance WebSocket API</a><ul>
187187
<li class="toctree-l3"><a class="reference internal" href="readme.html#place-orders-cancel-orders-or-send-other-requests-via-websocket">Place orders, cancel orders or send other requests via WebSocket:</a></li>
188188
</ul>
189189
</li>
190190
<li class="toctree-l2"><a class="reference internal" href="readme.html#stop-ubwa-after-usage-to-avoid-memory-leaks">Stop <code class="docutils literal notranslate"><span class="pre">ubwa</span></code> after usage to avoid memory leaks</a></li>
191-
<li class="toctree-l2"><a class="reference internal" href="readme.html#stream-signals-know-the-state-of-your-streams">STREAM SIGNALS - know the state of your streams</a></li>
191+
<li class="toctree-l2"><a class="reference internal" href="readme.html#stream-signals-know-the-state-of-your-streams"><code class="docutils literal notranslate"><span class="pre">stream_signals</span></code> - know the state of your streams</a></li>
192192
<li class="toctree-l2"><a class="reference internal" href="readme.html#description">Description</a><ul>
193193
<li class="toctree-l3"><a class="reference internal" href="readme.html#what-are-the-benefits-of-the-unicorn-binance-websocket-api">What are the benefits of the UNICORN Binance WebSocket API?</a></li>
194194
</ul>
@@ -1063,7 +1063,7 @@ <h3>Navigation</h3>
10631063
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
10641064
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
10651065
See <a href="/license.html">License</a> for more information.<br />
1066-
Last updated on May 04 2024 at 11:22 (CET).
1066+
Last updated on May 04 2024 at 11:34 (CET).
10671067
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
10681068
<br />
10691069
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/license.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ <h3>Navigation</h3>
389389
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
390390
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
391391
See <a href="/license.html">License</a> for more information.<br />
392-
Last updated on May 04 2024 at 11:22 (CET).
392+
Last updated on May 04 2024 at 11:34 (CET).
393393
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
394394
<br />
395395
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

docs/py-modindex.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ <h3>Navigation</h3>
302302
<a href="https://docs.lucit.tech">Index of all LUCIT Software Documentation</a><br />
303303
&copy; <a href="/license.html">Copyright</a> 2023-2023, LUCIT Systems and Development. All Rights Reserved..
304304
See <a href="/license.html">License</a> for more information.<br />
305-
Last updated on May 04 2024 at 11:22 (CET).
305+
Last updated on May 04 2024 at 11:34 (CET).
306306
<a href="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose">Found a bug</a>?
307307
<br />
308308
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.

0 commit comments

Comments
 (0)