bitunix-automated-crypto-trading 3.0.9__py3-none-any.whl → 3.1.1__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.
@@ -28,7 +28,8 @@ class AsyncThreadRunner:
28
28
  )
29
29
  self.loop.run_forever()
30
30
  except Exception as e:
31
- logger.info(f"Async Thread function error: {e}")
31
+ logger.info(f"Async Thread function error: {e}, exiting app")
32
+ os._exit(1) # Exit the program if the thread is stopped
32
33
  finally:
33
34
  pending = asyncio.all_tasks(self.loop)
34
35
  for task in pending:
@@ -165,12 +165,13 @@ class BitunixSignal:
165
165
  self.AutoTradeProcessTask = AsyncThreadRunner(self.AutoTradeProcess, interval=int(self.settings.SIGNAL_CHECK_INTERVAL))
166
166
  self.AutoTradeProcessTask.start_thread(thread_name="AutoTradeProcess")
167
167
 
168
+ self.checkTickerAndAutotradeStatusTask = AsyncThreadRunner(self.checkTickerAndAutotradeStatus, interval=0)
169
+ self.checkTickerAndAutotradeStatusTask.start_thread(thread_name="checkTickerAndAutotradeStatus")
170
+
168
171
  if not self.settings.USE_PUBLIC_WEBSOCKET:
169
172
  self.GetTickerDataTask = AsyncThreadRunner(self.GetTickerData, interval=int(self.settings.TICKER_DATA_API_INTERVAL))
170
173
  self.GetTickerDataTask.start_thread(thread_name="GetTickerData")
171
174
 
172
- self.checkPeriodicProcessTask = AsyncThreadRunner(self.checkPeriodicProcess, interval=0)
173
- self.checkPeriodicProcessTask.start_thread(thread_name="checkPeriodicProcess")
174
175
 
175
176
 
176
177
  ###########################################################################################################
@@ -299,6 +300,9 @@ class BitunixSignal:
299
300
  logger.info(f"Function: ProcessTickerData, {e}, {e.args}, {type(e).__name__}")
300
301
  logger.info(traceback.print_exc())
301
302
  await asyncio.sleep(0.5)
303
+ logger.info(f"ProcessTickerData: exitied out of the loop, exiting app")
304
+ os._exit(1) # Exit the program
305
+
302
306
 
303
307
  #websocket data to update bid and ask
304
308
  async def StoreDepthData(self, message):
@@ -331,6 +335,8 @@ class BitunixSignal:
331
335
  logger.info(f"Function: ProcessTickerData, {e}, {e.args}, {type(e).__name__}")
332
336
  logger.info(traceback.print_exc())
333
337
  await asyncio.sleep(0.5)
338
+ logger.info(f"ProcessDepthData: exitied out of the loop, exiting app")
339
+ os._exit(1) # Exit the program
334
340
 
335
341
  def apply_depth_data2(self, row):
336
342
  row["tickerObj"].set_ask(row["ask"])
@@ -385,7 +391,7 @@ class BitunixSignal:
385
391
  gc.collect()
386
392
 
387
393
  ###########################################################################################################
388
- async def checkPeriodicProcess(self):
394
+ async def checkTickerAndAutotradeStatus(self):
389
395
  while True:
390
396
  if self.lastAutoTradeTime + 300 < time.time() or self.lastTickerDataTime + 300 < time.time():
391
397
  self.notifications.add_notification("AutoTradeProcess or GetTickerData is not running")
@@ -525,16 +525,26 @@ async def wschart(websocket):
525
525
 
526
526
  queue = asyncio.Queue()
527
527
  queueTask = asyncio.create_task(send_data_queue(websocket, queue))
528
-
528
+ period=settings.OPTION_MOVING_AVERAGE
529
529
  while True:
530
530
  stime=time.time()
531
531
  try:
532
532
 
533
+ # Receive period changed data from the WebSocket
534
+ try:
535
+ message = await asyncio.wait_for(websocket.receive_text(), timeout=0.01)
536
+ if message!="ping" and message!="":
537
+ # Decode the new period from the incoming message
538
+ data = json.loads(message)
539
+ if "period" in data:
540
+ period = data["period"]
541
+ except asyncio.TimeoutError:
542
+ pass
543
+
533
544
  # Handle incoming ping messages
534
545
  await asyncio.create_task(send_pong(websocket,queue))
535
546
 
536
547
  if ticker in bitunix.bitunixSignal.tickerObjects.symbols():
537
- period=settings.OPTION_MOVING_AVERAGE
538
548
  bars=settings.BARS
539
549
  chart=list(bitunix.bitunixSignal.tickerObjects.get(ticker).get_interval_ticks(period).get_data()[-bars:])
540
550
  buysell=list(bitunix.bitunixSignal.tickerObjects.get(ticker).trades)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitunix_automated_crypto_trading
3
- Version: 3.0.9
3
+ Version: 3.1.1
4
4
  Summary: Bitunix Futures Auto Trading Platform
5
5
  Home-page: https://github.com/tcj2001/bitunix-automated-crypto-trading
6
6
  Author: tcj2001
@@ -1,17 +1,17 @@
1
- bitunix_automated_crypto_trading/AsyncThreadRunner.py,sha256=JDpAUiTZLB9KV4tGPonAvAUJyBqZz2-ehblH6vsunz8,3142
1
+ bitunix_automated_crypto_trading/AsyncThreadRunner.py,sha256=LJ6ny1KSCVoIbfeNypsY4aHYcbkGME9M3epQ9e8B1O8,3224
2
2
  bitunix_automated_crypto_trading/BitunixApi.py,sha256=wJhknpmVFrckoL89h-nlWUAMsPxhIacY0nOGJT9M6Vw,11360
3
- bitunix_automated_crypto_trading/BitunixSignal.py,sha256=sArNBVXFZu4unBeTBhv3S1yNuZd-8PZtu10yGBGVkW8,64377
3
+ bitunix_automated_crypto_trading/BitunixSignal.py,sha256=LKxWy_-alKkawB_l9_AdzwtCt0rx6lTqfBDuiGBMoe4,64669
4
4
  bitunix_automated_crypto_trading/BitunixWebSocket.py,sha256=mbuvk8UFWKgv4KLV07TgLgxLVTRJnOKuf02mLB-VoCY,11143
5
5
  bitunix_automated_crypto_trading/DataFrameHtmlRenderer.py,sha256=Pqdzhh_nfIxFEZH9L_R5QXB8moDPbgeTGT_hmBkHWMg,2899
6
6
  bitunix_automated_crypto_trading/NotificationManager.py,sha256=pqDquEe-oujD2v8B543524vo62aRMjfB4YW-3DMhVGQ,795
7
7
  bitunix_automated_crypto_trading/ThreadManager.py,sha256=WmYRQu8aNrgp5HwSqpBqX1WESNSEpbD2CznPFpd9HuI,2330
8
8
  bitunix_automated_crypto_trading/TickerManager.py,sha256=eeOK5paiae10XHjKMbucJnVAZkAsEC86N37bRPuCcFc,33427
9
9
  bitunix_automated_crypto_trading/__init__.py,sha256=1hzk6nX8NnUCr1tsq8oFq1qGCNhNwnwldWE75641Eew,78
10
- bitunix_automated_crypto_trading/bitunix.py,sha256=XLYaSSX0g2MMQ6TgR762qL1ppthKm2Ki6vMR77xSpdM,32248
10
+ bitunix_automated_crypto_trading/bitunix.py,sha256=c5vKRuN1-UaNz_ZB5Txu4-2UM6PsnRhs-ztvhRtpEzc,32779
11
11
  bitunix_automated_crypto_trading/config.py,sha256=QWAe5Ruq8A5anaFS-CamVm-3t1wMJjGG1DWaPIIWfiM,4521
12
12
  bitunix_automated_crypto_trading/logger.py,sha256=tAaTQcv5r--zupk_Fhfe1USfBAzSiXzVa4QRnaOFIFY,2933
13
- bitunix_automated_crypto_trading-3.0.9.dist-info/METADATA,sha256=h3fxV9vRsIa5kna4waL0fpixwZ_PnpqTgOSTcyjB2U4,996
14
- bitunix_automated_crypto_trading-3.0.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
- bitunix_automated_crypto_trading-3.0.9.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
16
- bitunix_automated_crypto_trading-3.0.9.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
17
- bitunix_automated_crypto_trading-3.0.9.dist-info/RECORD,,
13
+ bitunix_automated_crypto_trading-3.1.1.dist-info/METADATA,sha256=5cwQuEB4OsaVHSAxpiYo0gIDSK3Rs39TgID_E7dCihU,996
14
+ bitunix_automated_crypto_trading-3.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
+ bitunix_automated_crypto_trading-3.1.1.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
16
+ bitunix_automated_crypto_trading-3.1.1.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
17
+ bitunix_automated_crypto_trading-3.1.1.dist-info/RECORD,,