Files
playbook/skills/tsl-api-reference/references/codegen/dotnet/trading/server_events.md
T
csh e1f7ce052c feat(skills): add tsl api reference skill
Bundle the TSL API index and markdown references under the skill, route TSL docs to use it, and update the codegen index generator to maintain the bundled data.
2026-07-07 16:36:15 +08:00

4.6 KiB

算法交易 / 算法交易服务器支撑事件函数

addEvent(msg_type, msg_identy, code, id_list, user_id)

订购消息。

参数 类型 说明
msg_type string 字符串类型,可自定义的消息类别。
msg_identy string 字符串类型。本次订购的标识,必需唯一。该标识会被用于取消订购等函数。
code string 字符串类型,消息回调执行的一段代码。例如”EventCallBackSample(1);”
id_list array 订购的ID列表。例如订购多个行情更新消息,可采用ID列表代表更新的股票代码。
user_id string 执行代码的时候所用函数所处的用户。

返回:any

getGlobalData(name)

取全局数据。

参数 类型 说明
name string 字符串,全局数据的名称。

返回:any

listEvents()

获得当前设置的事件信息表。

返回:array

listGlobalData()

获得当前的全局数据信息列表。

返回:array

removeEvent(msg_identy)

取消消息钩子。

参数 类型 说明
msg_identy string 字符串类型,要取消的消息订购标识。

返回:any

removeGlobalData(name)

删除全局数据。

参数 类型 说明
name string 字符串,全局数据的名称。

返回:bool

scheduleEvent(call_out_time, identy, code, user_id)

调度事件。 备注:TimerEvent与ScheduleEvent的差异的ScheduleEvent只做一次,做完会自动取消,而TimerEvent则会不断间隔做。

参数 类型 说明
call_out_time datetime 整数,毫秒数,指定的毫秒数之后运行指定代码。
identy string 字符串类型。本次订购的标识,必需唯一。该标识会被用于取消订购等函数。
code string 字符串类型,消息回调执行的一段代码。例如”EventCallBackSample(1);”
user_id string 执行代码的时候所用函数所处的用户。

返回:any

sendEvent(msg_type, id_list, value)

给消息队列发送事件,如果成功则返回真。

参数 类型 说明
msg_type string 字符串类型,可自定义的消息类别。
id_list array 发送的ID列表。例如多个行情更新消息,可采用ID列表代表更新的股票代码。
value any 发送的消息内容,任意类型。

返回:bool

setGlobalData(name, value)

设置全局数据。

参数 类型 说明
name string 字符串,全局数据的名称。
value any 全局数据的内容。

返回:array

timerEvent(call_out_time, identy, code, user_id)

定时器事件。 备注:TimerEvent与ScheduleEvent的差异的ScheduleEvent只做一次,做完会自动取消,而TimerEvent则会不断间隔做。

参数 类型 说明
call_out_time datetime 整数,毫秒数,指定的毫秒数间隔不断运行指定代码。
identy string 字符串类型。本次订购的标识,必需唯一。该标识会被用于取消订购等函数。
code string 字符串类型,消息回调执行的一段代码。例如”EventCallBackSample(1);”
user_id string 执行代码的时候所用函数所处的用户。

返回:any