bitunix-automated-crypto-trading 3.2.2__py3-none-any.whl → 3.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bitunix_automated_crypto_trading/BitunixSignal.py +3 -3
- bitunix_automated_crypto_trading/BitunixWebSocket.py +10 -9
- bitunix_automated_crypto_trading/bitunix.py +1 -1
- bitunix_automated_crypto_trading/version.py +1 -1
- {bitunix_automated_crypto_trading-3.2.2.dist-info → bitunix_automated_crypto_trading-3.2.5.dist-info}/METADATA +1 -1
- {bitunix_automated_crypto_trading-3.2.2.dist-info → bitunix_automated_crypto_trading-3.2.5.dist-info}/RECORD +9 -9
- {bitunix_automated_crypto_trading-3.2.2.dist-info → bitunix_automated_crypto_trading-3.2.5.dist-info}/WHEEL +0 -0
- {bitunix_automated_crypto_trading-3.2.2.dist-info → bitunix_automated_crypto_trading-3.2.5.dist-info}/entry_points.txt +0 -0
- {bitunix_automated_crypto_trading-3.2.2.dist-info → bitunix_automated_crypto_trading-3.2.5.dist-info}/top_level.txt +0 -0
@@ -75,7 +75,7 @@ class BitunixSignal:
|
|
75
75
|
self.signaldf_filtered = pd.DataFrame()
|
76
76
|
|
77
77
|
#websockets
|
78
|
-
self.bitunixPrivateWebSocketClient = BitunixPrivateWebSocketClient(self.api_key, self.secret_key)
|
78
|
+
self.bitunixPrivateWebSocketClient = BitunixPrivateWebSocketClient(self.api_key, self.secret_key, logger)
|
79
79
|
|
80
80
|
if self.settings.USE_PUBLIC_WEBSOCKET:
|
81
81
|
self.bitunixPublicDepthWebSocketClient = BitunixPublicWebSocketClient(self.api_key, self.secret_key, "depth", logger)
|
@@ -462,7 +462,7 @@ class BitunixSignal:
|
|
462
462
|
self.positiondf['ask'] = self.positiondf['ask'].astype('float64')
|
463
463
|
else:
|
464
464
|
self.positiondf = pd.DataFrame()
|
465
|
-
|
465
|
+
self.positiondfStyle= self.positiondfrenderer.render_html(self.positiondf)
|
466
466
|
|
467
467
|
#if not self.settings.USE_PUBLIC_WEBSOCKET:
|
468
468
|
#get bid las ask using api for the symbols in pending psotion
|
@@ -1041,7 +1041,7 @@ class BitunixSignal:
|
|
1041
1041
|
|
1042
1042
|
# candle reversed
|
1043
1043
|
if self.settings.CANDLE_TREND_STUDY and self.settings.CANDLE_TREND_REVERSAL_CHECK_ON_CLOSE:
|
1044
|
-
if row.side == 'BUY' and self.signaldf_full.at[row.symbol, f'{period}_barcolor'] == self.red and self.signaldf_full.at[row.symbol, f'{period}_cb'] > 1 and self.signaldf_full.at[row.symbol, f'{period}_candle_trend'] == "
|
1044
|
+
if row.side == 'BUY' and self.signaldf_full.at[row.symbol, f'{period}_barcolor'] == self.red and self.signaldf_full.at[row.symbol, f'{period}_cb'] > 1 and self.signaldf_full.at[row.symbol, f'{period}_candle_trend'] == "BEARISH" and total_pnl < 0:
|
1045
1045
|
last, bid, ask, mtv = await self.GetTickerBidLastAsk(row.symbol)
|
1046
1046
|
price = (ask if row['side'] == "BUY" else bid if row['side'] == "SELL" else last) if bid<=last<=ask else last
|
1047
1047
|
|
@@ -56,10 +56,10 @@ class BitunixPublicWebSocketClient:
|
|
56
56
|
self.recv_task = asyncio.create_task(self.receive_messages(process_func))
|
57
57
|
await self.recv_task
|
58
58
|
except websockets.exceptions.ConnectionClosedError as e:
|
59
|
-
logger.warning(f"{self.url} {self.type} WebSocket connection closed. Retrying in 5 seconds: {e}")
|
59
|
+
self.logger.warning(f"{self.url} {self.type} WebSocket connection closed. Retrying in 5 seconds: {e}")
|
60
60
|
await asyncio.sleep(5) # Delay before retrying
|
61
61
|
except Exception as e:
|
62
|
-
logger.error(f"{self.url} {self.type} Unexpected error during WebSocket operation: {e}")
|
62
|
+
self.logger.error(f"{self.url} {self.type} Unexpected error during WebSocket operation: {e}")
|
63
63
|
await asyncio.sleep(5) # Delay before retrying
|
64
64
|
|
65
65
|
def create_subscription_message(self, ticker):
|
@@ -79,7 +79,7 @@ class BitunixPublicWebSocketClient:
|
|
79
79
|
while self.running:
|
80
80
|
message = await self.websocket.recv()
|
81
81
|
await process_func(message)
|
82
|
-
logger.warning(f"{self.url} {self.type} WebSocket connection closed")
|
82
|
+
self.logger.warning(f"{self.url} {self.type} WebSocket connection closed")
|
83
83
|
except asyncio.CancelledError:
|
84
84
|
self.logger.info(f"{self.url} {self.type} WebSocket receive task cancelled")
|
85
85
|
self.running = False
|
@@ -120,14 +120,14 @@ class BitunixPublicWebSocketClient:
|
|
120
120
|
self.loop.call_soon_threadsafe(self.websocket.close) #
|
121
121
|
|
122
122
|
except Exception as e:
|
123
|
-
logger.error(f"{self.url} {self.type} Unexpected error during WebSocket shutdown: {e}")
|
123
|
+
self.logger.error(f"{self.url} {self.type} Unexpected error during WebSocket shutdown: {e}")
|
124
124
|
finally:
|
125
125
|
# Stop the event loop
|
126
126
|
self.loop.call_soon_threadsafe(self.loop.stop)
|
127
127
|
self.logger.info(f"{self.url} {self.type} WebSocket thread stopped and resources cleaned up.")
|
128
128
|
|
129
129
|
class BitunixPrivateWebSocketClient:
|
130
|
-
def __init__(self, api_key, secret_key):
|
130
|
+
def __init__(self, api_key, secret_key, logger):
|
131
131
|
self.api_key = api_key
|
132
132
|
self.secret_key = secret_key
|
133
133
|
self.url = "wss://fapi.bitunix.com/private/"
|
@@ -136,6 +136,7 @@ class BitunixPrivateWebSocketClient:
|
|
136
136
|
self.loop = asyncio.new_event_loop()
|
137
137
|
self.loop_thread = threading.Thread(target=self.start_loop)
|
138
138
|
self.loop_thread.daemon = True # Ensure the thread closes with the program
|
139
|
+
self.logger=logger
|
139
140
|
self.loop_thread.start()
|
140
141
|
|
141
142
|
|
@@ -182,10 +183,10 @@ class BitunixPrivateWebSocketClient:
|
|
182
183
|
await self.recv_task
|
183
184
|
|
184
185
|
except websockets.exceptions.ConnectionClosedError as e:
|
185
|
-
logger.warning(f"{self.type} WebSocket connection closed. Retrying in 5 seconds: {e}")
|
186
|
+
self.logger.warning(f"{self.type} WebSocket connection closed. Retrying in 5 seconds: {e}")
|
186
187
|
await asyncio.sleep(5) # Delay before retrying
|
187
188
|
except Exception as e:
|
188
|
-
logger.error(f"Unexpected error during {self.type} WebSocket operation: {e}")
|
189
|
+
self.logger.error(f"Unexpected error during {self.type} WebSocket operation: {e}")
|
189
190
|
await asyncio.sleep(5) # Delay before retrying
|
190
191
|
|
191
192
|
async def receive_messages(self, process_func: Callable):
|
@@ -193,7 +194,7 @@ class BitunixPrivateWebSocketClient:
|
|
193
194
|
while self.running:
|
194
195
|
message = await self.websocket.recv()
|
195
196
|
await process_func(message)
|
196
|
-
logger.warning(f"{self.type} WebSocket connection closed")
|
197
|
+
self.logger.warning(f"{self.type} WebSocket connection closed")
|
197
198
|
except asyncio.CancelledError:
|
198
199
|
self.logger.info(f"{self.url} WebSocket receive task cancelled")
|
199
200
|
self.running = False
|
@@ -234,7 +235,7 @@ class BitunixPrivateWebSocketClient:
|
|
234
235
|
self.loop.call_soon_threadsafe(self.websocket.close) #
|
235
236
|
|
236
237
|
except Exception as e:
|
237
|
-
logger.error(f"Unexpected error during {self.url} WebSocket shutdown: {e}")
|
238
|
+
self.logger.error(f"Unexpected error during {self.url} WebSocket shutdown: {e}")
|
238
239
|
finally:
|
239
240
|
# Stop the event loop
|
240
241
|
self.loop.call_soon_threadsafe(self.loop.stop)
|
@@ -65,7 +65,7 @@ HOST = os.getenv('HOST')
|
|
65
65
|
logger = Logger(__name__, LOG_FILE).get_logger()
|
66
66
|
|
67
67
|
def get_version():
|
68
|
-
version_file = os.path.abspath("
|
68
|
+
version_file = os.path.abspath("version.py")
|
69
69
|
with open(version_file) as f:
|
70
70
|
return re.search(r'__version__ = "(.*?)"', f.read()).group(1)
|
71
71
|
|
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.2.
|
1
|
+
__version__ = "3.2.5"
|
@@ -1,19 +1,19 @@
|
|
1
1
|
bitunix_automated_crypto_trading/AsyncThreadRunner.py,sha256=bNIM_1xRYQOFEsIn74EX6qVpC59-GMhhr2CeiPr_GWg,3253
|
2
2
|
bitunix_automated_crypto_trading/BitunixApi.py,sha256=udgBwbWowf7v46jVVyfs-VjeNh9ajnghTiJf70lvn5w,11269
|
3
|
-
bitunix_automated_crypto_trading/BitunixSignal.py,sha256=
|
4
|
-
bitunix_automated_crypto_trading/BitunixWebSocket.py,sha256
|
3
|
+
bitunix_automated_crypto_trading/BitunixSignal.py,sha256=h55dbrRDyKA0N8XX8WRpZC9w3a7Rv8uA6lC_3oxojJ4,74460
|
4
|
+
bitunix_automated_crypto_trading/BitunixWebSocket.py,sha256=uiqAcis3u-ct07tjaTiC87ujzvcAtVRZ31CMiTBDW_M,11309
|
5
5
|
bitunix_automated_crypto_trading/DataFrameHtmlRenderer.py,sha256=Pqdzhh_nfIxFEZH9L_R5QXB8moDPbgeTGT_hmBkHWMg,2899
|
6
6
|
bitunix_automated_crypto_trading/NotificationManager.py,sha256=exs6REABBA1omTeTGuUuECzxs5dGqdyL7oI8WyxS6Xc,798
|
7
7
|
bitunix_automated_crypto_trading/SupportResistance.py,sha256=x_to4M4OHg0h8o40DXDBa4E_5io-y2Lb5qo2VzFnu_8,5765
|
8
8
|
bitunix_automated_crypto_trading/ThreadManager.py,sha256=Lw5_1EIT0m3AFSv5CIMpnjtA0DnNw2qQ6JtSpT34LyM,2349
|
9
9
|
bitunix_automated_crypto_trading/TickerManager.py,sha256=xzFzH1qDxCGi2bNji1fO8t7WM971RtN-HsUTWxTn7Ic,42717
|
10
10
|
bitunix_automated_crypto_trading/__init__.py,sha256=1hzk6nX8NnUCr1tsq8oFq1qGCNhNwnwldWE75641Eew,78
|
11
|
-
bitunix_automated_crypto_trading/bitunix.py,sha256=
|
11
|
+
bitunix_automated_crypto_trading/bitunix.py,sha256=dNCrQfUNj8jn0jxnP47p9G7QGGuta4nC6GanXPeV9yw,27132
|
12
12
|
bitunix_automated_crypto_trading/config.py,sha256=H9iMKzibh295kQrf4RG66hv7_zF_x8Dvp7uCnFU7Voo,5478
|
13
13
|
bitunix_automated_crypto_trading/logger.py,sha256=NHnA5JZdUFkTAhB7i-1iCAwrdf1fxhDuRvJUkbKPi9Y,2923
|
14
|
-
bitunix_automated_crypto_trading/version.py,sha256=
|
15
|
-
bitunix_automated_crypto_trading-3.2.
|
16
|
-
bitunix_automated_crypto_trading-3.2.
|
17
|
-
bitunix_automated_crypto_trading-3.2.
|
18
|
-
bitunix_automated_crypto_trading-3.2.
|
19
|
-
bitunix_automated_crypto_trading-3.2.
|
14
|
+
bitunix_automated_crypto_trading/version.py,sha256=ufPRYI3RSwxsCvCYdJ7jV_Dl1zssfPz7Ye9vyr2dUt0,21
|
15
|
+
bitunix_automated_crypto_trading-3.2.5.dist-info/METADATA,sha256=Xg7_0EYIGDSL6u6LgqN8w66W7Tp1oozohgDT4p0SjWc,996
|
16
|
+
bitunix_automated_crypto_trading-3.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
17
|
+
bitunix_automated_crypto_trading-3.2.5.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
|
18
|
+
bitunix_automated_crypto_trading-3.2.5.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
|
19
|
+
bitunix_automated_crypto_trading-3.2.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|