Exel VBA commands to place orders with IB

Hello,

I am trying to create a simple buy order through Excel API but can't manage to do so.

The sample excel of TWS has hundreds lines of code and tons of loops which are mostly irrelevant..

The basic code should be something like:

Symbol = "XOM"
Side = "BUY"
Quantity = 1000
Price = 110
PriceType = "LMT"
Exchange = "SMART"
TIF = "DAY"

submitorder

Can anyone please tell me the right codes that IB is using for a simple order like this?

Thanks!
 
The examples do work, but I want to use the script in my own custom excel sheet and there are tons of unneeded rows of code that I don't need.
 
I already found it all out, been busy the whole day and it's working. I narrowed about 1000 lines of code to these few lines.

Sub test()
Dim Id As Long

req = "buy_111_YHOO_STK_SMART_USD_MKT_{}_DAY_{}_{}_O_0_{}_1_{}_0_0_0_0_{}_0_0_{}_{}_{}_{}_{}_{}_{}_ISLAND'"

Id = Round((Date - 39000 + Time) * 1000000, 0)


ActiveCell.Value = "=droog914|ord!'id" & Id & "?place?" & req

End Sub
 
Back
Top