-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemergencySellToEi.py
79 lines (67 loc) · 2.48 KB
/
emergencySellToEi.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
# -*- coding: utf-8 -*-
# import websocket
from apibutkib import BugKib
from pymongo import MongoClient
import logging
import sys
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.FileHandler("E:\LogBot\debug.log"),
logging.StreamHandler(sys.stdout)
]
)
bitkubToei = BugKib(_apiKey='APIKEY_BITKUB' ,_apisecret = b'APISECRET_BITKUB')
client = MongoClient('mongodbAddress',27017)
db = client.bitkub
APIKEYBITKUB='APIKEY_BITKUB'
bitkubTa = BugKib(_apiKey='APIKEY_BITKUB',_apisecret = b'APISECRET_BITKUB')
# allMoney = bitkubToei.getMyMoney()
# excludeEmergency = {'LUNA','LUNA2'}
# excludeProfit = {'LUNA','KUB','DOGE','ZIL','XLM'}
# lineOrderToken = 'LINENOTIFYTOKEN'
# lineSignalToken = 'LINENOTIFYTOKEN'
botActivateDb = db.botactivate
# # botActivateDb.update_one({'Instance': APIKEYBITKUB},
# # {'$set': {'Activate': False}
# # }
# # ,upsert=True
# # )
try:
botActivate = { "Instance": APIKEYBITKUB }
botActivateDoc = botActivateDb.find_one(botActivate)
if(botActivateDoc['Activate']==False):
logSave = {
"CASH": "bitkub.getMyMoney()",
"Asset": "BOT IS DEACTIVATE",
"Signal": "BOT IS DEACTIVATE",
"StochRSI": "BOT IS DEACTIVATE",
"AssetInTHB":"BOT IS DEACTIVATE",
"AvgBuyPrice":"BOT IS DEACTIVATE",
"CurrentPrice":"BOT IS DEACTIVATE",
"Available":"BOT IS DEACTIVATE",
"Reserved":"BOT IS DEACTIVATE",
"Profit":"BOT IS DEACTIVATE",
"ProfitGoal":"BOT IS DEACTIVATE",
# "LastUpdate": datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
}
# joblogDb[APIKEYBITKUB].insert_one(logSave)
botActivateDb.update_one({'Instance': APIKEYBITKUB},
{'$set': {'Activate': False}
}
,upsert=True
)
# bitkub.sendLine('Stop Loss No Bot DeActivaed',token=lineOrderToken)
abc = 'EXITED'
sys.exit("BOT IS DEACTIVATE")
except Exception as e:
abc= 'except : '+ str(e)
pass
adf = 'Running'
# botActivate = { "Instance": APIKEYBITKUB }
# botActivateDoc = botActivateDb.find_one(botActivate)
# a = botActivateDoc['Activate']
# # bitkub.emergencySell(excludeEmergency, lineOrderToken)
# TaMoney = bitkubTa.getMyMoney()
# ToeiMoney = bitkubToei.getMyMoney()