bitunix-automated-crypto-trading 3.3.6__py3-none-any.whl → 3.3.7__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 +23 -11
- 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.7.dist-info}/METADATA +1 -1
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.7.dist-info}/RECORD +9 -9
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.7.dist-info}/WHEEL +0 -0
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.7.dist-info}/entry_points.txt +0 -0
- {bitunix_automated_crypto_trading-3.3.6.dist-info → bitunix_automated_crypto_trading-3.3.7.dist-info}/top_level.txt +0 -0
@@ -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,17 +900,22 @@ 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
|
+
if roi > self.settings.PROFIT_PERCENTAGE:
|
905
|
+
sl_midpoint = tp_midpoint
|
906
|
+
|
902
907
|
if sl_midpoint is not None and (price > sl_midpoint and side == "BUY" or price < sl_midpoint and side == "SELL"):
|
903
|
-
|
904
|
-
|
908
|
+
if roi > self.settings.PROFIT_PERCENTAGE and self.settings.PROFIT_PERCENTAGE < self.settings.LOSS_PERCENTAGE:
|
909
|
+
slPrice = price * (1 - float(self.settings.PROFIT_PERCENTAGE) / 100 / self.settings.LEVERAGE) if side == "BUY" else price * (1 + float(self.settings.PROFIT_PERCENTAGE) / 100 / self.settings.LEVERAGE)
|
910
|
+
else:
|
911
|
+
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
912
|
slPrice = Decimal(await self.str_precision(slPrice))
|
906
913
|
slPrice = float(str(slPrice.quantize(Decimal(f'1e-{decimal_places}'))))
|
907
914
|
slOrderPrice = await self.increment_by_last_decimal(await self.str_precision(slPrice))
|
908
915
|
|
909
916
|
if (self.settings.BOT_TRAIL_TP and tpOrderPrice is not None) or (self.settings.BOT_TRAIL_SL and slOrderPrice is not None):
|
910
917
|
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}'
|
918
|
+
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
919
|
)
|
913
920
|
|
914
921
|
|
@@ -922,9 +929,14 @@ class BitunixSignal:
|
|
922
929
|
if self.settings.BOT_TRAIL_SL and slPrice is not None and slOrderPrice is not None:
|
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 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.7"
|
@@ -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=jPxnlaKA7NJDl1az3m1bfNLpouUsMYa35CixwUCD25E,91091
|
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=Z9dy-a-QtSCS4duPQWpgA6G-wTeWi6aUt5Wi1lK_Ltg,21
|
15
|
+
bitunix_automated_crypto_trading-3.3.7.dist-info/METADATA,sha256=pppKFPixMGagASNAjEA4nu5lY9wTbslP4__00JOmNIk,996
|
16
|
+
bitunix_automated_crypto_trading-3.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
17
|
+
bitunix_automated_crypto_trading-3.3.7.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
|
18
|
+
bitunix_automated_crypto_trading-3.3.7.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
|
19
|
+
bitunix_automated_crypto_trading-3.3.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|