Hi Team, I've 3 accounts to send the order via API of r1XXXX5,r1XXXX7 and r1XXXX8. But only r1XXXX5 is work fine, the result message return "true". how can I do with another two account to send the order via API??
here is my code to run for these 3 account
import pythoncom import win32com.client # import pyodbc from time import sleep # Equity Order Entry Example # REDI.ORDER: Used to send equities and futures orders # REDI.OPTIONORDER: Used to send options orders # REDI.SPREAD: Used to create spreads (e.g. pairs trading) # REDI.TICKET: Used to create tickets (i.e. parent orders) # REDI.QUERY: Used to obtain order information (e.g. order status) # REDI.DONEAWAY: Doneaways are manual trade notifications (e.g. enter a doneaway to alert REDI of a trade done outside of REDI) # REDI.TFLIST: Lists, or baskets, represent groups of tickets. These can be sent to brokers in batches, or waves, using the REDI Portfolio Trader. # REDI.QUERY: Used to obtain order information (e.g. order status) o = win32com.client.Dispatch("REDI.ORDER")#,clsctx=pythoncom.CLSCTX_LOCAL_SERVER,userName="DEMO") # print("hello") def sendOrder1(): print('begin') side = 'Buy' # price = '43.33' quantity = '5' o.Side = side#'Sell'#'SBUX'# o.symbol = 'CLZ1' #'LCOZ1'# o.Quantity = quantity o.PriceType = 'Market'#'DEMOTEST'#'Limit''Limit'# #'Market' no need to place the Price # o.Price = price o.TIF = 'Day' o.Exchange = 'DEMF DMA'#'DEMF DMA'#'DEMO DMA'#'REDI Eq DMA (DEMO)'#'REDI Fut DMA'#'DEMO SHARES'##'DEMO DMA'#'DEMF'#'BETA DMA'#'REDI Fut DMA (DEMF)'#'DEMO DESK'#'DEMO DMA'#'IFCM'# o.Account = 'DEMO'#'TESTACCT'#'r154725'# o.Ticket = 'Direct'#'ByPass'#'DEMF SHARE'# # Prepare a variable which can handle returned values from submit method of the order print('send') msg = win32com.client.VARIANT(win32com.client.pythoncom.VT_BYREF | win32com.client.pythoncom.VT_VARIANT, None) # Send an options order result = o.Submit(msg) print(result) # ‘True’ if order submission was successful sendOrder1()