本文整理汇总了Python中bot.Bot.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Bot.stop方法的具体用法?Python Bot.stop怎么用?Python Bot.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bot.Bot
的用法示例。
在下文中一共展示了Bot.stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [as 别名]
import yaml
import asyncio
import logging
from bot import Bot
if __name__ == '__main__':
with open('config.yml', 'r') as yml_file:
config = yaml.load(yml_file)
# logging.basicConfig(level=logging.DEBUG)
event_loop = asyncio.get_event_loop()
bot = Bot(event_loop, config)
try:
event_loop.run_until_complete(bot.run())
except KeyboardInterrupt:
event_loop.run_until_complete(bot.stop())
示例2: Bot
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [as 别名]
import time
from bot import Bot
import settings
import defaults
################
## DEFAULT BOT ## (You can create multiple bots with different settings)
################
bot = Bot(defaults.algorithm, defaults.pair)
bot.start()
print bot._trade
bot.stop()
print bot._trade
示例3: main
# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [as 别名]
def main():
DIR = os.path.join(os.path.dirname(__file__), "botTest")
TOCKEN_PATH = os.path.join(DIR, "token")
LOGGING_PATH = os.path.join(os.path.join(os.path.dirname(__file__), "logs"), "config.json")
PRIVATE_KEY_PATH = os.path.join(DIR, "private.key")
PUBLIC_KEY_PATH = os.path.join(DIR, "public.pem")
purge, webhook_url, install = parse()
if install != None:
if not os.path.exists(DIR):
os.mkdir(DIR)
with open(TOCKEN_PATH, "w") as f:
f.write(install + "\n")
print("End installing")
return
if os.path.exists(LOGGING_PATH):
with open(LOGGING_PATH, "rt") as f:
config = json.load(f)
logging.config.dictConfig(config)
else:
logging.basicConfig(level=logging.DEBUG)
with open(TOCKEN_PATH, "r") as f:
token = f.readline()[:-1]
bot = Bot(token, DIR)
if purge:
bot.purge()
return
server = None
if webhook_url:
if not os.path.exists(PUBLIC_KEY_PATH):
print("No public key, please run ssl.sh before !")
return
if not os.path.exists(PRIVATE_KEY_PATH):
print("No private key, please run ssl.sh before !")
return
server = WebHookServer(bot, PUBLIC_KEY_PATH, PRIVATE_KEY_PATH, webhook_url)
else:
server = PollingServer(bot)
print("### Start bot...")
bot.start()
print("### Bot started")
print("### Start server...")
server.start()
print("### Server started")
try:
while True:
time.sleep(60 * 60)
except KeyboardInterrupt:
pass
print("### Stop server...")
server.stop()
print("### Server stopped")
print("### Stop bot...")
bot.stop()
print("### Bot stopped")
print("### Join server...")
server.join()
print("### Server joined")
print("### Join bot...")
bot.join()
print("### Bot joined")
print("### End of main")