[R-SIG-Finance] IBrokers: combo contracts = spread contract ? (Solved)

omerle omerle at laposte.net
Thu Jun 7 13:45:40 CEST 2012


Dmaned, I wasn't watching in the right thing.
The twsBAG is indeed currently working but it doesn't display the order in the spread 
trader but in the API !

Sorry for loosing your time !


> Message du 07/06/12 13:11
> De : "omerle" 
> A : r-sig-finance at r-project.org
> Copie à : 
> Objet : [R-SIG-Finance] 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:
> 
> > Hi there,
> >
> > I am having some troubles with the use of the IBrokers package on my IB
> > paper account. I am trying to get market data and an order execution for a
> > combo contract, with no success in both cases. I wonder if anyone could
> > help. Here is the code I tried
> >
> >
> >
> > ibg <- ibgConnect()
> >
> >
> >
> > leg1 <- twsComboLeg( conId = "79265697",
> >
> > ratio = 1,
> >
> > action = "BUY",
> >
> > exchange = "SMART")
> >
> >
> >
> > leg2 <- twsComboLeg( conId = "79265687",
> >
> > ratio = 1,
> >
> > action = "SELL",
> >
> > exchange = "SMART")
> >
> >
> >
> > reqMktData(conn = ibg, Contract = twsBAG(leg1,leg2), tickGenerics = "",
> > tickerId = "1", snapshot = T)
> >
> >
> >
> > placeOrder(ibg, twsBAG(leg1,leg2), twsOrder(reqIds(ibg),"BUY",1,"MKT"))
> >
> >
> >
> > About the market data, I am not getting anything, even by setting snapshot
> > = F. As for the order, it is placed but never executed. Could it be a
> > problem with contract objects created by twsBAG ? Does anyone know how to
> > fix these issues ?
> >
> >
> >
> > Best regards,
> >
> > Alain
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > 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.
> _______________________________________________
> 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
> 
> _______________________________________________
> 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



More information about the R-SIG-Finance mailing list