Files
playbook/skills/tsl-api-reference/references/codegen/dotnet/trading/server_events.md
T
csh 13be5ea0aa feat(tsl-api-reference): index class and unit APIs
Migrate reference pages to declaration-line storage and rebuild the
13-column index.

Add qualified member lookup plus regression and end-to-end coverage.
2026-07-29 15:47:46 +08:00

4.8 KiB

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

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

声明:function

订购消息。

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

返回:any

getGlobalData(name)

声明:function

取全局数据。

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

返回:any

listEvents()

声明:function

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

返回:array

listGlobalData()

声明:function

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

返回:array

removeEvent(msg_identy)

声明:function

取消消息钩子。

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

返回:any

removeGlobalData(name)

声明:function

删除全局数据。

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

返回:bool

scheduleEvent(call_out_time, identy, code, user_id)

声明:function

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

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

返回:any

sendEvent(msg_type, id_list, value)

声明:function

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

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

返回:bool

setGlobalData(name, value)

声明:function

设置全局数据。

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

返回:array

timerEvent(call_out_time, identy, code, user_id)

声明:function

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

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

返回:any