bitunix-automated-crypto-trading 3.3.6__py3-none-any.whl → 3.3.8__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 +24 -12
- bitunix_automated_crypto_trading/TickerManager.py +2 -2
- bitunix_automated_crypto_trading/config.py +1 -0
- bitunix_automated_crypto_trading/version.py +1 -1
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.8.dist-info}/METADATA +1 -1
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.8.dist-info}/RECORD +9 -9
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.8.dist-info}/WHEEL +0 -0
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.8.dist-info}/entry_points.txt +0 -0
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.8.dist-info}/top_level.txt +0 -0
@@ -399,7 +399,7 @@ class BitunixSignal:
|
|
399
399
|
###########################################################################################################
|
400
400
|
async def checkTickerAndAutotradeStatus(self):
|
401
401
|
while True:
|
402
|
-
if self.lastAutoTradeTime + 300 < time.time()
|
402
|
+
if self.lastAutoTradeTime + 300 < time.time(): # or self.lastTickerDataTime + 300 < time.time():
|
403
403
|
self.notifications.add_notification("AutoTradeProcess or GetTickerData is not running")
|
404
404
|
os._exit(1)
|
405
405
|
break
|
@@ -650,14 +650,14 @@ class BitunixSignal:
|
|
650
650
|
trade_time = datetime.strptime(datetime_str, "%Y-%m-%d %H:%M:%S")
|
651
651
|
# Convert datetime object to Unix timestamp)
|
652
652
|
trade_time_unix = int(trade_time.timestamp())
|
653
|
-
print(f"trade_time_unix: {trade_time_unix}, trade_time: {trade_time}")
|
653
|
+
#print(f"trade_time_unix: {trade_time_unix}, trade_time: {trade_time}")
|
654
654
|
# Get current Unix timestamp
|
655
655
|
current_time_unix = int(time.time())
|
656
|
-
print(f"current_time_unix: {current_time_unix}, time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
656
|
+
#print(f"current_time_unix: {current_time_unix}, time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
657
657
|
# Calculate duration in minutes
|
658
658
|
duration_minutes = (current_time_unix - trade_time_unix) / 60
|
659
|
-
print(f"diff: {current_time_unix - trade_time_unix}")
|
660
|
-
print(f"duration_minutes: {duration_minutes}")
|
659
|
+
#print(f"diff: {current_time_unix - trade_time_unix}")
|
660
|
+
#print(f"duration_minutes: {duration_minutes}")
|
661
661
|
|
662
662
|
return round(duration_minutes)
|
663
663
|
|
@@ -729,6 +729,7 @@ class BitunixSignal:
|
|
729
729
|
self.logger.info(f"row.symbol: {row.symbol} , duration_minutes: {duration_minutes}, last trade time: {mtime if duration_minutes is not None else 'N/A'}")
|
730
730
|
if duration_minutes is None or duration_minutes > self.settings.DELAY_IN_MINUTES_FOR_SAME_TICKER_TRADES:
|
731
731
|
side = "BUY" if row[f'{period}_barcolor'] == self.green and row[f'{period}_trend'] == "BUY" else "SELL" if row[f'{period}_barcolor'] == self.red and row[f'{period}_trend'] == "SELL" else ""
|
732
|
+
#self.logger.info(f"row.symbol: {row.symbol} , ok to {side}, {row[f'{period}_barcolor']} , {row[f'{period}_trend']} ")
|
732
733
|
if side != "":
|
733
734
|
select = True
|
734
735
|
self.pendingPositions = await self.bitunixApi.GetPendingPositionData({'symbol': row.symbol})
|
@@ -792,6 +793,7 @@ class BitunixSignal:
|
|
792
793
|
count=count+1
|
793
794
|
else:
|
794
795
|
self.logger.info(f"Skipping {row.symbol} as it has been opened for less than {self.settings.DELAY_IN_MINUTES_FOR_SAME_TICKER_TRADES} minutes")
|
796
|
+
|
795
797
|
if count >= int(self.settings.MAX_AUTO_TRADES):
|
796
798
|
break
|
797
799
|
await asyncio.sleep(0)
|
@@ -898,21 +900,25 @@ class BitunixSignal:
|
|
898
900
|
|
899
901
|
if self.settings.BOT_TRAIL_SL:
|
900
902
|
if old_slPrice is not None:
|
901
|
-
|
903
|
+
sl_midpoint = old_slPrice / (1 - self.settings.LOSS_PERCENTAGE/100/self.settings.LEVERAGE) if side == "BUY" else old_slPrice / (1 + self.settings.LOSS_PERCENTAGE/100/self.settings.LEVERAGE) if tpPrice is not None else None
|
904
|
+
|
902
905
|
if sl_midpoint is not None and (price > sl_midpoint and side == "BUY" or price < sl_midpoint and side == "SELL"):
|
903
|
-
|
904
|
-
|
906
|
+
if roi > self.settings.PROFIT_PERCENTAGE * 0.75 and self.settings.PROFIT_PERCENTAGE < self.settings.LOSS_PERCENTAGE:
|
907
|
+
slPrice = price * (1 - float(self.settings.PROFIT_PERCENTAGE * 0.75) / 100 / self.settings.LEVERAGE) if side == "BUY" else avgOpenPrice * (1 + float(self.settings.PROFIT_PERCENTAGE) / 100 / self.settings.LEVERAGE)
|
908
|
+
else:
|
909
|
+
slPrice = price * (1 - float(self.settings.LOSS_PERCENTAGE) / 100 / self.settings.LEVERAGE) if side == "BUY" else price * (1 + float(self.settings.LOSS_PERCENTAGE) / 100 / self.settings.LEVERAGE)
|
905
910
|
slPrice = Decimal(await self.str_precision(slPrice))
|
906
911
|
slPrice = float(str(slPrice.quantize(Decimal(f'1e-{decimal_places}'))))
|
907
912
|
slOrderPrice = await self.increment_by_last_decimal(await self.str_precision(slPrice))
|
908
913
|
|
909
914
|
if (self.settings.BOT_TRAIL_TP and tpOrderPrice is not None) or (self.settings.BOT_TRAIL_SL and slOrderPrice is not None):
|
910
915
|
self.notifications.add_notification(
|
911
|
-
f'{colors.CYAN} {row.symbol} price: {price}, ROI: {roi}%, TP: {old_tpPrice}, TP midpoint: {tp_midpoint}, new TP: {tpPrice}, SL: {old_slPrice}, SL midpoint: {sl_midpoint}, new SL: {slPrice}'
|
916
|
+
f'{colors.CYAN} {row.symbol} avgOpenPrice: {avgOpenPrice}, current price: {price}, ROI: {roi}%, TP: {old_tpPrice}, TP midpoint: {tp_midpoint}, new TP: {tpPrice}, SL: {old_slPrice}, SL midpoint: {sl_midpoint}, new SL: {slPrice}'
|
912
917
|
)
|
913
918
|
|
914
919
|
|
915
920
|
if self.settings.BOT_TRAIL_TP and tpPrice is not None and tpOrderPrice is not None:
|
921
|
+
if old_tpPrice is None or tpPrice != old_tpPrice:
|
916
922
|
datajs2 = await self.bitunixApi.ModifyTpSlOrder({'orderId':tporderId,'tpPrice':str(tpPrice), 'tpOrderPrice':str(tpOrderPrice), 'tpQty':str(qty),'tpStopType':tpStopType,'tpOrderType':tpOrderType})
|
917
923
|
if datajs2 is not None:
|
918
924
|
self.notifications.add_notification(
|
@@ -920,11 +926,17 @@ class BitunixSignal:
|
|
920
926
|
)
|
921
927
|
|
922
928
|
if self.settings.BOT_TRAIL_SL and slPrice is not None and slOrderPrice is not None:
|
929
|
+
if old_slPrice is None or slPrice != old_slPrice:
|
923
930
|
datajs3 = await self.bitunixApi.ModifyTpSlOrder({'orderId':slorderId,'slPrice':str(slPrice),'slQty':str(qty),'slStopType':slStopType,'slOrderType':slOrderType})
|
924
931
|
if datajs3 is not None:
|
925
|
-
self.
|
926
|
-
|
927
|
-
|
932
|
+
if roi > self.settings.PROFIT_PERCENTAGE * 0.75 and self.settings.PROFIT_PERCENTAGE < self.settings.LOSS_PERCENTAGE:
|
933
|
+
self.notifications.add_notification(
|
934
|
+
f'{colors.CYAN} Stop Loss order for {row.symbol} moved from {old_slPrice} to breakeven {slPrice}'
|
935
|
+
)
|
936
|
+
else:
|
937
|
+
self.notifications.add_notification(
|
938
|
+
f'{colors.CYAN} Stop Loss order for {row.symbol} moved from {old_slPrice} to {slPrice}'
|
939
|
+
)
|
928
940
|
|
929
941
|
|
930
942
|
|
@@ -750,13 +750,13 @@ class Tickers:
|
|
750
750
|
trending_conditions = [
|
751
751
|
(
|
752
752
|
(df[f'{period}_trend']=='BUY') &
|
753
|
-
(df[f'{period}_cb']
|
753
|
+
(df[f'{period}_cb']>= self.settings.MINIMUM_CONSECUTIVE_CANDLES)
|
754
754
|
#&
|
755
755
|
#(df[f'{period}_barcolor']==self.green)
|
756
756
|
),
|
757
757
|
(
|
758
758
|
(df[f'{period}_trend']=='SELL') &
|
759
|
-
(df[f'{period}_cb']
|
759
|
+
(df[f'{period}_cb']>= self.settings.MINIMUM_CONSECUTIVE_CANDLES)
|
760
760
|
#&
|
761
761
|
#(df[f'{period}_barcolor']==self.red)
|
762
762
|
)
|
@@ -44,6 +44,7 @@ class Settings(BaseSettings):
|
|
44
44
|
MACD_SHORT: int = Field(default=12, ge=1)
|
45
45
|
MACD_LONG: int = Field(default=26, ge=1)
|
46
46
|
ADX_PERIOD: int = Field(default=14, ge=1)
|
47
|
+
MINIMUM_CONSECUTIVE_CANDLES: int = Field(default=2, ge=1)
|
47
48
|
|
48
49
|
# Technical Indicators
|
49
50
|
OPEN_ON_ANY_SIGNAL: bool = Field(default=True)
|
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.3.
|
1
|
+
__version__ = "3.3.8"
|
@@ -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=5qg-K5IcsAbb6K1feP9zL7RzSz7JzdGAxoY8R_YWxWE,15666
|
3
|
-
bitunix_automated_crypto_trading/BitunixSignal.py,sha256=
|
3
|
+
bitunix_automated_crypto_trading/BitunixSignal.py,sha256=nMdHsWqtnrHcem_OlC4k8gbI2KDrJKuivzTG13g-udI,91104
|
4
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
|
-
bitunix_automated_crypto_trading/TickerManager.py,sha256=
|
9
|
+
bitunix_automated_crypto_trading/TickerManager.py,sha256=tYzO7-vxb-60a-yvsRDC4w9GNdTsqWwy8DxbagtsqAc,42023
|
10
10
|
bitunix_automated_crypto_trading/__init__.py,sha256=1hzk6nX8NnUCr1tsq8oFq1qGCNhNwnwldWE75641Eew,78
|
11
11
|
bitunix_automated_crypto_trading/bitunix.py,sha256=lxwnYARxldA2oU6GdjupilXIlnUh4RX8rQLCOn7x13I,27143
|
12
|
-
bitunix_automated_crypto_trading/config.py,sha256
|
12
|
+
bitunix_automated_crypto_trading/config.py,sha256=2K-5NzWoVUaU3O2tgi4qt-3dA_sCC6Nm3vFQBZrO5y8,5943
|
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.3.
|
16
|
-
bitunix_automated_crypto_trading-3.3.
|
17
|
-
bitunix_automated_crypto_trading-3.3.
|
18
|
-
bitunix_automated_crypto_trading-3.3.
|
19
|
-
bitunix_automated_crypto_trading-3.3.
|
14
|
+
bitunix_automated_crypto_trading/version.py,sha256=37tflRBXps5ly3x-d0V5MX2DfwsqrPwDzFH9EVchsG4,21
|
15
|
+
bitunix_automated_crypto_trading-3.3.8.dist-info/METADATA,sha256=HXT-qw3CG4V7GtZlr-vdv86LP6p_o-qxhamOgQH7354,996
|
16
|
+
bitunix_automated_crypto_trading-3.3.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
17
|
+
bitunix_automated_crypto_trading-3.3.8.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
|
18
|
+
bitunix_automated_crypto_trading-3.3.8.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
|
19
|
+
bitunix_automated_crypto_trading-3.3.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|