簡體   English   中英

使用IBrokers進行期權交易

[英]Using IBrokers for option trading

我可以將使用R(使用盈透證券股票交易 IBrokers API ),但我不能為期權交易做。

我將在此處發布示例代碼,也許社區中的某人可以提供幫助。

library('IBrokers')

tws <- twsConnect(port=7497)

orderid = reqIds( tws, numIds=1)
neworder = twsOrder( orderid, action='BUY', totalQuantity='4', orderType='LMT', lmtPrice='.1')
opt <- twsOption("AAPL",expiry="281707", strike="10.0", right="C")
placeOrder( tws, opt, neworder )

twsDisconnect(tws)

您沒有輸入正確的到期日期,請嘗試:

opt <- twsOption("AAPL", expiry="20180315", strike="170", right="C")

格式為yyyymmdd

暫無
暫無

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

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