0

Backtrader works fine with live data of IB (Interactive Brokers) through TWS, but when I want to trade on gold commodity (XAUUSD), it cannot receive the data. the python code is:

data = store.getdata(dataname='XAUUSD', sectype='CMDTY', exchange='SMART', timeframe=bt.TimeFrame.Minutes)

I follow the instruction in: enter image description here

1 Answers1

0

Spot Gold (symbol XAUUSD) is a commodities product offered by IB to trade gold in the OTC London metals market.

Most probably you want to trade CFD with the same symbol. In this case use sectype='CFD' and exchange='IBCFD'

Yuri Ginsburg
  • 2,302
  • 2
  • 13
  • 16
  • Thanks @yuri-ginsburg, but I considered IB api details for gold commodity in: interactivebrokers.github.io/tws-api/basic_contracts.html – Amir Alikhani Feb 19 '22 at 08:54
  • I edited the question by adding the IB broker picture for details of the XAUUSD commodity. – Amir Alikhani Feb 21 '22 at 05:28
  • I saw this picture. Also I can see quotes for both `XAUUSD` contracts `CMDTY` and `CFD` in my TWS, but API request returns an empty list. – Yuri Ginsburg Feb 21 '22 at 22:25