diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..eff51e5
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,16 @@
+Copyright (c)
+License: Attribution 4.0 International (CC BY 4.0)
+Author: David C Cavalcante
+
+[![LinkedIn](https://www.linkedin.com/in/hellodav/)](https://www.linkedin.com/in/hellodav/)
+[![Medium](https://medium.com/@davcavalcante/)](https://medium.com/@davcavalcante/)
+
+Takkβ’ Innovate Studio
+
+* Positive results, rapid innovation
+* Leading the Digital Revolution as the Pioneering 100% Artificial Intelligence Team
+
+[Takkβ’ Innovate Studio](https://takk.ag/)
+[![GitHub]](https://github.com/@takk8is/)
+[![X]](https://twitter.com/takk8is/)
+[![Medium](https://medium.com/@takk8is/)](https://medium.com/@takk8is/)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0e259d4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6189b56
--- /dev/null
+++ b/README.md
@@ -0,0 +1,95 @@
+# Kucoin PumpDump Crypto Alerts Telegram Bot
+
+## Description
+
+The Kucoin PumpDump Crypto Alerts Telegram Bot is an automated system designed to monitor and analyse cryptocurrency pairs on the KuCoin exchange. It uses technical indicators to identify buying or selling opportunities based on price fluctuations and market trends. Alerts are sent through Telegram, allowing users to respond quickly to market changes.
+
+## Features
+
+- **Real-Time Monitoring:** The bot monitors a configurable list of cryptocurrency pairs and analyses their prices in real time.
+- **Technical Analysis:** Utilises indicators such as RSI (Relative Strength Index) and MACD (Moving Average Convergence Divergence) to assess market conditions.
+- **Telegram Alerts:** Sends custom alerts via Telegram when it detects favourable market conditions for buying or selling.
+
+## Prerequisites
+
+Before starting the bot, ensure you have installed:
+
+- Python 3.10 or higher
+- pip (Python package manager)
+- A KuCoin API account
+- A configured Telegram bot with a token
+
+## Setup
+
+### 1. Clone the repository
+
+```bash
+git clone https://github.com/Takk8IS/kucoin-pumpdump-crypto-alerts-telegram-bot.git
+cd kucoin-pumpdump-crypto-alerts-telegram-bot
+```
+
+### 2. Install dependencies
+
+```bash
+pip install --upgrade --force-reinstall -r requirements.txt
+```
+
+### 3. Configure your environment variables
+
+Create a `.env` file in the project root and add the following variables:
+
+```plaintext
+TELEGRAM_BOT_TOKEN=your_token_here
+CHANNEL_ID=@your_channel_here
+API_KEY=your_api_key_here
+API_SECRET=your_api_secret_here
+API_PASSPHRASE=your_passphrase_here
+```
+
+## Usage
+
+To start the bot, run:
+
+```bash
+python3 kucoin-pumpdump-crypto-alerts-telegram-bot-selected-usdt-pars.py
+```
+
+## Contributing
+
+Contributions are always welcome! If you would like to contribute to the project, please follow these steps:
+
+1. Fork the repository.
+2. Create a new branch for your modifications (`git checkout -b feature/new-feature`).
+3. Commit your changes (`git commit -am 'Add new feature'`).
+4. Push to the branch (`git push origin feature/new-feature`).
+5. Open a Pull Request.
+
+## Licence
+
+This project is licensed under the Attribution 4.0 International License - see the [CC-BY-4.0](CC-BY-4.0) file for details.
+
+## Support
+
+If you need help with the bot, please contact via email at say@takk.ag or through Telegram.
+
+## Donations
+
+If this script has been helpful for you, consider making a donation to support our work:
+
+- $USDT (TRC-20): TGpiWetnYK2VQpxNGPR27D9vfM6Mei5vNA
+
+Your donations help us continue developing useful and innovative tools.
+
+## Takkβ’ Innovate Studio
+
+Leading the Digital Revolution as the Pioneering 100% Artificial Intelligence Team.
+
+- Copyright (c)
+- Licence: Attribution 4.0 International (CC BY 4.0)
+- Author: David C Cavalcante
+- LinkedIn: https://www.linkedin.com/in/hellodav/
+- Medium: https://medium.com/@davcavalcante/
+- Positive results, rapid innovation
+- URL: https://takk.ag/
+- X: https://twitter.com/takk8is/
+- Medium: https://takk8is.medium.com/
diff --git a/kucoin-pumpdump-crypto-alerts-telegram-bot-all-usdt-pars.py b/kucoin-pumpdump-crypto-alerts-telegram-bot-all-usdt-pars.py
new file mode 100644
index 0000000..4f3a7b5
--- /dev/null
+++ b/kucoin-pumpdump-crypto-alerts-telegram-bot-all-usdt-pars.py
@@ -0,0 +1,281 @@
+import os
+from dotenv import load_dotenv
+import requests
+import time
+from datetime import datetime, timedelta
+import base64
+import hashlib
+import asyncio
+import hmac
+import telegram.error
+from telegram import Bot
+from telegram.error import RetryAfter
+import pandas as pd
+import pandas_ta as ta
+
+# Settings
+TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
+CHANNEL_ID = os.getenv("CHANNEL_ID")
+API_KEY = os.getenv("API_KEY")
+API_SECRET = os.getenv("API_SECRET")
+API_PASSPHRASE = os.getenv("API_PASSPHRASE")
+API_IP = os.getenv("API_IP")
+
+bot = Bot(token=TELEGRAM_BOT_TOKEN)
+
+def get_headers(method, request_path, body=""):
+ timestamp = str(int(time.time() * 1000))
+ str_to_sign = timestamp + method + request_path + (body if body else "")
+ signature = base64.b64encode(
+ hmac.new(
+ API_SECRET.encode("utf-8"), str_to_sign.encode("utf-8"), hashlib.sha256
+ ).digest()
+ ).decode("utf-8")
+ passphrase = base64.b64encode(
+ hmac.new(
+ API_SECRET.encode("utf-8"), API_PASSPHRASE.encode("utf-8"), hashlib.sha256
+ ).digest()
+ ).decode("utf-8")
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": timestamp,
+ "KC-API-KEY": API_KEY,
+ "KC-API-PASSPHRASE": passphrase,
+ "KC-API-KEY-VERSION": "2",
+ }
+ return headers
+
+def fetch_market_data():
+ url = "https://api.kucoin.com/api/v1/market/allTickers"
+ try:
+ response = requests.get(
+ url, headers=get_headers("GET", "/api/v1/market/allTickers")
+ )
+ response.raise_for_status()
+ return response.json()
+ except requests.RequestException as e:
+ bot.send_message(chat_id=CHANNEL_ID, text=f"Error fetching data: {e}")
+ print(f"Error fetching data: {e}")
+ return None
+ except Exception as e:
+ bot.send_message(chat_id=CHANNEL_ID, text=f"Unexpected error: {e}")
+ print(f"Unexpected error: {e}")
+ return None
+
+def calculate_indicators(prices_history, minutes_to_evaluate=5, hours_for_trend=4):
+ """
+ Calculates technical indicators for each pair of cryptocurrencies.
+ Returns a dictionary with the calculated indicators.
+ """
+ current_time = datetime.now()
+ indicators = {}
+
+ evaluation_period = minutes_to_evaluate
+ # Convert hours to minutes
+ trend_period = hours_for_trend * 60
+
+ for pair, prices in prices_history.items():
+ prices_df = pd.DataFrame(prices, columns=["price", "time"])
+ prices_df = prices_df.set_index("time")
+
+ # Filter prices for trial and trend periods
+ prices_evaluation = prices_df.loc[
+ current_time - timedelta(minutes=evaluation_period): current_time, "price"
+ ]
+ prices_trend = prices_df.loc[
+ current_time - timedelta(minutes=evaluation_period + trend_period): current_time, "price"
+ ]
+
+ if len(prices_evaluation) >= 1 and len(prices_trend) >= 1:
+ # Calculate technical indicators
+ rsi_evaluation = calculate_rsi(prices_evaluation)
+ rsi_trend = calculate_rsi(prices_trend)
+
+ macd_evaluation, signal_evaluation, hist_evaluation = calculate_macd(
+ prices_evaluation
+ )
+ macd_trend, signal_trend, hist_trend = calculate_macd(prices_trend)
+
+ indicators[pair] = {
+ "rsi_evaluation": rsi_evaluation,
+ "rsi_trend": rsi_trend,
+ "macd_evaluation": macd_evaluation,
+ "macd_trend": macd_trend,
+ "signal_evaluation": signal_evaluation,
+ "signal_trend": signal_trend,
+ "hist_evaluation": hist_evaluation,
+ "hist_trend": hist_trend,
+ }
+ else:
+ print(f"Error calculating indicators for {pair}")
+
+ return indicators
+
+def calculate_rsi(prices):
+ delta = prices.diff()
+ gain = (delta.where(delta > 0, 0)).mean()
+ loss = (-delta.where(delta < 0, 0)).mean()
+ if loss == 0:
+ return 100
+ rs = gain / loss
+ return 100 - (100 / (1 + rs))
+
+def calculate_ema(prices, window):
+ weights = pd.Series(1.0, index=prices.index)
+ weights /= weights.sum()
+ ema = prices.ewm(span=window, min_periods=window).mean()
+ return ema
+
+def calculate_macd(prices):
+ ema12 = calculate_ema(prices, 12)
+ ema26 = calculate_ema(prices, 26)
+ macd_line = ema12 - ema26
+ signal_line = calculate_ema(macd_line, 9)
+ histogram = macd_line - signal_line
+ return macd_line.iloc[-1], signal_line.iloc[-1], histogram.iloc[-1]
+
+async def send_telegram_message(chat_id, message):
+ try:
+ await bot.send_message(chat_id=chat_id, text=message, parse_mode="HTML")
+ except telegram.error.RetryAfter as e:
+ print(f"Flood control exceeded. Retrying in {e.retry_after} seconds.")
+ await asyncio.sleep(e.retry_after)
+ await send_telegram_message(chat_id, message)
+ except Exception as e:
+ print(f"Error sending Telegram message: {e}")
+ else:
+ await asyncio.sleep(1)
+
+# 60 minutes and 15 seconds
+async def send_donation_message(interval=60 * 60 + 15):
+ while True:
+ message = f"π Help us push the boundaries of AI-driven analysis! Your contributions fuel our relentless pursuit of innovative trading strategies:\n\nπ€² Every donation propels us forward.\n\n$USDT (TRC-20):\nTGpiWetnYK2VQpxNGPR27D9vfM6Mei5vNA\n\nπ«Ά Designed to help you.\nπ«Ά From AIs to human-beans.\n\nπΈ Version 2.0.1 (2024/06/29)β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ await asyncio.sleep(interval)
+
+def calculate_variation_and_trend(prices_history, minutes_to_evaluate=5, hours_for_trend=4):
+ current_time = datetime.now()
+ variations = {}
+
+ evaluation_period = minutes_to_evaluate
+ # Convert hours to minutes
+ trend_period = hours_for_trend * 60
+
+ for pair, prices in prices_history.items():
+ prices_in_evaluation_period = [(price, time) for price, time in prices if current_time - time <= timedelta(minutes=evaluation_period)]
+ trend_start_time = current_time - timedelta(minutes=(evaluation_period + trend_period))
+ prices_in_trend_period = [(price, time) for price, time in prices if trend_start_time <= time <= trend_start_time + timedelta(minutes=trend_period)]
+
+ if len(prices_in_evaluation_period) >= 1 and len(prices_in_trend_period) >= 1:
+ initial_price_evaluation = prices_in_evaluation_period[0][0]
+ final_price_evaluation = prices_in_evaluation_period[-1][0]
+ initial_price_trend = prices_in_trend_period[0][0]
+ final_price_trend = prices_in_trend_period[-1][0]
+
+ variation_evaluation = ((final_price_evaluation - initial_price_evaluation) / initial_price_evaluation) * 100
+ variation_trend = ((final_price_trend - initial_price_trend) / initial_price_trend) * 100
+
+ if variation_evaluation > 0 and variation_trend > 0:
+ variations[pair] = variation_evaluation
+
+ return variations
+
+async def monitor_prices():
+ prices_history = {}
+ last_indicators = {}
+ sold_pairs = {}
+ monitoring_message_sent = False
+
+ while True:
+ data = fetch_market_data()
+ if data:
+ tickers = data["data"]["ticker"]
+ for ticker in tickers:
+ symbol = ticker["symbol"]
+ # Checks if the pair is desired, not containing "UP-", "DOWN-", "3L-", "3S-", "2L-", " 2S-"
+ if "USDT" in symbol and not any(x in symbol for x in ["UP-", "DOWN-", "3L-", "3S-", "2L-", "2S-"]):
+ last_price = ticker.get("last")
+ if last_price:
+ price = float(last_price)
+ if symbol not in prices_history:
+ prices_history[symbol] = []
+ prices_history[symbol].append((price, datetime.now()))
+
+ # Clear old data
+ for pair in list(prices_history.keys()):
+ if len(prices_history[pair]) > 1000:
+ prices_history[pair] = prices_history[pair][-1000:]
+
+ indicators = calculate_indicators(
+ prices_history, minutes_to_evaluate=5, hours_for_trend=4
+ )
+
+ variations = calculate_variation_and_trend(prices_history, minutes_to_evaluate=5, hours_for_trend=4)
+
+ any_signal = False
+
+ for pair, pair_indicators in indicators.items():
+ rsi_evaluation = pair_indicators["rsi_evaluation"]
+ rsi_trend = pair_indicators["rsi_trend"]
+ macd_evaluation = pair_indicators["macd_evaluation"]
+ macd_trend = pair_indicators["macd_trend"]
+ signal_evaluation = pair_indicators["signal_evaluation"]
+ signal_trend = pair_indicators["signal_trend"]
+ hist_evaluation = pair_indicators["hist_evaluation"]
+ hist_trend = pair_indicators["hist_trend"]
+
+ current_price = prices_history[pair][-1][0]
+ variation = ((current_price - prices_history[pair][0][0]) / prices_history[pair][0][0]) * 100
+
+ # Conditions for buy signal
+ if (
+ rsi_evaluation > 45
+ and macd_evaluation > signal_evaluation
+ and hist_evaluation > 0
+ and rsi_trend > 45
+ and macd_trend > signal_trend
+ and hist_trend > 0
+ and pair not in sold_pairs
+ and pair in variations
+ and variations[pair] > 2
+ ):
+ message = f"π’οΈ STRONG PUMP DETECTED π’οΈ\n\n𧧠${pair}\n\nπ Price: {current_price:.8f} $USDT\n\nπ Variation: {variation:.2f}%\n\nπββοΈ RSI, MACD, and Histogram indicate strong upward momentum\n\nπ This is an excellent buying opportunity!β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ sold_pairs[pair] = True
+ any_signal = True
+ # os.system("afplay /System/Library/Sounds/Ping.aiff")
+
+ # Conditions for sale sign
+ elif pair in sold_pairs and (
+ # -4% drop after buy signal
+ (rsi_evaluation > 90 and variation < -3)
+ # RSI high and MACD indicating fall
+ or (rsi_evaluation > 90 and macd_evaluation < signal_evaluation and macd_trend < signal_trend)
+ ):
+ message = f"π΄ MOMENTUM DUMPING BELOW π΄\n\n𧧠${pair}\n\nπ¦ Price: {current_price:.8f} $USDT\n\nπ Variation: {variation:.2f}%\n\nπββοΈ RSI, MACD, and Histogram indicate weakening upward momentum\n\nπ Consider selling to mitigate risk!β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ del sold_pairs[pair]
+ any_signal = True
+ # os.system("afplay /System/Library/Sounds/Glass.aiff")
+
+ if not any_signal and not monitoring_message_sent:
+ message = "π MONITORING FOR PUMP ENTRIES π\n\nπ Once an optimal wave pattern emerges\n\nπ You'll be instantly notified to ride the momentum...β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ monitoring_message_sent = True
+
+ else:
+ print("Error fetching market data.")
+
+ await asyncio.sleep(1)
+
+async def main():
+ donation_task = asyncio.create_task(send_donation_message())
+ monitor_task = asyncio.create_task(monitor_prices())
+ await asyncio.gather(donation_task, monitor_task)
+
+if __name__ == "__main__":
+ asyncio.run(main())
diff --git a/kucoin-pumpdump-crypto-alerts-telegram-bot-selected-usdt-pars.py b/kucoin-pumpdump-crypto-alerts-telegram-bot-selected-usdt-pars.py
new file mode 100644
index 0000000..a0a4ae3
--- /dev/null
+++ b/kucoin-pumpdump-crypto-alerts-telegram-bot-selected-usdt-pars.py
@@ -0,0 +1,435 @@
+import os
+from dotenv import load_dotenv
+import requests
+import time
+from datetime import datetime, timedelta
+import base64
+import hashlib
+import asyncio
+import hmac
+import telegram.error
+from telegram import Bot
+from telegram.error import RetryAfter
+import pandas as pd
+import pandas_ta as ta
+
+load_dotenv()
+
+# Settings
+TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
+CHANNEL_ID = os.getenv("CHANNEL_ID")
+API_KEY = os.getenv("API_KEY")
+API_SECRET = os.getenv("API_SECRET")
+API_PASSPHRASE = os.getenv("API_PASSPHRASE")
+API_IP = os.getenv("API_IP")
+
+bot = Bot(token=TELEGRAM_BOT_TOKEN)
+
+DESIRED_PAIRS = [
+ "1INCH-USDT",
+ "AAVE-USDT",
+ "ADA-USDT",
+ "AEVO-USDT",
+ "AGIX-USDT",
+ "AIOZ-USDT",
+ "ALICE-USDT",
+ "ALT-USDT",
+ "AMP-USDT",
+ "ANKR-USDT",
+ "APT-USDT",
+ "AR-USDT",
+ "ARB-USDT",
+ "ARPA-USDT",
+ "ASTR-USDT",
+ "ATOM-USDT",
+ "ATOR-USDT",
+ "AVAX-USDT",
+ "AXS-USDT",
+ "AZERO-USDT",
+ "BAT-USDT",
+ "BCH-USDT",
+ "BNB-USDT",
+ "BOME-USDT",
+ "BONK-USDT",
+ "BTC-USDT",
+ "CAKE-USDT",
+ "CELO-USDT",
+ "CHZ-USDT",
+ "CKB-USDT",
+ "COMP-USDT",
+ "CQT-USDT",
+ "CREAM-USDT",
+ "CWAR-USDT",
+ "DASH-USDT",
+ "DODO-USDT",
+ "DOGE-USDT",
+ "DOT-USDT",
+ "DUSK-USDT",
+ "ENA-USDT",
+ "ENJ-USDT",
+ "ENS-USDT",
+ "ETC-USDT",
+ "ETH-USDT",
+ "FET-USDT",
+ "FIL-USDT",
+ "FLOKI-USDT",
+ "FLOW-USDT",
+ "FLUX-USDT",
+ "FTM-USDT",
+ "GALA-USDT",
+ "GNO-USDT",
+ "GRT-USDT",
+ "GTAI-USDT",
+ "HBAR-USDT",
+ "HOPR-USDT",
+ "ICP-USDT",
+ "ICX-USDT",
+ "ILV-USDT",
+ "IMX-USDT",
+ "INJ-USDT",
+ "JASMY-USDT",
+ "JTO-USDT",
+ "JUP-USDT",
+ "KAS-USDT",
+ "KAVA-USDT",
+ "KCS-USDT",
+ "KUJI-USDT",
+ "LAI-USDT",
+ "LDO-USDT",
+ "LINK-USDT",
+ "LTC-USDT",
+ "LTO-USDT",
+ "MAGIC-USDT",
+ "MANA-USDT",
+ "MANTA-USDT",
+ "MASK-USDT",
+ "MATIC-USDT",
+ "MAVIA-USDT",
+ "METIS-USDT",
+ "MKR-USDT",
+ "MNT-USDT",
+ "MOVR-USDT",
+ "NEAR-USDT",
+ "NFP-USDT",
+ "NMR-USDT",
+ "NOIA-USDT",
+ "NUM-USDT",
+ "OCEAN-USDT",
+ "OGN-USDT",
+ "OGV-USDT",
+ "OM-USDT",
+ "ONDO-USDT",
+ "ONT-USDT",
+ "OP-USDT",
+ "ORAI-USDT",
+ "ORDI-USDT",
+ "OSMO-USDT",
+ "OXT-USDT",
+ "PENDLE-USDT",
+ "PEPE-USDT",
+ "PHA-USDT",
+ "PIXEL-USDT",
+ "POLC-USDT",
+ "POLYX-USDT",
+ "PRQ-USDT",
+ "PUNDIX-USDT",
+ "RAY-USDT",
+ "REN-USDT",
+ "RLC-USDT",
+ "RNDR-USDT",
+ "ROSE-USDT",
+ "SAND-USDT",
+ "SEI-USDT",
+ "SFP-USDT",
+ "SFUND-USDT",
+ "SHIB-USDT",
+ "SHILL-USDT",
+ "SNX-USDT",
+ "SOL-USDT",
+ "STORJ-USDT",
+ "STRK-USDT",
+ "STX-USDT",
+ "SUI-USDT",
+ "SUKU-USDT",
+ "SUSHI-USDT",
+ "SXP-USDT",
+ "T-USDT",
+ "TAO-USDT",
+ "THETA-USDT",
+ "TIA-USDT",
+ "TLM-USDT",
+ "TLOS-USDT",
+ "TNSR-USDT",
+ "TON-USDT",
+ "TRB-USDT",
+ "TRX-USDT",
+ "UNFI-USDT",
+ "UNI-USDT",
+ "VR-USDT",
+ "WAVES-USDT",
+ "WIF-USDT",
+ "WIN-USDT",
+ "WLD-USDT",
+ "WOO-USDT",
+ "XLM-USDT",
+ "XMR-USDT",
+ "YFI-USDT",
+ "YGG-USDT",
+ "ZEC-USDT"
+]
+
+def get_headers(method, request_path, body=""):
+ timestamp = str(int(time.time() * 1000))
+ str_to_sign = timestamp + method + request_path + (body if body else "")
+ signature = base64.b64encode(
+ hmac.new(
+ API_SECRET.encode("utf-8"), str_to_sign.encode("utf-8"), hashlib.sha256
+ ).digest()
+ ).decode("utf-8")
+ passphrase = base64.b64encode(
+ hmac.new(
+ API_SECRET.encode("utf-8"), API_PASSPHRASE.encode("utf-8"), hashlib.sha256
+ ).digest()
+ ).decode("utf-8")
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": timestamp,
+ "KC-API-KEY": API_KEY,
+ "KC-API-PASSPHRASE": passphrase,
+ "KC-API-KEY-VERSION": "2",
+ }
+ return headers
+
+def fetch_market_data():
+ url = "https://api.kucoin.com/api/v1/market/allTickers"
+ try:
+ response = requests.get(
+ url, headers=get_headers("GET", "/api/v1/market/allTickers")
+ )
+ response.raise_for_status()
+ return response.json()
+ except requests.RequestException as e:
+ bot.send_message(chat_id=CHANNEL_ID, text=f"Error fetching data: {e}")
+ print(f"Error fetching data: {e}")
+ return None
+ except Exception as e:
+ bot.send_message(chat_id=CHANNEL_ID, text=f"Unexpected error: {e}")
+ print(f"Unexpected error: {e}")
+ return None
+
+def calculate_indicators(prices_history, minutes_to_evaluate=15, hours_for_trend=4):
+ """
+ Calculates technical indicators for each pair of cryptocurrencies.
+ Returns a dictionary with the calculated indicators.
+ """
+ current_time = datetime.now()
+ indicators = {}
+
+ evaluation_period = minutes_to_evaluate
+ # Convert hours to minutes
+ trend_period = hours_for_trend * 60
+
+ for pair, prices in prices_history.items():
+ prices_df = pd.DataFrame(prices, columns=["price", "time"])
+ prices_df = prices_df.set_index("time")
+
+ # Filter prices for trial and trend periods
+ prices_evaluation = prices_df.loc[
+ current_time - timedelta(minutes=evaluation_period): current_time, "price"
+ ]
+ prices_trend = prices_df.loc[
+ current_time - timedelta(minutes=evaluation_period + trend_period): current_time, "price"
+ ]
+
+ if len(prices_evaluation) >= 1 and len(prices_trend) >= 1:
+ # Calculate technical indicators
+ rsi_evaluation = calculate_rsi(prices_evaluation)
+ rsi_trend = calculate_rsi(prices_trend)
+
+ macd_evaluation, signal_evaluation, hist_evaluation = calculate_macd(
+ prices_evaluation
+ )
+ macd_trend, signal_trend, hist_trend = calculate_macd(prices_trend)
+
+ indicators[pair] = {
+ "rsi_evaluation": rsi_evaluation,
+ "rsi_trend": rsi_trend,
+ "macd_evaluation": macd_evaluation,
+ "macd_trend": macd_trend,
+ "signal_evaluation": signal_evaluation,
+ "signal_trend": signal_trend,
+ "hist_evaluation": hist_evaluation,
+ "hist_trend": hist_trend,
+ }
+ else:
+ print(f"Error calculating indicators for {pair}")
+
+ return indicators
+
+def calculate_rsi(prices):
+ delta = prices.diff()
+ gain = (delta.where(delta > 0, 0)).mean()
+ loss = (-delta.where(delta < 0, 0)).mean()
+ if loss == 0:
+ return 100
+ rs = gain / loss
+ return 100 - (100 / (1 + rs))
+
+def calculate_ema(prices, window):
+ weights = pd.Series(1.0, index=prices.index)
+ weights /= weights.sum()
+ ema = prices.ewm(span=window, min_periods=window).mean()
+ return ema
+
+def calculate_macd(prices):
+ ema12 = calculate_ema(prices, 12)
+ ema26 = calculate_ema(prices, 26)
+ macd_line = ema12 - ema26
+ signal_line = calculate_ema(macd_line, 9)
+ histogram = macd_line - signal_line
+ return macd_line.iloc[-1], signal_line.iloc[-1], histogram.iloc[-1]
+
+async def send_telegram_message(chat_id, message):
+ try:
+ await bot.send_message(chat_id=chat_id, text=message, parse_mode="HTML")
+ except telegram.error.RetryAfter as e:
+ print(f"Flood control exceeded. Retrying in {e.retry_after} seconds.")
+ await asyncio.sleep(e.retry_after)
+ await send_telegram_message(chat_id, message)
+ except Exception as e:
+ print(f"Error sending Telegram message: {e}")
+ else:
+ await asyncio.sleep(1)
+
+# 60 minutes and 15 seconds
+async def send_donation_message(interval=60 * 60 + 15):
+ while True:
+ message = f"π Help us push the boundaries of AI-driven analysis! Your contributions fuel our relentless pursuit of innovative trading strategies:\n\nπ€² Every donation propels us forward.\n\n$USDT (TRC-20):\nTGpiWetnYK2VQpxNGPR27D9vfM6Mei5vNA\n\nπ«Ά Designed to help you.\nπ«Ά From AIs to human-beans.\n\nπΈ Version 2.0.1 (2024/06/29)β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ await asyncio.sleep(interval)
+
+def calculate_variation_and_trend(prices_history, minutes_to_evaluate=15, hours_for_trend=4):
+ current_time = datetime.now()
+ variations = {}
+
+ evaluation_period = minutes_to_evaluate
+ # Convert hours to minutes
+ trend_period = hours_for_trend * 60
+
+ for pair, prices in prices_history.items():
+ prices_in_evaluation_period = [(price, time) for price, time in prices if current_time - time <= timedelta(minutes=evaluation_period)]
+ trend_start_time = current_time - timedelta(minutes=(evaluation_period + trend_period))
+ prices_in_trend_period = [(price, time) for price, time in prices if trend_start_time <= time <= trend_start_time + timedelta(minutes=trend_period)]
+
+ if len(prices_in_evaluation_period) >= 1 and len(prices_in_trend_period) >= 1:
+ initial_price_evaluation = prices_in_evaluation_period[0][0]
+ final_price_evaluation = prices_in_evaluation_period[-1][0]
+ initial_price_trend = prices_in_trend_period[0][0]
+ final_price_trend = prices_in_trend_period[-1][0]
+
+ variation_evaluation = ((final_price_evaluation - initial_price_evaluation) / initial_price_evaluation) * 100
+ variation_trend = ((final_price_trend - initial_price_trend) / initial_price_trend) * 100
+
+ if variation_evaluation > 0 and variation_trend > 0:
+ variations[pair] = variation_evaluation
+
+ return variations
+
+async def monitor_prices():
+ prices_history = {}
+ last_indicators = {}
+ sold_pairs = {}
+ monitoring_message_sent = False
+
+ while True:
+ data = fetch_market_data()
+ if data:
+ tickers = data["data"]["ticker"]
+ for ticker in tickers:
+ symbol = ticker["symbol"]
+ if symbol in DESIRED_PAIRS:
+ last_price = ticker.get("last")
+ if last_price:
+ price = float(last_price)
+ if symbol not in prices_history:
+ prices_history[symbol] = []
+ prices_history[symbol].append((price, datetime.now()))
+
+ # Clear old data
+ for pair in list(prices_history.keys()):
+ if len(prices_history[pair]) > 1000:
+ prices_history[pair] = prices_history[pair][-1000:]
+
+ indicators = calculate_indicators(
+ prices_history, minutes_to_evaluate=15, hours_for_trend=4
+ )
+
+ variations = calculate_variation_and_trend(prices_history, minutes_to_evaluate=15, hours_for_trend=4)
+
+ any_signal = False
+
+ for pair, pair_indicators in indicators.items():
+ rsi_evaluation = pair_indicators["rsi_evaluation"]
+ rsi_trend = pair_indicators["rsi_trend"]
+ macd_evaluation = pair_indicators["macd_evaluation"]
+ macd_trend = pair_indicators["macd_trend"]
+ signal_evaluation = pair_indicators["signal_evaluation"]
+ signal_trend = pair_indicators["signal_trend"]
+ hist_evaluation = pair_indicators["hist_evaluation"]
+ hist_trend = pair_indicators["hist_trend"]
+
+ current_price = prices_history[pair][-1][0]
+ variation = ((current_price - prices_history[pair][0][0]) / prices_history[pair][0][0]) * 100
+
+ # Conditions for buy signal
+ if (
+ rsi_evaluation > 45
+ and macd_evaluation > signal_evaluation
+ and hist_evaluation > 0
+ and rsi_trend > 45
+ and macd_trend > signal_trend
+ and hist_trend > 0
+ and pair not in sold_pairs
+ and pair in variations
+ and variations[pair] > 2
+ ):
+ message = f"π’οΈ STRONG PUMP DETECTED π’οΈ\n\n𧧠${pair}\n\nπ Price: {current_price:.8f} $USDT\n\nπ Variation: {variation:.2f}%\n\nπββοΈ RSI, MACD, and Histogram indicate strong upward momentum\n\nπ This is an excellent buying opportunity!β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ sold_pairs[pair] = True
+ any_signal = True
+ # os.system("afplay /System/Library/Sounds/Ping.aiff")
+
+ # Conditions for sale sign
+ elif pair in sold_pairs and (
+ # -4% drop after buy signal
+ (rsi_evaluation > 90 and variation < -4)
+ # RSI high and MACD indicating fall
+ or (rsi_evaluation > 90 and macd_evaluation < signal_evaluation and macd_trend < signal_trend)
+ ):
+ message = f"π΄ MOMENTUM DUMPING BELOW π΄\n\n𧧠${pair}\n\nπ¦ Price: {current_price:.8f} $USDT\n\nπ Variation: {variation:.2f}%\n\nπββοΈ RSI, MACD, and Histogram indicate weakening upward momentum\n\nπ Consider selling to mitigate risk!β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ del sold_pairs[pair]
+ any_signal = True
+ # os.system("afplay /System/Library/Sounds/Glass.aiff")
+
+ if not any_signal and not monitoring_message_sent:
+ message = "π MONITORING FOR PUMP ENTRIES π\n\nπ Once an optimal wave pattern emerges\n\nπ You'll be instantly notified to ride the momentum...β "
+ print(message)
+ await send_telegram_message(CHANNEL_ID, message)
+ monitoring_message_sent = True
+
+ else:
+ print("Error fetching market data.")
+
+ await asyncio.sleep(1)
+
+async def main():
+ donation_task = asyncio.create_task(send_donation_message())
+ monitor_task = asyncio.create_task(monitor_prices())
+ await asyncio.gather(donation_task, monitor_task)
+
+if __name__ == "__main__":
+ asyncio.run(main())
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..cfa74ce
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,13 @@
+asyncio
+base64
+datetime
+hashlib
+hmac
+numpy
+os
+pandas
+pandas_ta
+python-dotenv
+python-telegram-bot
+requests
+time