簡體   English   中英

IBrokers 中的 reqHistoricalData 是否有從和到參數?

[英]Is there a from and a to argument for reqHistoricalData in IBrokers?

如何獲取具有確切開始和結束日期的歷史數據? 它只有一個“持續時間”參數:

df <- reqHistoricalData(tws, Contract=contract, barSize = "1 day", duration = "2 M")

我可以做類似的事情嗎:

df <- reqHistoricalData(tws, Contract=contract, barSize = "1 day", from="2020-01-01", to="2020-02-01")

否。如果您願意,可以編寫一個 function 來執行此操作並計算持續時間,然后只需調用 api function。請注意,它必須舍入持續時間,因為只允許某些文本值。

http://interactivebrokers.github.io/tws-api/historical_bars.html#hd_duration

還要確保它在限制范圍內

https://interactivebrokers.github.io/tws-api/historical_limitations.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM