Покупка продажа

import ccxt
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

# Настройки
exchange_id = 'binance'
symbol = 'BTC/USDT'
large_trade_volume = 100 # Пороговый объем сделки для оповещения
email_from = 'your_email@example.com'
email_to = 'recipient_email@example.com'
smtp_server = 'smtp.example.com'
smtp_port = 587
smtp_username = 'your_smtp_username'
smtp_password = 'your_smtp_password'

# Инициализация биржи
exchange = getattr(ccxt, exchange_id)()

# Функция для отправки email
def send_email(subject, message):
msg = MIMEMultipart()
msg['From'] = email_from
msg['To'] = email_to
msg['Subject'] = subject

msg.attach(MIMEText(message, 'plain'))
server = smtplib.SMTP(smtp_server, smtp_port)
server.starttls()
server.login(smtp_username, smtp_password)
text = msg.as_string()
server.sendmail(email_from, email_to, text)
server.quit()

# Основная логика
def check_large_trades():
trades = exchange.fetch_trades(symbol)
for trade in trades:
if trade['amount'] >= large_trade_volume:
if trade['side'] == 'buy':
send_email('Buy Alert', f'Large buy trade detected: {trade}')
elif trade['side'] == 'sell':
send_email('Sell Alert', f'Large sell trade detected: {trade}')

# Запуск проверки в бесконечном цикле
import time
while True:
try:
check_large_trades()
time.sleep(60) # Проверка каждые 60 секунд
except Exception as e:
print(f'Error: {e}')
time.sleep(60)
Technical IndicatorsTrend Analysis

Отказ от ответственности