OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Get historical futures data on VIX using TWS API

  • Thread starter Thread starter marios christofides
  • Start date Start date
M

marios christofides

Guest
When I specify this expired futures contract and the reqHistoricalData function, i am getting the results as expected:

Code:
contract = Contract()
contract.symbol = "VIX"
contract.secType = "FUT"
contract.exchange = "CFE"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20240515"
contract.multiplier = "1000"
contract.includeExpired = True

I use the below to get past history:

Code:
app.reqHistoricalData(1, contract, "", "2 M", "1 day", "BID_ASK", 0, 1, False, [])

Then, i try to get past history of another expired contract. The only change is this:

Code:
contract.lastTradeDateOrContractMonth = "20240320"

I am then receiving the below error:

"ERROR 1 162 Historical Market Data Service error message:HMDS query returned no data: VXH4@CFE Bid"

I tried all contracts that are not expired, and my quote always returns the data. But when i use expired contracts, some of them work, and some of them aren't.

Can someone please suggest a solution?

Many thanks.
<p>When I specify this expired futures contract and the reqHistoricalData function, i am getting the results as expected:</p>
<pre><code>contract = Contract()
contract.symbol = "VIX"
contract.secType = "FUT"
contract.exchange = "CFE"
contract.currency = "USD"
contract.lastTradeDateOrContractMonth = "20240515"
contract.multiplier = "1000"
contract.includeExpired = True
</code></pre>
<p>I use the below to get past history:</p>
<pre><code>app.reqHistoricalData(1, contract, "", "2 M", "1 day", "BID_ASK", 0, 1, False, [])
</code></pre>
<p>Then, i try to get past history of another expired contract. The only change is this:</p>
<pre><code>contract.lastTradeDateOrContractMonth = "20240320"
</code></pre>
<p>I am then receiving the below error:</p>
<p>"ERROR 1 162 Historical Market Data Service error message:HMDS query returned no data: VXH4@CFE Bid"</p>
<p>I tried all contracts that are not expired, and my quote always returns the data. But when i use expired contracts, some of them work, and some of them aren't.</p>
<p>Can someone please suggest a solution?</p>
<p>Many thanks.</p>
 

Latest posts

ن
Replies
0
Views
1
نعمان منذر محمود الجميلي
ن
Top