我需要程式每天早上9點才進場,並且需要跨夜監控夜盤,也就是時間09:00~隔天早上05:00,請問這段時間限制,要怎麼寫成語法?有相關網夜可以參考嗎?感恩^^
請問如何限制期貨在每天早上9點才進場並且夜盤跨夜
- 201
- 最後發表 KevinLi 2022 四月 17
黑蛇
發文於
2022/03/27
condition1=time>0900 and time<1345
condition2=time>1500 and time < 2359
condition3=time>0000 and time <0500
XQ小幫手
發文於
2022/03/31
Hello KevinLi,
您可以參考 黑蛇 的回覆。
其中 condition1 代表 09:00 到 13:45,condition2 和 condition3 代表夜盤的部分。
須注意時間為6碼數字,所以應該為:
condition1=time >= 090000 and time <= 134500;
condition2=time >= 150000 and time <= 235900;
condition3=time >= 000000 and time <= 050000;
if condition1 or condition2 or condition3 then ...;
如果您要用電腦時間的話,time可以置換成currenttime。
另外一種作法是反向思考,因為您只有 08:45 到 09:00 這段時間不交易,所以也可以寫成:
condition1 = time >= 084500 and time <= 090000;
if not condition1 then ...;
感謝 黑蛇 的熱心回覆。
KevinLi
發文於
2022/04/17
感謝黑蛇和小幫手的回覆^^,目前此問題已經解決,還是有其他問題需要處理^^",感謝大家的解惑~~
3 評論