## 原型

```python
ContextInfo.schedule_run( func:Callable, time_point:Union[dt.datetime, str], repeat_times:int=0, interval:datetime.timedelta=None, name:str='' )
```

## 释义

ContextInfo.schedule_run 是 QMT 内置 Python 中用于设置定时器的接口。

研究：官方目录未明确；回测：官方目录未明确；模拟：官方目录未明确；实盘：官方目录未明确。

## 参数

| 参数 | 是否必填 | 官方原始定义 |
|---|---:|---|
| `func` | 是 | func:Callable |
| `time_point` | 是 | time_point:Union[dt.datetime, str] |
| `repeat_times` | 否 | repeat_times:int=0 |
| `interval` | 否 | interval:datetime.timedelta=None |
| `name` | 否 | name:str='' |

## 返回值

int类型，表示本次调用后生成的定时任务号，可用于取消本次定时任务，全局唯一不重复

## 示例

```python
python

import datetime as dt

def on_timer(C:ContextInfo):

print('hello world')

def init(ContextInfo):

tid=ContextInfo.schedule_run(on_timer,'20231231235959',-1,dt.timedelta(minutes=1),'my_timer')

def handlebar(ContextInfo):

pass

#此例为自2023-12-31 23:59:59后每60s运行一次on_timer
```

## 详细说明

说明

该函数是新版设置定时器函数，相比旧版run_time，新版schedule_run新增了任务分组,任务取消等多种功能
