Skip to content

CAN NOT GET CFD historicalData #3

@viponedream

Description

@viponedream

#!/usr/bin/env python

-- coding:utf-8 --

from ibpythonic import ibConnection, message
from ibapi.contract import Contract
from datetime import datetime , timedelta

! [cfdcontract]

contract = Contract()
contract.symbol = "IBDE30"
contract.secType = "CFD"
contract.currency = "EUR"
contract.exchange = "SMART"

! [cfdcontract]

def processHistoricalData(msg):
print(msg)
conn = ibConnection(port=4002, clientId=0)
conn.register(processHistoricalData, message.historicalData)
conn.connect()
conn.reqContractDetails(1, contract)
queryTime = datetime.today().strftime("%Y%m%d %H:%M:%S")
conn.reqHistoricalData(4101, contract, queryTime,"1 M", "1 day", "TRADES", 1, 1, False, [])

conn.disconnect()

==================================================
it says:
No historical market data for IBDE30/CFD@UKBBO Last 1d-

but the same contract use the offical api, it gets well.
can anyone help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions