NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import time
import requests
from telegram.ext import Updater, CommandHandler, ConversationHandler

updater = Updater(token='5914092544:AAGGiL3crIpwAq9NM1O4pLm6xFAmCxOzlYQ', use_context=True)
dispatcher = updater.dispatcher

conv_handler = ConversationHandler(
entry_points=[CommandHandler('add', add)],
states={
COIN: [MessageHandler(Filters.text & ~Filters.command, coin)],
POSITION: [MessageHandler(Filters.text & ~Filters.command, position)],
TARGETS: [MessageHandler(Filters.text & ~Filters.command & ~Filters.regex('^(/next|/done)$'), targets)],
},
fallbacks=[MessageHandler(Filters.regex('^/next$'), targets),
MessageHandler(Filters.regex('^/done$'), done)]
)

dispatcher.add_handler(conv_handler)


def check_price(bot, job):
# CoinMarketCap API'sine istek gönderilerek mevcut fiyatlar alınır.
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest'
parameters = {'symbol': 'COIN_SYMBOL'} # COIN_SYMBOL, takip edilecek kripto para biriminin sembolü<dür.
headers = {'X-CMC_PRO_API_KEY': 'dff4002e-6fe3-47c7-8f35-729eda49cdc3'} # API_ANAHTARI, CoinMarketCap API anahtarınızı içerir.

response = requests.get(url, headers=headers, params=parameters)
data = response.json()

current_price = data['data']['COIN_SYMBOL']['quote']['USD']['price'] # COIN_SYMBOL, mevcut fiyatların alınacağı semboldür.
job = job_queue.run_repeating(check_price, interval=300, context=-1001623261422, name='check_price_job')

from telegram.ext import ConversationHandler

COIN, POSITION, TARGETS = range(3)

def add(update, context):
update.message.reply_text('Coinin adını girin:')
return COIN

def coin(update, context):
context.user_data['coin'] = update.message.text
update.message.reply_text('Pozisyonunuzu girin:')
return POSITION

def position(update, context):
context.user_data['position'] = update.message.text
context.user_data['targets'] = []
update.message.reply_text('Hedeflerinizi sırayla girin, her hedefi girdikten sonra /next komutunu kullanın.')
return TARGETS

def targets(update, context):
context.user_data['targets'].append(update.message.text)
update.message.reply_text('Bir sonraki hedefi girin veya /done komutunu kullanarak tamamlayın.')
return TARGETS

def done(update, context):
# Kullanıcının girdiği bilgileri alın
coin = context.user_data['coin']
position = context.user_data['position']
targets = context.user_data['targets']

# Mesajı oluşturun ve gruba gönderin
message = f'Coin: {coin}nPozisyon: {position}nHedefler:n' + 'n'.join(targets)
context.bot.send_message(chat_id=update.message.chat_id, text=message)

# Kullanıcı verilerini temizleyin
context.user_data.clear()

return ConversationHandler.END


# Hedef fiyatlar belirlenir ve kontrol edilir.
target_prices = [10, 20, 30] # Hedef fiyatların listesi.
for i, target_price in enumerate(target_prices):
if current_price >= target_price:
chat_id = job.context
message_text = f"Hedef {i+1} gerçekleşti! 🚀"
bot.send_message(chat_id=chat_id, text=message_text)

updater = Updater(token='5914092544:AAGGiL3crIpwAq9NM1O4pLm6xFAmCxOzlYQ')
job_queue = updater.job_queue

# Hedef fiyatları kontrol eden işlev, belirtilen aralıklarla çalıştırılır.
job = job_queue.run_repeating(check_price, interval=300, context=-1001623261422, name='check_price_job')

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.