VWAP orders with IbPy?

182 views
Skip to first unread message

George Battaglia

unread,
Nov 30, 2015, 1:25:56 PM11/30/15
to IbPy Discuss
Hello, 
I am trying to place a VWAP (Best efforts order), these are the parameters I am using, but I get the following error: I have tried changing all the variables and parameters but still get the same error.. does someone know what I am doing wrong or how to send the parameters correctly?

Thank you,

ERROR:

<error id=488914002, errorCode=512, errorMsg=Order Sending Error - 'list' object has no attribute 'm_tag'>
<connectionClosed>


conn.connect().... All ok to connect

listparams = [['maxPctVol', '0.5'],
['startTime', '9:00:00 EST'],
['endTime', '15:00:00 EST'],
['allowPastEndTime', '0'],
['noTakeLiq', '0']]

cont = Contract()
cont.m_symbol = "TSLA"
cont.m_secType = "STK"
cont.m_exchange = "SMART"
cont.m_primaryExch = "SMART"
cont.m_currency = "USD"

order = Order()
order.m_orderType = 'MKT'
order.m_totalQuantity =100
order.m_action = "BUY"

order.m_tif='DAY'
order.m_account=acct

order.m_algoParams = listparams
order.m_algoStrategy = "Vwap"

oid=order_counter

conn.placeOrder(oid,cont,order)

order_counter+=1

Alex Simma

unread,
Apr 10, 2016, 6:10:50 PM4/10/16
to IbPy Discuss
The list of m_algoParams shouldn't be a list of lists but rather a list of ib.ext.TagValue.

1read...@gmail.com

unread,
Sep 18, 2016, 3:43:11 PM9/18/16
to IbPy Discuss
Hi Alex Simma,

Thanks for your input on this. I do not understand your answer. Would you be able to elaborate on this and provide an example?

Kimble Young

unread,
Sep 21, 2016, 11:53:49 AM9/21/16
to IbPy Discuss
Had the same problem and found the answer by looking through the IBPy source code.

Example:

from ib.ext.TagValue import TagValue

#create order above

tagValue = TagValue()
tagValue.m_tag = "adaptivePriority"
tagValue.m_value = "Critical"

order.m_algoStrategy = 'Adaptive'
newOrder.m_algoParams = [tagValue]   #you can have a comma separated list of TagValue objects here.
Reply all
Reply to author
Forward
0 new messages