gpt4 book ai didi

matlab - 从盈透证券获取 future 合约列表

转载 作者:行者123 更新时间:2023-12-04 17:55:14 25 4
gpt4 key购买 nike

我如何使用 Matlab 从 Interactive Broker 的 API 获取特定 future 代码的单个合约列表(根据到期日)?例如,通过提供“ES”的合约符号,我想要一份 IB 拥有的 ES 合约列表(而不仅仅是前端合约)。

这个问题has been answered for python (请参阅线程中的第二个答案),但我正在寻找 Matlab 解决方案。

最佳答案

如果您使用 IB-Matlab连接器,那么答案很简单。例如,要获取在 12/2018 到期的所有 future 期权 (FOP) 调用方合约的列表:

>> data = IBMatlab('action','contract', 'symbol','ES', 'secType','FOP', 'exchange','GLOBEX', 'expiry','201812', 'right','Call')
data =
567×1 struct array with fields:
m_conId
m_symbol
m_secType
m_expiry
m_strike
m_right
m_multiplier
m_exchange
m_currency
m_localSymbol
m_primaryExch
m_includeExpired
m_secIdType
m_secId
...

>> data(1)
ans =
struct with fields:
m_conId: 300287365
m_symbol: 'ES'
m_secType: 'FOP'
m_expiry: '20181221'
m_strike: 1100
m_right: 'C'
m_multiplier: '50'
m_exchange: 'GLOBEX'
m_currency: 'USD'
m_localSymbol: 'ESZ8 C1100'
m_primaryExch: []
m_includeExpired: 0
m_secIdType: []
m_secId: []
m_comboLegsDescrip: []
m_comboLegs: [0 java.util.Vector]
m_underComp: []
m_summary: [1×1 com.ib.client.Contract]
m_marketName: 'ES'
m_tradingClass: 'ES'
m_minTick: 0.05
m_priceMagnifier: 1
m_orderTypes: 'ACTIVETIM,ADJUST,ALERT,ALLOC,AVGCOST,BASKET,COND,CONDORDER,DAY,DEACT,DEACTDIS,DEACTEOD,GAT,GTC,GTD,GTT,HID,IOC,LIT,LMT,LTH,MIT,MKT,MTL,NGCOMB,NONALGO,OCA,SCALE,SCALERST,SNAPMID,SNAPMKT,SNAPREL,STP,STPLMT,TRAIL,TRAILLIT,TRAILLMT,TRAILMIT,VOLAT,WHATIF'
m_validExchanges: 'GLOBEX'
m_underConId: 289128563
m_longName: 'E-mini S&P 500'
m_contractMonth: '201812'
m_industry: []
m_category: []
m_subcategory: []
m_timeZoneId: 'CST'
m_tradingHours: ';20180729:1700-20180730:1515;20180730:1530-20180730:1600;20180730:1700-20180731:1515;20180731:1530-20180731:1600;20180731:1700-20180801:1515;20180801:1530-20180801:1600;20180801:1700-20180802:1515;20180802:1530-20180802:1600;20180802:1700-20180803:1515;20180803:1530-20180803:1600;20180804:CLOSED;20180805:1700-20180806:1515;20180806:1530-20180806:1600;20180806:1700-20180807:1515;20180807:1530-20180807:1600;20180807:1700-20180808:1515;20180808:1530-20180808:1600;20180808:1700-20180809:1515;20180809:1530-20180809:1600;20180809:1700-20180810:1515;20180810:1530-20180810:1600;20180811:CLOSED;20180812:1700-20180813:1515;20180813:1530-20180813:1600;20180813:1700-20180814:1515;20180814:1530-20180814:1600;20180814:1700-20180815:1515;20180815:1530-20180815:1600;20180815:1700-20180816:1515;20180816:1530-20180816:1600;20180816:1700-20180817:1515;20180817:1530-20180817:1600;20180818:CLOSED;20180819:1700-20180820:1515;20180820:1530-20180820:1600;20180820:1700-20180821:1515;20180821:1530-20180821:1600;20180821:1700-20180822:1515;20180822:1530-20180822:1600;20180822:1700-20180823:1515;20180823:1530-20180823:1600;20180823:1700-20180824:1515;20180824:1530-20180824:1600;20180825:CLOSED;20180826:1700-20180827:1515;20180827:1530-20180827:1600;20180827:1700-20180828:1515;20180828:1530-20180828:1600;20180828:1700-20180829:1515;20180829:1530-20180829:1600;20180829:1700-20180830:1515;20180830:1530-20180830:1600;20180830:1700-20180831:1515;20180831:1530-20180831:1600;20180901:CLOSED'
m_liquidHours: '20180729:CLOSED;20180730:0830-20180730:1515;20180730:1530-20180730:1600;20180731:0830-20180731:1515;20180731:1530-20180731:1600;20180801:0830-20180801:1515;20180801:1530-20180801:1600;20180802:0830-20180802:1515;20180802:1530-20180802:1600;20180803:0830-20180803:1515;20180803:1530-20180803:1600;20180804:CLOSED;20180805:CLOSED;20180806:0830-20180806:1515;20180806:1530-20180806:1600;20180807:0830-20180807:1515;20180807:1530-20180807:1600;20180808:0830-20180808:1515;20180808:1530-20180808:1600;20180809:0830-20180809:1515;20180809:1530-20180809:1600;20180810:0830-20180810:1515;20180810:1530-20180810:1600;20180811:CLOSED;20180812:CLOSED;20180813:0830-20180813:1515;20180813:1530-20180813:1600;20180814:0830-20180814:1515;20180814:1530-20180814:1600;20180815:0830-20180815:1515;20180815:1530-20180815:1600;20180816:0830-20180816:1515;20180816:1530-20180816:1600;20180817:0830-20180817:1515;20180817:1530-20180817:1600;20180818:CLOSED;20180819:CLOSED;20180820:0830-20180820:1515;20180820:1530-20180820:1600;20180821:0830-20180821:1515;20180821:1530-20180821:1600;20180822:0830-20180822:1515;20180822:1530-20180822:1600;20180823:0830-20180823:1515;20180823:1530-20180823:1600;20180824:0830-20180824:1515;20180824:1530-20180824:1600;20180825:CLOSED;20180826:CLOSED;20180827:0830-20180827:1515;20180827:1530-20180827:1600;20180828:0830-20180828:1515;20180828:1530-20180828:1600;20180829:0830-20180829:1515;20180829:1530-20180829:1600;20180830:0830-20180830:1515;20180830:1530-20180830:1600;20180831:0830-20180831:1515;20180831:1530-20180831:1600;20180901:CLOSED'
...

注意:您可以删除 expiry 和/或 right 参数以获得更大的列表,但请注意您可能需要等待相当长的时间并且得到成千上万的结果,所以最好过滤结果。也可以使用strike参数进行过滤。

关于matlab - 从盈透证券获取 future 合约列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40700219/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com