Commit Graph

71 Commits

Author SHA1 Message Date
Davide Casale
f0f150cec2 Split websocket package in multiple sub-package. Split handlers.py in public_channels_handler.py and authenticated_channels_handler.py. Rename files attaining to new conventions. 2023-02-13 19:09:38 +01:00
Davide Casale
7dc043bbe5 Small fix in BfxWebsocketClient class. 2023-02-09 04:35:43 +01:00
Davide Casale
c588d9f20c Rewrite bfxapi/rest/_Requests.py with type hinting. Add None values erasement in bfxapi/utils/JSONEncoder.py. Update code with new improvements. 2023-02-06 19:15:58 +01:00
Davide Casale
929ae62d2f Fix bug in bfxapi.tests sub-package. 2023-02-06 16:16:11 +01:00
Davide Casale
06dc9e1c0a Remove cid.py and integers.py from bfxapi.utils subpackage. Rename encoder.py file to JSONEncoder.py. Remove IntegerUnderflowError and IntegerOverflowflowError exceptions from bfxapi/exceptions.py. 2023-02-01 17:18:05 +01:00
Davide Casale
05784cc8ec Add tests subpackage. Add TestRestSerializersAndTypes and TestWebsocketSerializersAndTypes unit tests. Fix consistency bugs between serializers and types. 2023-02-01 17:05:25 +01:00
Davide Casale
40a48184da Fix bugs and differences in namings/types/fields between bfxapi.rest.types, bfxapi.rest.serializers and bfxapi.websocket.types, bfxapi.websocket.serializers. 2023-01-31 18:54:15 +01:00
Davide Casale
7b313ddcab Merge TradeExecutionUpdate and TradeExecuted serializers and types in websocket subpackage. 2023-01-31 17:27:14 +01:00
Davide Casale
d767e5dcfe Replace every snake case (uppercase) to snake case (lowercase) in serializers, types and notification. 2023-01-26 19:00:13 +01:00
Davide Casale
ed12bf473f Rewrite and extend custom JSONEncoder in bfxapi/utils/encoder.py to automatically convert floats to strs. Change every Union[Decimal, str] type to Union[Decimal, float, str]. Fix type hinting bug in labeler.py. 2023-01-25 18:18:15 +01:00
Davide Casale
28c00d460b Exclude subId field from every subscription dictionary. 2023-01-24 19:02:44 +01:00
Davide Casale
36725a183e Move _BfxWebsocketBucket class in its own file bfxapi/websocket/_BfxWebsocketBucket.py. 2023-01-19 18:12:12 +01:00
Davide Casale
5fe4d83902 Move subscriptions type hinting from bfxapi/websocket/types.py to bfxapi/websocket/subscriptions.py. 2023-01-19 18:00:51 +01:00
Davide Casale
2afcc76647 Fix bug regarding new typing with dataclasses. 2023-01-16 18:18:12 +01:00
Davide Casale
e185da4cc9 Rename bfxapi/websocket/typings.py to types.py. Replace TypedDicts with dataclasses (with _Type as base class). Update demos in examples/websocket to use new implementation. 2023-01-16 17:07:16 +01:00
Davide Casale
e64c25bf19 Implement bfxapi/notifications.py in websocket subpackage. 2023-01-12 18:36:23 +01:00
Davide Casale
ff58f049a7 Separate _BfxWebsocketInputs from bfxapi/websocket/BfxWebsocketClient.py to _BfxWebsocketInputs.py. Rename websocket authenticated inputs methods. Refactoring to maintain consistency across the library. 2023-01-12 18:10:00 +01:00
Davide Casale
454a7542ed Add bfxapi/enums.py file. Split enumerations in bfxapi/rest/enums.py and bfxapi/websocket/enums.py. Rename enumeration classes to use singular name identifiers. 2022-12-22 18:42:55 +01:00
Davide Casale
6217f9040c Rename bfxapi/utils/decimal.py to encoder.py. Add support for datetime JSON serialization. Update class reference in BfxWebsocketClient.py. 2022-12-20 18:40:41 +01:00
Davide Casale
87bb6dc5c7 Add generic error handling (UnknownGenericError in bfxapi/rest/exceptions.py). Add support for new endpoints in _RestAuthenticatedEndpoints class. Extend serializers.py and typings.py. 2022-12-20 17:48:38 +01:00
Davide Casale
0a53ab7f7e Apply lots of refactoring to the websocket subpackage (fix every mypy error and warning). Add integers.py and decimal.py to bfxapi.utils package. Update requirements.txt and setup.py with new mypy dependencies. 2022-12-16 18:30:41 +01:00
Davide Casale
4cfeab8a79 Add barebone files for rest section. 2022-11-30 18:25:15 +01:00
Davide Casale
48f1745f10 Add MAXIMUM_BUCKETS_AMOUNT constant to BfxWebsocketClient class. 2022-11-30 17:55:10 +01:00
Davide Casale
509223ae9b Add order_multiple_operations input in _BfxWebsocketInputs. 2022-11-30 17:34:13 +01:00
Davide Casale
e71d4b6e26 Add new websocket authenticated inputs in _BfxWebsocketInputs class. Add new type hinting inside bfxapi/websocket/typings.py. 2022-11-30 17:24:51 +01:00
Davide Casale
d9ecbaa9f0 Change exception formatting inside error .add_listener in BfxWebsocketClient. 2022-11-29 18:05:20 +01:00
Davide Casale
bfd05cf7c7 Add traceback import and implementation. 2022-11-29 17:53:39 +01:00
Davide Casale
e262c81f97 Change default log_level value (from 'INFO' to 'ERROR'). Implement error event into AsyncIOEventEmitter. Add error logging. 2022-11-29 17:17:17 +01:00
Davide Casale
b308bbacbd Add Flags enumeration to enums.py. Rename new_order and new_position to order_new and position_new to mantain consistency. Add _BfxWebsocketInputs class with order_new, order_update and order_cancel inputs. 2022-11-29 15:26:02 +01:00
Davide Casale
fa073823ce Add .run method in BfxWebsocketClient class. 2022-11-28 17:08:27 +01:00
Davide Casale
4bb62a942f Allow users to use .on and .once as non-decorators methods. 2022-11-28 16:58:09 +01:00
Davide Casale
9e8bea905a Rename .chanIds field in _BfxWebsocketBucket to .subscriptions. 2022-11-28 16:50:07 +01:00
Davide Casale
a5083c36cf Add type hinting using typings.py in bfxapi/websocket/serializers.py. 2022-11-24 17:48:41 +01:00
Davide Casale
3a09ba2e90 Add filter parameter to BfxWebsocketClient's __init__.py. Rewrite .notify coroutine adding new feature. Add Notifications channel handlers in handlers.py. Add Notification serializer in serializers.py. 2022-11-24 17:31:47 +01:00
Davide Casale
6f1befbcf0 Rewrite and apply some refactoring to AuthenticatedChannelsHandler in handlers.py. 2022-11-24 16:24:31 +01:00
Davide Casale
c8d8586841 Add bfxapi/websocket/enums.py file. Rewrite bfxapi.websocket's __init__.py. Rename HEARTBEAT constant to _HEARTBEAT to make it internal. 2022-11-23 16:56:13 +01:00
Davide Casale
4933ae6d9a Add new_order (coroutine) websocket authenticated input. Fix bug in BfxWebsocketClient.__require_websocket_authentication decorator. 2022-11-23 16:45:33 +01:00
Davide Casale
45a9565cf4 Fix bug regarding closing websocket connection with .close coroutine method. 2022-11-23 16:28:05 +01:00
Davide Casale
acbed0bc57 Fix small bug from merge conflicts resolving. 2022-11-22 18:58:36 +01:00
Davide Casale
29abf2d7ea Merge branch 'master' into add-logging-system 2022-11-22 18:49:55 +01:00
itsdeka
958134b0f4 Add bfxapi/utils subpackage. Add bfxapi/utils/logger.py. Implement logger with log_level in BfxWebsocketClient.py. 2022-11-22 17:40:26 +00:00
Davide Casale
a8dec5c6bc Rename bfxapi/websocket/errors.py to exceptions.py. Add Errors enumeration inside BfxWebsocketClient.py and bfxapi/websocket/__init__.py. 2022-11-22 18:11:05 +01:00
Davide Casale
999766a307 Add .close coroutine to BfxWebsocketClient and _BfxWebsocketBucket classes. 2022-11-22 18:02:19 +01:00
Davide Casale
721e82b86d Add pendings in _BfxWebsocketBucket. Add new logic for selecting the bucket with less connections. Add ._unsubscribe coroutine. 2022-11-22 17:21:21 +01:00
Davide Casale
2f561a4fba Fix small bug in bfxapi/websocket/errors.py (__all__). 2022-11-21 18:41:40 +01:00
Davide Casale
92f6e691f5 Add BfxWebsocketBucket class in bfxapi/websocket/BfxWebsocketClient.py. Implement running multiple websocket client concurrently using asyncio to allow more than 25 connections to public channels. Rewrite BfxWebsocketClient to handle only websocket authenticated channels. 2022-11-21 18:41:05 +01:00
Davide Casale
8e56e9971e Rename error event to wss-error. 2022-11-21 16:28:55 +01:00
Davide Casale
ba992d34b3 Change tp_ and fc_ prefixes to t_ and f_. 2022-11-21 16:24:10 +01:00
Davide Casale
7314578dd7 Separate _require_websocket_connection decorator from BfxWebsocketClient class. Add _require_websocket_authentication decorator. Implement .notify method in bfxapi/websocket/BfxWebsocketClient.py. 2022-11-17 18:54:43 +01:00
Davide Casale
971e4759fa Add and implement serializers for websocket authenticated channels in bfxapi/websocket/handlers.py. 2022-11-17 17:44:18 +01:00