-
Notifications
You must be signed in to change notification settings - Fork 1
/
botfutuer.py
110 lines (92 loc) · 2.99 KB
/
botfutuer.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import os
import time
import datetime
###################### BinanceAPI ######################
import functionsLibraryfutures
import stra
#################### Discord Logger ####################
# from discord_logger import DiscordLogger
from discord_logger import DiscordLogger
from datetime import datetime, timedelta, timezone
######################## dotenv ########################
import dotenv
from dotenv import load_dotenv
from dotenv import dotenv_values
load_dotenv()
##################### Variables ########################
Symbol = os.getenv("Symbol")
moneyCount = os.getenv("tradingBalance")
TpTargetPercents = os.getenv("TpTargetPercent")
StpTargetPercents = os.getenv("StpTargetPercent")
(
checkbelow,
checkabove,
lastClosePrice,
StpTargetPercent,
TpTargetPercent,
) = stra.trend5MG()
timestamp = int(datetime.today().timestamp() * 1000)
def OrderLogger():
logger = DiscordLogger(
webhook_url="https://discord.com/api/webhooks/851193561839173652/OdB2ZcEUxvxLXyZE-Gvmt0tKbqD91aFD4RteSxtUlcjDlwRR2WHKN_ZaU6_60MOrUzLM",
**LoggerOptions,
)
logger.construct(
title="Buy Order",
description=f" trend up , time {datetime.utcnow()} ",
)
response = logger.send()
optionsstarted = {
"application_name": "Binance Bot",
"service_name": "Status",
"service_icon_url": "https://cryptologos.cc/logos/binance-coin-bnb-logo.png",
"display_hostname": False,
"default_level": "default",
}
#################### Logger Options ####################
LoggerOptions = {
"application_name": "Binance Bot",
"service_name": "Bot Logger",
"service_icon_url": "https://cryptologos.cc/logos/binance-coin-bnb-logo.png",
"display_hostname": False,
"default_level": "info",
}
#################### Start Logger ####################
logger = DiscordLogger(
webhook_url="https://discord.com/api/webhooks/851193561839173652/OdB2ZcEUxvxLXyZE-Gvmt0tKbqD91aFD4RteSxtUlcjDlwRR2WHKN_ZaU6_60MOrUzLM",
**optionsstarted,
)
logger.construct(title="Status Check", description="Bot Started!")
response = logger.send()
for x in range(500):
while True:
(
checkbelow,
checkabove,
lastClosePrice,
StpTargetPercent,
TpTargetPercent,
) = stra.trend5MG()
trenddirection, new, sort = stra.MoveAverage()
if (
checkabove == True
and checkbelow == False
and trenddirection == True
and new == True
and sort == True
):
OrderLogger()
trade = functionsLibraryfutures.trade(
symbol=Symbol,
moneyCount=moneyCount,
TpTargetPercent=TpTargetPercents,
StpTargetPercent=StpTargetPercents,
timestamp=timestamp,
)
print(trade)
if trade == True:
time.sleep(300)
else:
time.sleep(1)
print("trend waiting")
time.sleep(1)