Type/to search
6
Follow
0
Followers
Comment obtenir l'heure actuelle pendant le backtesting
Help
Created 2021-12-07 08:07:53  
 4
 1076

Ma stratégie est d'ouvrir une position en fonction du temps. En plus d'extraire de getrecords pour obtenir le temps de retour à ce moment-là, y a-t-il un meilleur moyen pratique d'obtenir le temps de retour actuel ? J'ai trouvé que la fonction de temps de la datetime est toujours le temps actuel et ne peut pas obtenir le temps historique.

Related Recommendations
Comment
All comments (4)

    用的Python策略么 ?可以用_D()获取当前时间。
    或者用 time.time()获取时间戳。

    5 years ago

    img img img

    梦老师,你看我这个测试代码,时间的确显示成过去的时间了,但为啥不随着函数调用往前推移呢?我设置的可是30分钟的粒度,不应该按30分钟向前推移时间吗?

    5 years ago

    这问题很简单,思考下就明白。你的while主循环里没有任何耗时操作,程序瞬间循环几百次, 所以时间都一样。你在while循环里加个Sleep(1000) 试试。
    另外K线周期和这个无关,建议先看下FMZ平台教程, 回测机制相关的帖子。

    5 years ago

    收到,谢谢!

    5 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)