import timefrom handleconfig import ConfigStockfrom dingding import Dingfrom stock import Stockfrom condition import Conditiondef send_waring(stock_message):"""发送报警信息:param config文件中股票的配置名称::return:"""hight, low, stock_num = stock_messagestock = Stock(stock_num)current_stock, current_price = stock.get_current()if '股票代码错误' in current_stock:message = '股票 {} ,请输入正确股票代码!'.format(current_stock)elif current_price > hight:message = '股票 {} ,现价为{},大于卖出阀值{},可以卖出'.format(current_stock, current_price, hight)elif current_price < low:message = '股票 {} ,现价为{},小于买入阀值{},可以买入'.format(current_stock, current_price, low)return messageif __name__ == '__main__':config = ConfigStock()while True:message = config.config_message('stock')webhook = config.dingding_config('dingding')ding = Ding(webhook)condition = Condition()stock_deal = condition.stock_deal()if stock_deal == 1:message = send_waring(message)ding.send(message)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。