-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtelebot_aio.py
81 lines (64 loc) · 2.31 KB
/
telebot_aio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import time
import config
from aiogram import Bot, Dispatcher, executor
API_TOKEN = '746132186:AAFaInEvPk3iZGvzQIYMpGV4CsHRyqg8CwE'
chat_id = '768693322'
PROXY_URL = 'http://127.0.0.1:7890'
# bot = Bot(token=API_TOKEN, proxy=PROXY_URL) if config.isLocal else Bot(token=API_TOKEN)
# dp = Dispatcher(bot)
def inst_bot(func):
def wrapper(*args, **kw):
bot = Bot(token=API_TOKEN, proxy=PROXY_URL) if config.isLocal else Bot(token=API_TOKEN)
dp = Dispatcher(bot)
func(dp, bot, *args, **kw)
return wrapper
async def send_message(bot, text):
await bot.send_message(chat_id=chat_id, text=text)
@inst_bot
def send_start(dp, bot):
executor.start(dp, send_message(bot, text='START PRINTING NOW' + '\n'))
@inst_bot
def send_pnl(dp, bot, pnl, price):
message = "PNL: " + pnl + '\n' + 'PRICE: ' + price
executor.start(dp, send_message(bot, text=message))
@inst_bot
def send_place_order(dp, bot, trend, execQty, avgPrice):
message = "PLACED: " + trend + '\n' +\
'QTY: ' + execQty + '\n' +\
'PRICE: ' + avgPrice
executor.start(dp, send_message(bot, text=message))
@inst_bot
def send_float_order(dp, bot, trend, execQty, avgPrice):
message = "CONTINUE: " + trend + '\n' +\
'TOTAL QTY: ' + execQty + '\n' + \
'PRICE: ' + avgPrice
executor.start(dp, send_message(bot, text=message))
@inst_bot
def send_any_msg(dp, bot, msg):
message = msg
executor.start(dp, send_message(bot, text=message))
if __name__ == '__main__':
# executor.start(dp, send_message())
# time.sleep(5)
# bot = Bot(token=API_TOKEN, proxy=PROXY_URL) if config.isLocal else Bot(token=API_TOKEN)
# dp = Dispatcher(bot)
# executor.start(dp, send_message())
# send_pnl(pnl='100.5%', price='8551')
# time.sleep(2)
# send_place_order(trend='LONG', execQty='1000', avgPrice='8556.9')
# time.sleep(2)
# send_float_order(trend='LONG', execQty='1000', avgPrice='8556.9')
# time.sleep(2)
# send_any_msg(msg='END NOW')
while 1:
a = 1
if a == 1 or 2:
print("fuck")
else:
print('you')
time.sleep(2)
a = 3
if a == 1 or 2:
print("fuck")
else:
print('you')