bitunix-automated-crypto-trading 3.1.0__py3-none-any.whl → 3.1.2__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.
@@ -249,21 +249,19 @@ class BitunixApi:
249
249
  function_name = stack[-2].name
250
250
  logger.info(f"Function: {function_name}, {e}, {e.args}, {type(e).__name__}")
251
251
 
252
- async def GetKlineHistory(self, ticker, interval, limit):
252
+ async def GetKlineHistory(self, ticker, interval, limit, starttime):
253
253
  data = []
254
254
  lm=limit
255
- current_unix_timestamp = int(time.time())
255
+ st=starttime
256
256
  try:
257
257
  while True:
258
- url = f'{self.kline_Url}?symbol={ticker}&startTime={current_unix_timestamp}&interval={interval}&limit={lm}'
258
+ url = f'{self.kline_Url}?symbol={ticker}&startTime={st}&interval={interval}&limit={lm}'
259
259
  resp = self.session.get(url)
260
260
  datajs = resp.json()
261
- if len(datajs['data']) > 0:
262
- current_unix_timestamp = str(int(datajs['data'][-1]['time']) + 1) # Adjust 'time' to match the appropriate key in your data
263
- data.extend(datajs['data'])
261
+ data.extend(datajs['data'])
262
+ if len(datajs['data']) < lm:
263
+ st = int(datajs['data'][-1]['time']) + 1
264
264
  lm=limit-len(data)
265
- if len(data) >= limit:
266
- break
267
265
  else:
268
266
  break
269
267
  return data
@@ -218,7 +218,7 @@ class BitunixSignal:
218
218
  intervals = self.tickerObjects.get_intervalIds()
219
219
  for ticker in self.tickerList:
220
220
  for intervalId in intervals:
221
- data = await self.bitunixApi.GetKlineHistory(ticker, intervalId, self.settings.BARS)
221
+ data = await self.bitunixApi.GetKlineHistory(ticker, intervalId, self.settings.BARS, int(time.time()))
222
222
  if data is not None:
223
223
  self.tickerObjects.load_kline_history(ticker, intervalId, self.settings.BARS, data)
224
224
  if self.settings.VERBOSE_LOGGING:
@@ -53,24 +53,21 @@ class Interval:
53
53
  # Calculate the Moving Averages
54
54
  if self.settings.EMA_STUDY:
55
55
  df['ma_fast'] = talib.EMA(df['close'], timeperiod=self.settings.MA_FAST)
56
- df['ma_fast'] = df['ma_fast'].bfill()
57
- df.fillna({'ma_fast':0}, inplace=True)
56
+ df.dropna(subset=['ma_fast'], inplace=True)
58
57
  df['ma_fast_slope'] = df['ma_fast'].diff()
59
58
  df['ma_fast_angle'] = np.degrees(np.arctan(df['ma_fast_slope']))
60
59
  df.fillna({'ma_fast_slope':0}, inplace=True)
61
60
  df.fillna({'ma_fast_angle':0}, inplace=True)
62
61
 
63
62
  df['ma_medium'] = talib.EMA(df['close'], timeperiod=self.settings.MA_MEDIUM)
64
- df['ma_medium'] = df['ma_medium'].bfill()
65
- df.fillna({'ma_medium':0}, inplace=True)
63
+ df.dropna(subset=['ma_medium'], inplace=True)
66
64
  df['ma_medium_slope'] = df['ma_medium'].diff()
67
65
  df['ma_medium_angle'] = np.degrees(np.arctan(df['ma_medium_slope']))
68
66
  df.fillna({'ma_medium_slope':0}, inplace=True)
69
67
  df.fillna({'ma_medium_angle':0}, inplace=True)
70
68
 
71
69
  df['ma_slow'] = talib.EMA(df['close'], timeperiod=self.settings.MA_SLOW)
72
- df['ma_slow'] = df['ma_slow'].bfill()
73
- df.fillna({'ma_slow':0}, inplace=True)
70
+ df.dropna(subset=['ma_slow'],inplace=True)
74
71
  df['ma_slow_slope'] = df['ma_slow'].diff()
75
72
  df['ma_slow_angle'] = np.degrees(np.arctan(df['ma_slow_slope']))
76
73
  df.fillna({'ma_slow_slope':0}, inplace=True)
@@ -114,14 +111,12 @@ class Interval:
114
111
  df['MACD_Signal'] = 0.0
115
112
  df['MACD_Histogram'] = 0.0
116
113
  df['MACD_Line'], df['MACD_Signal'], df['MACD_Histogram'] = talib.MACD(df['close'], fastperiod=self.settings.MACD_SHORT, slowperiod=self.settings.MACD_LONG, signalperiod=self.settings.MACD_PERIOD)
117
- df.fillna({'MACD_Line':0}, inplace=True)
118
- df.fillna({'MACD_Signal':0}, inplace=True)
119
- df.fillna({'MACD_Histogram':0}, inplace=True)
120
-
114
+ df.dropna(subset=['MACD_Line', 'MACD_Signal', 'MACD_Histogram'], inplace=True)
121
115
  df['MACD_Line_slope'] = df['MACD_Line'].diff()
122
116
  df['MACD_Line_angle'] = np.degrees(np.arctan(df['MACD_Line_slope']))
123
117
  df.fillna({'MACD_Line_slope':0}, inplace=True)
124
- df.fillna({'MACD_Line_angle':0}, inplace=True)
118
+ df.fillna({'MACD_Line_angle':0}, inplace=True)
119
+
125
120
 
126
121
  if self.settings.MACD_CROSSING:
127
122
  if df['MACD_Line'].iloc[-2] <= df['MACD_Signal'].iloc[-2] and df['MACD_Line'].iloc[-1] > df['MACD_Signal'].iloc[-1]:
@@ -147,9 +142,7 @@ class Interval:
147
142
  df['BBM'] = 0.0
148
143
  df['BBU'] = 0.0
149
144
  df['BBU'], df['BBM'], df['BBL'] = talib.BBANDS(df['close'], timeperiod=self.settings.BBM_PERIOD, nbdevup=self.settings.BBM_STD, nbdevdn=self.settings.BBM_STD, )
150
- df.fillna({'BBL':0}, inplace=True)
151
- df.fillna({'BBM':0}, inplace=True)
152
- df.fillna({'BBU':0}, inplace=True)
145
+ df.dropna(subset=['BBM', 'BBU', 'BBL'], inplace=True)
153
146
 
154
147
  df['BBM_slope'] = df['BBM'].diff()
155
148
  df['BBM_angle'] = np.degrees(np.arctan(df['BBM_slope']))
@@ -177,14 +170,14 @@ class Interval:
177
170
  # Calculate the RSI
178
171
  if self.settings.RSI_STUDY:
179
172
  df['rsi_fast'] = talib.RSI(df['close'],timeperiod=self.settings.RSI_FAST)
180
- df.fillna({'rsi_fast':0}, inplace=True)
173
+ df.dropna(subset=['rsi_fast'], inplace=True)
181
174
  df['rsi_fast_slope'] = df['rsi_fast'].diff()
182
175
  df['rsi_fast_angle'] = np.degrees(np.arctan(df['rsi_fast_slope']))
183
176
  df.fillna({'rsi_fast_slope':0}, inplace=True)
184
177
  df.fillna({'rsi_fast_angle':0}, inplace=True)
185
178
 
186
179
  df['rsi_slow'] = talib.RSI(df['close'],timeperiod=self.settings.RSI_SLOW)
187
- df.fillna({'rsi_slow':0}, inplace=True)
180
+ df.dropna(subset=['rsi_slow'], inplace=True)
188
181
  df['rsi_slow_slope'] = df['rsi_slow'].diff()
189
182
  df['rsi_slow_angle'] = np.degrees(np.arctan(df['rsi_slow_slope']))
190
183
  df.fillna({'rsi_slow_slope':0}, inplace=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitunix_automated_crypto_trading
3
- Version: 3.1.0
3
+ Version: 3.1.2
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
1
  bitunix_automated_crypto_trading/AsyncThreadRunner.py,sha256=LJ6ny1KSCVoIbfeNypsY4aHYcbkGME9M3epQ9e8B1O8,3224
2
- bitunix_automated_crypto_trading/BitunixApi.py,sha256=wJhknpmVFrckoL89h-nlWUAMsPxhIacY0nOGJT9M6Vw,11360
3
- bitunix_automated_crypto_trading/BitunixSignal.py,sha256=LKxWy_-alKkawB_l9_AdzwtCt0rx6lTqfBDuiGBMoe4,64669
2
+ bitunix_automated_crypto_trading/BitunixApi.py,sha256=gmhWi83k4EHOMIY7ZPa3x2NuIgVyzH13Sjk9AlVKjtQ,11163
3
+ bitunix_automated_crypto_trading/BitunixSignal.py,sha256=z8-mvwZOR1VAAmrgy9HjgFyv-IRx1GxogcXjwCPJ4oY,64687
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
- bitunix_automated_crypto_trading/TickerManager.py,sha256=eeOK5paiae10XHjKMbucJnVAZkAsEC86N37bRPuCcFc,33427
8
+ bitunix_automated_crypto_trading/TickerManager.py,sha256=g9Imr3uJijWeLqJbmCDrcDBwCHaBXV6P6sse73akmTA,33082
9
9
  bitunix_automated_crypto_trading/__init__.py,sha256=1hzk6nX8NnUCr1tsq8oFq1qGCNhNwnwldWE75641Eew,78
10
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.1.0.dist-info/METADATA,sha256=XCBZ2j36c5DL7EKdjcUkS7dzCLMcq9c1TW9Ru5wt9pY,996
14
- bitunix_automated_crypto_trading-3.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
- bitunix_automated_crypto_trading-3.1.0.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
16
- bitunix_automated_crypto_trading-3.1.0.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
17
- bitunix_automated_crypto_trading-3.1.0.dist-info/RECORD,,
13
+ bitunix_automated_crypto_trading-3.1.2.dist-info/METADATA,sha256=5hhgVdOaJ-kqG0zdmen-OXVGpvBtXJxXjoU-tg_8-WI,996
14
+ bitunix_automated_crypto_trading-3.1.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
15
+ bitunix_automated_crypto_trading-3.1.2.dist-info/entry_points.txt,sha256=UXREYHuSl2XYd_tOtLIq0zg3d1kX3lixX5SpN8yGBw4,82
16
+ bitunix_automated_crypto_trading-3.1.2.dist-info/top_level.txt,sha256=uyFzHUCOsp8elnG2Ovor6xXcf7dxRxY-C-Txiwix64Q,33
17
+ bitunix_automated_crypto_trading-3.1.2.dist-info/RECORD,,