掘金社区

MyStrategy类中OnSchedule函数如果调用其他自定义类的实例,且这个类同时也继承Strategy,则定时器功能会停摆的BUGPinned highlighted

梁子哥哥 发表在问题反馈 2019-08-16 00:57:24

问题反馈
343
2
0

C#语言,定时器函数OnSchedule中调用的自定义类,此类同时也继承掘金SDK中的Strategy母类,此时即便OnSchedule函数中只是实例化此类(不调用任何该类的函数),定时器就会停摆(也就是说OnSchedule只会执行一次,后面的定时器任务全部不会执行):

`namespace DefaultAccountTransaction
{
public class MyStrategy : Strategy
{
public MyStrategy(string token, string strategyId, StrategyMode mode) : base(token, strategyId, mode) { }

    //重写OnInit事件,进行策略开发
    public override void OnInit()
    {
        System.Console.WriteLine("OnInit");
        Schedule("1d", "0:44:02");
        Schedule("1d", "0:45:02");
        return;
    }

    public override void OnSchedule(string dataRule, string timeRule)
    {
        JudgeTime judgeTime = new JudgeTime();
    }`

`namespace DefaultAccountTransaction
{
public class JudgeTime:Strategy
{

}

}`

评论: 2

Looks like your connection to 掘金量化社区 - 量化交易者的策略交流学习社区 was lost, please wait while we try to reconnect.