bitunix-automated-crypto-trading 3.2.0__tar.gz → 3.2.2__tar.gz

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.
Files changed (25) hide show
  1. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/PKG-INFO +1 -1
  2. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/README.md +27 -27
  3. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/BitunixSignal.py +3 -1
  4. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/TickerManager.py +12 -9
  5. bitunix_automated_crypto_trading-3.2.2/bitunix_automated_crypto_trading/version.py +1 -0
  6. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/PKG-INFO +1 -1
  7. bitunix_automated_crypto_trading-3.2.0/bitunix_automated_crypto_trading/version.py +0 -1
  8. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/AsyncThreadRunner.py +0 -0
  9. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/BitunixApi.py +0 -0
  10. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/BitunixWebSocket.py +0 -0
  11. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/DataFrameHtmlRenderer.py +0 -0
  12. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/NotificationManager.py +0 -0
  13. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/SupportResistance.py +0 -0
  14. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/ThreadManager.py +0 -0
  15. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/__init__.py +0 -0
  16. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/bitunix.py +0 -0
  17. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/config.py +0 -0
  18. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading/logger.py +0 -0
  19. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/SOURCES.txt +0 -0
  20. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/dependency_links.txt +0 -0
  21. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/entry_points.txt +0 -0
  22. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/requires.txt +0 -0
  23. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/bitunix_automated_crypto_trading.egg-info/top_level.txt +0 -0
  24. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/setup.cfg +0 -0
  25. {bitunix_automated_crypto_trading-3.2.0 → bitunix_automated_crypto_trading-3.2.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitunix_automated_crypto_trading
3
- Version: 3.2.0
3
+ Version: 3.2.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
@@ -194,24 +194,24 @@ The platform can be configured through the `config.py` file or `config.txt`. Key
194
194
 
195
195
  - Linux install (ubuntu 22.04)
196
196
  - sudo su -
197
- - # required for TA-Lib
198
- - wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_amd64.deb
199
- - sudo dpkg -i ta-lib_0.6.4_amd64.deb
200
- - # change the tags/2.0 to the latest version in the script below and run it
201
- - bash -c "\
202
- apt-get install -y python3-pip wget unzip dos2unix && \
203
- python3 -m pip install --upgrade pip && \
204
- mkdir bitunix && cd bitunix && \
205
- wget https://github.com/tcj2001/bitunix-automated-crypto-trading/archive/refs/tags/v3.1.8.tar.gz -O bitunix.tar.gz && \
206
- mkdir code && \
207
- tar --strip-components=1 -xvzf bitunix.tar.gz -C code && \
208
- cd code && \
209
- pip3 install -r requirements.txt && \
210
- cp sampleenv.txt .env"
211
- - The package will be installed in the bitunix/code directory
212
- - cd bitunix/code
213
- - python3 bitunix.py .env config.txt 8000 (This is the default even if you dont pass these)
214
-
197
+ - required for TA-Lib
198
+ - wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_amd64.deb
199
+ - sudo dpkg -i ta-lib_0.6.4_amd64.deb
200
+ - change the tags/3.1.8 to the latest version in the script below and run it
201
+ - bash -c "\
202
+ apt-get install -y python3-pip wget unzip dos2unix && \
203
+ python3 -m pip install --upgrade pip && \
204
+ mkdir bitunix && cd bitunix && \
205
+ wget https://github.com/tcj2001/bitunix-automated-crypto-trading/archive/refs/tags/v3.1.8.tar.gz -O bitunix.tar.gz && \
206
+ mkdir code && \
207
+ tar --strip-components=1 -xvzf bitunix.tar.gz -C code && \
208
+ cd code && \
209
+ pip3 install -r requirements.txt && \
210
+ cp sampleenv.txt .env"
211
+ - The package will be installed in the bitunix/code directory
212
+ - cd bitunix/code
213
+ - python3 bitunix.py .env config.txt 8000 (This is the default even if you dont pass these)
214
+
215
215
  For multiple instance or bots
216
216
  - python3 bitunix.py .env1 bot1.txt 8001
217
217
  - python3 bitunix.py .env2 bot2.txt 8002
@@ -222,16 +222,16 @@ The platform can be configured through the `config.py` file or `config.txt`. Key
222
222
  - cd c:\bitunix
223
223
  - python -m venv env
224
224
  - .\env\Scripts\activate
225
- - # check python version should be 3.13 or above
226
- - python3 --version
227
- - python -m pip install --upgrade pip
228
- - pip install https://github.com/cgohlke/talib-build/releases/download/v0.6.3/ta_lib-0.6.3-cp313-cp313-win_amd64.whl
229
- - # change the tags/2.0 to the latest version in the script below and run it
230
- - wget https://github.com/tcj2001/bitunix-automated-crypto-trading/archive/refs/tags/2.0.zip
231
- - unzip zip file and copy the content inside C:\bitunix\Ver1.0.zip\bitunix-automated-crypto-trading-Ver1.0 to c:\bitunix
225
+ - check python version should be 3.13 or above
226
+ - python3 --version
227
+ - python -m pip install --upgrade pip
228
+ - pip install https://github.com/cgohlke/talib-build/releases/download/v0.6.3/ta_lib-0.6.3-cp313-cp313-win_amd64.whl
229
+ - change the tags/3.1.8 to the latest version in the script below and run it
230
+ - wget https://github.com/tcj2001/bitunix-automated-crypto-trading/archive/refs/tags/3.1.8.zip
231
+ - unzip zip file and copy the content inside C:\bitunix\Ver1.0.zip\bitunix-automated-crypto-trading-Ver1.0 to c:\bitunix
232
232
  - pip install -r requirements.txt
233
- - # Make sure ta-lib is installed
234
- - python -c "import talib; print(talib.get_functions());"
233
+ - Make sure ta-lib is installed
234
+ - python -c "import talib; print(talib.get_functions());"
235
235
  - copy sampleenv.txt to .env and update the keys accordingly
236
236
  - python bitunix.py
237
237
 
@@ -406,9 +406,11 @@ class BitunixSignal:
406
406
  self.portfolioData = await self.bitunixApi.GetportfolioData()
407
407
  if self.portfolioData:
408
408
  self.portfoliodf=pd.DataFrame(self.portfolioData,index=[0])[["marginCoin","available","margin","crossUnrealizedPNL"]]
409
+ self.portfoliodf = self.portfoliodf.astype({"marginCoin": str, "available": float, "margin": float, "crossUnrealizedPNL": float})
410
+ self.portfoliodf['Value'] =round(self.portfoliodf['margin'] + self.portfoliodf['crossUnrealizedPNL'] + self.portfoliodf['available'],2)
409
411
  else:
410
412
  self.portfolioData = pd.DataFrame()
411
- self.portfoliodfStyle= self.portfoliodfrenderer.render_html(self.portfoliodf)
413
+ self.portfoliodfStyle= self.portfoliodfrenderer.render_html(self.portfoliodf[["Value", "marginCoin", "available", "margin", "crossUnrealizedPNL"]])
412
414
 
413
415
  except Exception as e:
414
416
  self.logger.info(f"Function: GetportfolioData, {e}, {e.args}, {type(e).__name__}")
@@ -87,13 +87,17 @@ class Interval:
87
87
  df['ma_slow_angle'] = np.degrees(np.arctan(df['ma_slow_slope']))
88
88
  df.fillna({'ma_slow_slope':0}, inplace=True)
89
89
  df.fillna({'ma_slow_angle':0}, inplace=True)
90
+
91
+ df['ma_spread'] = (df['ma_fast'] - df['ma_slow']).diff()
92
+ df.fillna({'ma_spread':0}, inplace=True)
93
+ df.fillna({'ma_spread':0}, inplace=True)
90
94
 
91
95
  if self.settings.EMA_CROSSING:
92
96
  if df is not None and len(df) >= 2:
93
- if df['ma_medium'].iloc[-2] <= df['ma_slow'].iloc[-2] and df['ma_medium'].iloc[-1] > df['ma_slow'].iloc[-1]:
97
+ if df['ma_medium'].iloc[-2] <= df['ma_slow'].iloc[-2] and df['ma_medium'].iloc[-1] > df['ma_slow'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
94
98
  self.ema_open_signal = "BUY"
95
99
  self.ema_close_signal = "BUY"
96
- elif df['ma_medium'].iloc[-2] >= df['ma_slow'].iloc[-2] and df['ma_medium'].iloc[-1] < df['ma_slow'].iloc[-1]:
100
+ elif df['ma_medium'].iloc[-2] >= df['ma_slow'].iloc[-2] and df['ma_medium'].iloc[-1] < df['ma_slow'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
97
101
  self.ema_open_signal = "SELL"
98
102
  self.ema_close_signal = "SELL"
99
103
  else:
@@ -101,18 +105,18 @@ class Interval:
101
105
  self.ema_close_signal = "HOLD"
102
106
 
103
107
  if self.settings.EMA_CLOSE_ON_FAST_MEDIUM:
104
- if df['ma_fast'].iloc[-2] <= df['ma_medium'].iloc[-2] and df['ma_fast'].iloc[-1] > df['ma_medium'].iloc[-1]:
108
+ if df['ma_fast'].iloc[-2] <= df['ma_medium'].iloc[-2] and df['ma_fast'].iloc[-1] > df['ma_medium'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
105
109
  self.ema_close_signal = "BUY"
106
- elif df['ma_fast'].iloc[-2] >= df['ma_medium'].iloc[-2] and df['ma_fast'].iloc[-1] < df['ma_medium'].iloc[-1]:
110
+ elif df['ma_fast'].iloc[-2] >= df['ma_medium'].iloc[-2] and df['ma_fast'].iloc[-1] < df['ma_medium'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
107
111
  self.ema_close_signal = "SELL"
108
112
  else:
109
113
  self.ema_close_signal = "HOLD"
110
114
  else:
111
115
  if df is not None and len(df) >= 1:
112
- if df['close'].iloc[-1] > df['ma_medium'].iloc[-1] and df['ma_medium'].iloc[-1] > df['ma_slow'].iloc[-1]:
116
+ if df['close'].iloc[-1] > df['ma_medium'].iloc[-1] and df['ma_medium'].iloc[-1] > df['ma_slow'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
113
117
  self.ema_open_signal = "BUY"
114
118
  self.ema_close_signal = "BUY"
115
- elif df['close'].iloc[-1] < df['ma_medium'].iloc[-1] and df['ma_medium'].iloc[-1] < df['ma_slow'].iloc[-1]:
119
+ elif df['close'].iloc[-1] < df['ma_medium'].iloc[-1] and df['ma_medium'].iloc[-1] < df['ma_slow'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
116
120
  self.ema_open_signal = "SELL"
117
121
  self.ema_close_signal = "SELL"
118
122
  else:
@@ -120,9 +124,9 @@ class Interval:
120
124
  self.ema_close_signal = "HOLD"
121
125
 
122
126
  if self.settings.EMA_CLOSE_ON_FAST_MEDIUM:
123
- if df['close'].iloc[-1] > df['ma_fast'].iloc[-1] and df['ma_fast'].iloc[-1] > df['ma_medium'].iloc[-1]:
127
+ if df['close'].iloc[-1] > df['ma_fast'].iloc[-1] and df['ma_fast'].iloc[-1] > df['ma_medium'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
124
128
  self.ema_close_signal = "BUY"
125
- elif df['close'].iloc[-1] < df['ma_fast'].iloc[-1] and df['ma_fast'].iloc[-1] < df['ma_medium'].iloc[-1]:
129
+ elif df['close'].iloc[-1] < df['ma_fast'].iloc[-1] and df['ma_fast'].iloc[-1] < df['ma_medium'].iloc[-1] and df['ma_spread'].iloc[-1] > 0:
126
130
  self.ema_close_signal = "SELL"
127
131
  else:
128
132
  self.ema_close_signal = "HOLD"
@@ -740,7 +744,6 @@ class Tickers:
740
744
  f"{period}_cb": intervalObj.signal_strength,
741
745
  f"{period}_barcolor": lastcandle['barcolor'],
742
746
  f"{period}_ema_open": intervalObj.ema_open_signal,
743
- f"{period}_ema_open": intervalObj.ema_open_signal,
744
747
  f"{period}_ema_close": intervalObj.ema_close_signal,
745
748
  f"{period}_macd":intervalObj.macd_signal,
746
749
  f"{period}_bbm":intervalObj.bbm_signal,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitunix_automated_crypto_trading
3
- Version: 3.2.0
3
+ Version: 3.2.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