Can get live data from IB but can't trade or get position
-
By referencing the sample code ibtest.py, I can get live data from IB. However, I try to place a buy order throught the paper account, but can't make the trade successfully. I also can't get the position.
I got the following order information. It's ordered with market price. However, I tried other limited price order but failed as well. Could anyone give me some hints/suggestions? Thank you.
-------------------------------------------------- ORDER BEGIN 2021-02-10 23:15:15.729882
Ref: 28
OrdType: 0
OrdType: Buy
Status: 1
Status: Submitted
Size: 1
Price: None
Price Limit: None
TrailAmount: None
TrailPercent: None
ExecType: 0
ExecType: Market
CommInfo: None
End of Session: 737831.6666666665
Info: AutoOrderedDict()
Broker: None
Alive: True
-------------------------------------------------- ORDER END
-------------------------------------------------- ORDER BEGIN 2021-02-10 23:15:15.732300
Ref: 28
OrdType: 0
OrdType: Buy
Status: 7
Status: Margin
Size: 1
Price: None
Price Limit: None
TrailAmount: None
TrailPercent: None
ExecType: 0
ExecType: Market
CommInfo: None
End of Session: 737831.6666666665
Info: AutoOrderedDict()
Broker: None
Alive: False
-------------------------------------------------- ORDER END -
@adrianyuen Seems there is a margin issue : "Status: Margin"
See :
https://www.backtrader.com/docu/order/#order-status-valuesDo you have enough cash on the paper account ?
Do you use the store model (https://www.backtrader.com/docu/live/ib/ib/)