Skip to content
Prev 10329 / 15274 Next

IBrokers: combo contracts = spread contract ?

Hi,

In mail below, I understand that twsBAG isn't a real contract and that there is no quotes 
for twsBAG.
I thought that twsBAG could allow us to make spread trade like in the spread trader (you 
can find the spread trader in trading tools). 
And as far as I know, there is specific quotes for spreads. 

1 - Can I use twsBAG to make spread trade ?

2 - If answer to 1 is yes, could you tell me what is the wrong in the following code :

(I try to make a spread trader between futures)
tws <- twsConnect(1)
orderID <- reqIds(tws) # orderID <- "125"
id1="83617918" # Futures ECO AUG12
id2="87689647" # Futures ECO NOV12
leg1=twsComboLeg(id1, ratio = 1, action = "BUY",exchange = "MATIF") #"SMART")
leg2=twsComboLeg(id2, ratio = 1, action = "SELL",exchange = "MATIF") #"SMART")
order <- twsOrder(orderID, action="BUY", totalQuantity="1", orderType= "LMT",lmtPrice = 
"-5")
bag <- twsContract(conId=as.real(orderID), symbol="ECO", sectype="BAG", "MATIF", 
"", expiry="", strike="0.0","EUR", cv1$right, local="", 
"50", combo_legs_desc=NULL, comboleg=list(leg1,leg2), 
include_expired="0", secIdType = "", secId = "") 
IBrokers::.placeOrder(tws,Contract=bag,Order=order)

Thanks a lot,

placeOrder/resAllOpenOrders is now working on my paper account following your advices on 
IBrokers version !

________________________________________________________

I don't think I've tried this, so I may be wrong, but twsBAG isn't a real
contract, it is for the order itself. Therefore you can't get mktData on
it.

Additionally, snapshot= isn't in the documentation for reqMktData.

Read the docs,and then see if you can get further along. It (API and
IBrokers) is intentionally tricky to prevent wide-spread self-inflicted
harm And 'paper account' is a good step...

Best,
Jeff
On 5/17/12 12:03 PM, "Alain Burt" wrote:

            
_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.


Une messagerie gratuite, garantie ? vie et des services en plus, ?a vous tente ?
Je cr?e ma bo?te mail www.laposte.net