I am able to fire buy/sell signal to create a order from python code to PI.
However when I do the same thing to fire modify/cancel request there are no alerts generated in PI.Here goes the code for modify
class PiBrdgHeader(Structure): _pack_ = 1 _fields_ = [ ('_checksum',c_short), ('_length',c_short), ('_msgType',c_short), ('_errorCode',c_int), ('_time',c_int)] class NPiBrdgOrder(Structure): _pack_ = 1 _fields_ = [ ('_header',PiBrdgHeader), ('_exchange', c_char*10), ('_trdSymbol', c_char*64), ('_piOrderId', c_char*20), ('_orderId', c_char*10), ('_strategyName', c_char*10), ('_side',c_short), ('_initQty',c_int), ('_disQty',c_int), ('_remQty',c_int), ('_lPrice',c_double), ('_triggerPrice',c_double), ('_totTradedValue',c_double), ('_lastTradePrice',c_double), ('_avgTradePrice',c_double), ('_tradedQuantity',c_int), ('_lastTradeQuantity',c_int), ('_orderType', c_char*12), ('_prodTypeStr', c_char*12), ('_ClientCode', c_char*12), ('_validity', c_char*5), ('_orderStatus',c_int), ('_entryTime',c_int), ('_execTime',c_int)] def modifyOrder(piOrderId): order = NPiBrdgOrder() order._header._checksum = 255 order._header._length = 243 order._header._msgType = 201 order._header._time = 0 order._piOrderId=piOrderId order._piOrderId.ljust(20,'\0') order._initQty = 1 # ( should be in lots) order._disQty = 1 # order._remQty = 1 # order._lPrice = 100 # price in INR order._triggerPrice = 10 order._orderStatus = 0 order._entryTime = 0 order._execTime = 0 return order def SendPktToServerOverTcpForModify(order): packed_data = ctypes.create_string_buffer(243) struct.pack_into('h',packed_data,0,order._header._checksum) struct.pack_into('h',packed_data,2,order._header._length) struct.pack_into('h',packed_data,4,order._header._msgType) struct.pack_into('I',packed_data,6,order._header._errorCode) struct.pack_into('I',packed_data,10,order._header._time) struct.pack_into('20s',packed_data,88,order._piOrderId) print >>sys.stderr, 'sending "%s"' % binascii.hexlify(packed_data) _clientSocket.sendall(packed_data) order=modifyOrder("160109000000484") response=SendPktToServerOverTcpForModify(order)
Where exactly am I going wrong can anyone point out?
Also since this alert is triggered by PI-id,would I be able to modify cover order by this?
Thanks