用钉钉机器人可以实现python 交易软件发送 交易信息的功能
description
然后我想在vnpy 中实现,就在策略里面写了一个函数,结果发现并不能

def send_dingding_msg(self,content):
        """发送钉钉消息,id填上使用的机器人的id"""
        robot_id = "16b133b679c3a1a7772d59285c684233afd1a37b4b24cd7905152a4989e31e6"
        try:
            msg = {
                "msgtype": "text",
                "text": {"content": content + '\n 时间:' + datetime.now().strftime("%m-%d %H:%M:%S") }}
            headers = {"Content-Type": "application/json;charset=utf-8"}
            url = 'https://oapi.dingtalk.com/robot/send?access_token=' + robot_id
            body = json.dumps(msg)
            requests.post(url, data=body, headers=headers)
            # print('成功发送钉钉')
        except Exception as e:
            print("发送钉钉失败:", e)

类似这样
description

看来是我想简单了。请问各位大佬下,如果要增加这个功能,我应该把函数写在哪?