开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育
Date

Re: Pulling reqMktData for multiple tickers

 

Hunter, thank you so much. But I've got no idea what you just said to me haha. I am a prime example of a "shade tree" python mechanic. I got no idea how to build an alternator in a car, but I know where it goes haha. I'm trying to build this program for my buddy but I might just tell him that its over my head with multiple stocks that change amount each day. I can actually build this program with multiple stocks. IF.. they didnt change. OR.. IF the number amount didnt change. And I would just tell him... ok copy/paste the new stock name here, here, here, ect ect. But since one day it could be 1 stock, next day 7 stocks. I'm trying to make it so the program just reacts accordingly. I think it might be over my head right now.?


Re: Pulling reqMktData for multiple tickers

 

So what you want to do is to have a threadpool so that when you get ticks from the TCP socket, you can launch a task on that threadpool (the size of the pool should be the core count - 1 for the TCP socket's thread).? This is quite easy in the JVM languages, but you are out in Python land.? So you want to do something where you generate a Task on each tick and that task contains the ticker and tick pricing information.? The threadpool schedules that task, it is executed and in a synchronized way would do whatever action is necessary (make an order, etc).? Make sure to synchronize your access to IB and the TCP socket to take those actions to avoid synch bugs.

As a side note, I doubt this scheme is worthwhile.? The overhead of making the tasks is likely more than the CPU usage by your task.? Unless you are doing something very computational intensive in your tasks, the CPU would likely completely the work before a task could be created and executed.? IB is very slow, CPUs are very fast.

Hunter


On Wednesday, May 5, 2021, 11:02:06 AM PDT, Patrick C <zenfiretrading@...> wrote:


I'm not picking this method for any reason other then my mind cant figure out any other way to do it. LOL?

I'm trying to request tickTypes from multiple stocks that will change amount every day. Otherwise the easy way to do what I am doing is just this. Or the only way I know how to do what I am trying to do.?

app.reqMktData(1, usTechStk("SPY"), "", False, False, [])
app.reqMktData(2, usTechStk("AAPL"), "", False, False, [])
app.reqMktData(3, usTechStk("AMD"), "", False, False, [])

Ya know? Just copy and paste as neccessary, but I'm trying to make this program a little more elegant then that LOL. I was hoping I can just update my tickers list each morning and the program does the rest. Only change one line of a code if I have too, instead of having to copy/paste and change 10+ lines of code every morning. I've never built a program to handle multiple stocks at the same time. I only have experience with Futures.. and I have a individual program for each individual futures contract.



Re: Pulling reqMktData for multiple tickers

 

I'm not picking this method for any reason other then my mind cant figure out any other way to do it. LOL?

I'm trying to request tickTypes from multiple stocks that will change amount every day. Otherwise the easy way to do what I am doing is just this. Or the only way I know how to do what I am trying to do.?

app.reqMktData(1, usTechStk("SPY"), "", False, False, [])
app.reqMktData(2, usTechStk("AAPL"), "", False, False, [])
app.reqMktData(3, usTechStk("AMD"), "", False, False, [])

Ya know? Just copy and paste as neccessary, but I'm trying to make this program a little more elegant then that LOL. I was hoping I can just update my tickers list each morning and the program does the rest. Only change one line of a code if I have too, instead of having to copy/paste and change 10+ lines of code every morning. I've never built a program to handle multiple stocks at the same time. I only have experience with Futures.. and I have a individual program for each individual futures contract.



Re: Pulling reqMktData for multiple tickers

 

Hi Patric,

I have one thread and keep sequential thread IDs in DB as I corelate them to data received. The TCP socket is not asynchronous so I am not sure if your threading separately for each request doest anything because you still go through same TCP socket. It probably saves you some microsecond which might be significant if doing HFT. Otherwise, sending requests one after other should be fast too.? Callbacks keep receiving data in no order (out of our control) so again not sure if threading helps. So yeah, maybe you are over complicating.

^^^ I am talking in context of C++ and not Python.

I would be interested to hear a senior person defend your method as better as it may be somehow future proofing and something I am missing. Aha, if you will have multiple account support in future ;) this may help.

- Bruce


On Wed, May 5, 2021, 1:18 PM Patrick C <zenfiretrading@...> wrote:

Hey guys, what I am trying to perform is a reqMktData pull (I'm pulling the bid,ask,last prices) for multiple tickers. Normally I would just change the ID number for each ticker.. but for this specific program I am building. The ticker amounts are going to change each day. One day it could be 3 stocks, next day it could be 7.?

So I am trying to come up with a fancy way to "spin off" the reqMktData into its own threads so that can change by the input.?

What is happening is, that the threads spin off fine, but the reqMktData just keeps getting "replaced" by the next ticker in line in the function.?

Really what I need it to do is this

1) For ticker in tickers (the loop through). After we loop the first one. Stop the function and loop. And seal that up as the first thread.
2) Run the function again, for ticker in tickers (the loop) but we pick back up where we left off. Creates another ReqMktData in the 2nd thread. Stop the function and loop from continuing.
3) Function runs again, for ticker in tickers (the loop), and we once again pick back up where we left off. Creates another reqMktData in the 3rd thread. Stop the function and loop.

Since there is only 3 "tickercount" its all finished. Now I had 3 threads all running a reqMktData but each thread has a unique "tickerId" corresponding with each stock in the tickers list.?

Does that make sense? Am I just over complicating this? Here is the code for you to study. Its obviously not the whole program. Everything else in the program works fine.?

tickerId = 0
tickercount = 0

tickers = ["JG", "AAPL", "FB"]

def dataReturn(app):

? ? global tickerId

? ? for ticker in tickers:

? ? ? ? tickerId += 1

? ? ? ? app.reqMktData(tickerId, usTechStk(ticker), "", False, False, [])

? ? ? ? time.sleep(5) #Add some breathing room for testing

? ? ? ??

threads = []

for ticker in tickers:

? ? tickercount += 1

? ? ? ??

for _ in range(tickercount):

? ? t = threading.Thread(target=dataReturn, args=(app,))

? ? t.start()

?

? ? threads.append(t)


Re: Submit orders to TWS via API

 

Nich

Thanks for your reply...??
i am using the correct port for the live environment...? ?I am able to connect in live mode but it appears that order placed not getting confirmed in live like in demo! mode...i am connecting via TWS so was not?aware that i also needed to configure?the IB gateway but will give that a try too

regards
Ed


On Wed, May 5, 2021 at 6:13 PM Nich Overend <nich@...> wrote:

The basic things that I would check are:

?

Usually TWS has one port for paper (7497) and a different port for live (7496).

?

Also, in IB Gateway you have to set the account options to allow login and non-read-only access separately.

?

Nich

?

From: [email protected] <[email protected]> On Behalf Of Ed Bell via
Sent: 05 May 2021 18:09
To: [email protected]
Subject: [TWS API] Submit orders to TWS via API

?

Hi ,

I am attempting to use the piece of code (see below) to place orders to TWS.? ?it works fine executing the orders on the demo account with confirmation?from TWS as expected...? However when connected to live mode it does not execute successfully although connection to?TWS is confirmed..? The objective is to have this code running?continuously in the background executing trade files from a trade folder....

?

Not a python expert so excuse minor details!..? just concentrating on getting this to work in the live mode

?

Any help appreciated..? thanks

?

regards

ed

?

?

# ib_api_demo.py####

from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.opt import Connection, message
import sys
import time
import os
import os.path
import shutil
import _winapi
? ?

def error_handler(msg):
? ? """Handles the capturing of error messages"""
? ? print ("Server Error: %s" % msg)

def reply_handler(msg):
? ? """Handles of server replies"""
? ? print ("Server Response: %s, %s" % (msg.typeName, msg))


def nextValid(self, orderId):
? ? self.nextOrderId=orderId
? ? self.start()

def create_contract(symbol, sec_type, exch, prim_exch, curr):
? ? contract = Contract()
? ? contract.m_symbol = symbol
? ? contract.m_secType = sec_type
? ? contract.m_exchange = exch
? ? contract.m_primaryExch = prim_exch
? ? contract.m_currency = curr
? ? return contract

def create_order(order_type, quantity, action):
? ? """Create an Order object (Market/Limit) to go long/short.
?
? ? order_type - 'MKT', 'LMT' for Market or Limit orders
? ? quantity - Integral number of assets to order
? ? action - 'BUY' or 'SELL'"""
? ? order = Order()
? ? order.m_orderType = order_type
? ? order.m_totalQuantity = quantity
? ? order.m_action = action
? ? return order

def GetFileDetails():
? ? myList = []
? ? global my_path
? ? my_path = os.path.join('C:\\',
? ? ? ? ? ? ? ? ? ? ? trade_path,
? ? ? ? ? ? ? ? ? ? ? ? 'trade.txt')

? ? with open(my_path , "r") as file:
? ? ? ? first_line = file.readline()
? ?
? ? print(first_line)
? ? myList=first_line.split(',')
? ? return myList


? ?
? ? ? ?
contract_detail=[]
a=1


while True:
#if __name__ == "__main__":
? ? try:
? ? ? ? # Connect to the Trader Workstation (TWS) running on the
? ? ? ? # usual port of 7496, with a clientId of 100
? ? ? ? tws_conn = Connection.create(port=7496, clientId=100)
? ? ? ? tws_conn.connect()
? ? ? ? print ("connected!" + "\n")

? ? ? ? # Assign the error handling function defined above
? ? ? ? # to the TWS connection
? ? ? ? tws_conn.register(error_handler, 'Error')

? ? ? ? # Assign all of the server reply messages to the
? ? ? ? # reply_handler function defined above
? ? ? ? tws_conn.registerAll(reply_handler)

? ? ? ? contract_detail=GetFileDetails()


? ? ? ? # Create an order ID which is 'global' for this session. This
? ? ? ? # will need incrementing once new orders are submitted.
? ? ? ? order_id = contract_detail[9]
? ? ? ?

? ? ? ? # Create a contract in stock via SMART order routing
? ? ? ? eur_contract= create_contract(contract_detail[1], contract_detail[2], contract_detail[3], contract_detail[4], contract_detail[5])

? ? ? ? # Go long 100 shares of Google
? ? ? ? #aapl_order = create_order('MKT', 10, 'BUY')
? ? ? ? eur_order = create_order(contract_detail[6], contract_detail[7], contract_detail[8])

? ? ? ? # Use the connection to the send the order to IB
? ? ? ? tws_conn.placeOrder(order_id, eur_contract, eur_order)
? ? ? ?

? ? ? ? # Disconnect from TWS ? ? ? ? ? ? ? ? ?
? ? ? ? tws_conn.disconnect()

? ? ? ? print ("execution complete")

? ? ? ? os.rename(r'trade_folder\trade.txt',r'traded_folder\traded.txt')
? ? ? ? time.sleep(0.5)

? ? ? ?
? ?
? ? except: # catch *all* exceptions
? ? ? ? #e = sys.exc_info()[0]
? ? ? ? #print( "<p>Error: %s</p>" % e )
? ? ? ? print (file=sys.stderr)



? ? time.sleep(5)
? ? os.execv(sys.executable, ['python'] + sys.argv) #re-execute script!!!




? ??


Pulling reqMktData for multiple tickers

 

Hey guys, what I am trying to perform is a reqMktData pull (I'm pulling the bid,ask,last prices) for multiple tickers. Normally I would just change the ID number for each ticker.. but for this specific program I am building. The ticker amounts are going to change each day. One day it could be 3 stocks, next day it could be 7.?

So I am trying to come up with a fancy way to "spin off" the reqMktData into its own threads so that can change by the input.?

What is happening is, that the threads spin off fine, but the reqMktData just keeps getting "replaced" by the next ticker in line in the function.?

Really what I need it to do is this

1) For ticker in tickers (the loop through). After we loop the first one. Stop the function and loop. And seal that up as the first thread.
2) Run the function again, for ticker in tickers (the loop) but we pick back up where we left off. Creates another ReqMktData in the 2nd thread. Stop the function and loop from continuing.
3) Function runs again, for ticker in tickers (the loop), and we once again pick back up where we left off. Creates another reqMktData in the 3rd thread. Stop the function and loop.

Since there is only 3 "tickercount" its all finished. Now I had 3 threads all running a reqMktData but each thread has a unique "tickerId" corresponding with each stock in the tickers list.?

Does that make sense? Am I just over complicating this? Here is the code for you to study. Its obviously not the whole program. Everything else in the program works fine.?

tickerId = 0
tickercount = 0

tickers = ["JG", "AAPL", "FB"]

def dataReturn(app):

? ? global tickerId

? ? for ticker in tickers:

? ? ? ? tickerId += 1

? ? ? ? app.reqMktData(tickerId, usTechStk(ticker), "", False, False, [])

? ? ? ? time.sleep(5) #Add some breathing room for testing

? ? ? ??

threads = []

for ticker in tickers:

? ? tickercount += 1

? ? ? ??

for _ in range(tickercount):

? ? t = threading.Thread(target=dataReturn, args=(app,))

? ? t.start()

?

? ? threads.append(t)


Re: Submit orders to TWS via API

 

开云体育

The basic things that I would check are:

?

Usually TWS has one port for paper (7497) and a different port for live (7496).

?

Also, in IB Gateway you have to set the account options to allow login and non-read-only access separately.

?

Nich

?

From: [email protected] <[email protected]> On Behalf Of Ed Bell via groups.io
Sent: 05 May 2021 18:09
To: [email protected]
Subject: [TWS API] Submit orders to TWS via API

?

Hi ,

I am attempting to use the piece of code (see below) to place orders to TWS.? ?it works fine executing the orders on the demo account with confirmation?from TWS as expected...? However when connected to live mode it does not execute successfully although connection to?TWS is confirmed..? The objective is to have this code running?continuously in the background executing trade files from a trade folder....

?

Not a python expert so excuse minor details!..? just concentrating on getting this to work in the live mode

?

Any help appreciated..? thanks

?

regards

ed

?

?

# ib_api_demo.py####

from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.opt import Connection, message
import sys
import time
import os
import os.path
import shutil
import _winapi
? ?

def error_handler(msg):
? ? """Handles the capturing of error messages"""
? ? print ("Server Error: %s" % msg)

def reply_handler(msg):
? ? """Handles of server replies"""
? ? print ("Server Response: %s, %s" % (msg.typeName, msg))


def nextValid(self, orderId):
? ? self.nextOrderId=orderId
? ? self.start()

def create_contract(symbol, sec_type, exch, prim_exch, curr):
? ? contract = Contract()
? ? contract.m_symbol = symbol
? ? contract.m_secType = sec_type
? ? contract.m_exchange = exch
? ? contract.m_primaryExch = prim_exch
? ? contract.m_currency = curr
? ? return contract

def create_order(order_type, quantity, action):
? ? """Create an Order object (Market/Limit) to go long/short.
?
? ? order_type - 'MKT', 'LMT' for Market or Limit orders
? ? quantity - Integral number of assets to order
? ? action - 'BUY' or 'SELL'"""
? ? order = Order()
? ? order.m_orderType = order_type
? ? order.m_totalQuantity = quantity
? ? order.m_action = action
? ? return order

def GetFileDetails():
? ? myList = []
? ? global my_path
? ? my_path = os.path.join('C:\\',
? ? ? ? ? ? ? ? ? ? ? trade_path,
? ? ? ? ? ? ? ? ? ? ? ? 'trade.txt')

? ? with open(my_path , "r") as file:
? ? ? ? first_line = file.readline()
? ?
? ? print(first_line)
? ? myList=first_line.split(',')
? ? return myList


? ?
? ? ? ?
contract_detail=[]
a=1


while True:
#if __name__ == "__main__":
? ? try:
? ? ? ? # Connect to the Trader Workstation (TWS) running on the
? ? ? ? # usual port of 7496, with a clientId of 100
? ? ? ? tws_conn = Connection.create(port=7496, clientId=100)
? ? ? ? tws_conn.connect()
? ? ? ? print ("connected!" + "\n")

? ? ? ? # Assign the error handling function defined above
? ? ? ? # to the TWS connection
? ? ? ? tws_conn.register(error_handler, 'Error')

? ? ? ? # Assign all of the server reply messages to the
? ? ? ? # reply_handler function defined above
? ? ? ? tws_conn.registerAll(reply_handler)

? ? ? ? contract_detail=GetFileDetails()


? ? ? ? # Create an order ID which is 'global' for this session. This
? ? ? ? # will need incrementing once new orders are submitted.
? ? ? ? order_id = contract_detail[9]
? ? ? ?

? ? ? ? # Create a contract in stock via SMART order routing
? ? ? ? eur_contract= create_contract(contract_detail[1], contract_detail[2], contract_detail[3], contract_detail[4], contract_detail[5])

? ? ? ? # Go long 100 shares of Google
? ? ? ? #aapl_order = create_order('MKT', 10, 'BUY')
? ? ? ? eur_order = create_order(contract_detail[6], contract_detail[7], contract_detail[8])

? ? ? ? # Use the connection to the send the order to IB
? ? ? ? tws_conn.placeOrder(order_id, eur_contract, eur_order)
? ? ? ?

? ? ? ? # Disconnect from TWS ? ? ? ? ? ? ? ? ?
? ? ? ? tws_conn.disconnect()

? ? ? ? print ("execution complete")

? ? ? ? os.rename(r'trade_folder\trade.txt',r'traded_folder\traded.txt')
? ? ? ? time.sleep(0.5)

? ? ? ?
? ?
? ? except: # catch *all* exceptions
? ? ? ? #e = sys.exc_info()[0]
? ? ? ? #print( "<p>Error: %s</p>" % e )
? ? ? ? print (file=sys.stderr)



? ? time.sleep(5)
? ? os.execv(sys.executable, ['python'] + sys.argv) #re-execute script!!!




? ??


Submit orders to TWS via API

 

Hi ,
I am attempting to use the piece of code (see below) to place orders to TWS.? ?it works fine executing the orders on the demo account with confirmation?from TWS as expected...? However when connected to live mode it does not execute successfully although connection to?TWS is confirmed..? The objective is to have this code running?continuously in the background executing trade files from a trade folder....

Not a python expert so excuse minor details!..? just concentrating on getting this to work in the live mode

Any help appreciated..? thanks

regards
ed


# ib_api_demo.py####

from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.opt import Connection, message
import sys
import time
import os
import os.path
import shutil
import _winapi
? ?

def error_handler(msg):
? ? """Handles the capturing of error messages"""
? ? print ("Server Error: %s" % msg)

def reply_handler(msg):
? ? """Handles of server replies"""
? ? print ("Server Response: %s, %s" % (msg.typeName, msg))


def nextValid(self, orderId):
? ? self.nextOrderId=orderId
? ? self.start()

def create_contract(symbol, sec_type, exch, prim_exch, curr):
? ? contract = Contract()
? ? contract.m_symbol = symbol
? ? contract.m_secType = sec_type
? ? contract.m_exchange = exch
? ? contract.m_primaryExch = prim_exch
? ? contract.m_currency = curr
? ? return contract

def create_order(order_type, quantity, action):
? ? """Create an Order object (Market/Limit) to go long/short.
?
? ? order_type - 'MKT', 'LMT' for Market or Limit orders
? ? quantity - Integral number of assets to order
? ? action - 'BUY' or 'SELL'"""
? ? order = Order()
? ? order.m_orderType = order_type
? ? order.m_totalQuantity = quantity
? ? order.m_action = action
? ? return order

def GetFileDetails():
? ? myList = []
? ? global my_path
? ? my_path = os.path.join('C:\\',
? ? ? ? ? ? ? ? ? ? ? trade_path,
? ? ? ? ? ? ? ? ? ? ? ? 'trade.txt')

? ? with open(my_path , "r") as file:
? ? ? ? first_line = file.readline()
? ?
? ? print(first_line)
? ? myList=first_line.split(',')
? ? return myList


? ?
? ? ? ?
contract_detail=[]
a=1


while True:
#if __name__ == "__main__":
? ? try:
? ? ? ? # Connect to the Trader Workstation (TWS) running on the
? ? ? ? # usual port of 7496, with a clientId of 100
? ? ? ? tws_conn = Connection.create(port=7496, clientId=100)
? ? ? ? tws_conn.connect()
? ? ? ? print ("connected!" + "\n")

? ? ? ? # Assign the error handling function defined above
? ? ? ? # to the TWS connection
? ? ? ? tws_conn.register(error_handler, 'Error')

? ? ? ? # Assign all of the server reply messages to the
? ? ? ? # reply_handler function defined above
? ? ? ? tws_conn.registerAll(reply_handler)

? ? ? ? contract_detail=GetFileDetails()


? ? ? ? # Create an order ID which is 'global' for this session. This
? ? ? ? # will need incrementing once new orders are submitted.
? ? ? ? order_id = contract_detail[9]
? ? ? ?

? ? ? ? # Create a contract in stock via SMART order routing
? ? ? ? eur_contract= create_contract(contract_detail[1], contract_detail[2], contract_detail[3], contract_detail[4], contract_detail[5])

? ? ? ? # Go long 100 shares of Google
? ? ? ? #aapl_order = create_order('MKT', 10, 'BUY')
? ? ? ? eur_order = create_order(contract_detail[6], contract_detail[7], contract_detail[8])

? ? ? ? # Use the connection to the send the order to IB
? ? ? ? tws_conn.placeOrder(order_id, eur_contract, eur_order)
? ? ? ?

? ? ? ? # Disconnect from TWS ? ? ? ? ? ? ? ? ?
? ? ? ? tws_conn.disconnect()

? ? ? ? print ("execution complete")

? ? ? ? os.rename(r'trade_folder\trade.txt',r'traded_folder\traded.txt')
? ? ? ? time.sleep(0.5)

? ? ? ?
? ?
? ? except: # catch *all* exceptions
? ? ? ? #e = sys.exc_info()[0]
? ? ? ? #print( "<p>Error: %s</p>" % e )
? ? ? ? print (file=sys.stderr)



? ? time.sleep(5)
? ? os.execv(sys.executable, ['python'] + sys.argv) #re-execute script!!!




? ??


Re: TWS API earning dates..

 

No, you can not. A free alternative (although not perfect) is the Yahoo API.


Re: TWS API earning dates..

 

Thank you! Cani get the upcoming earnings data from IBKR API without wallstreet Horizon?subscription?


Re: options order

Pankaj Agarwal
 

In your order code object specify transmit as false.

It will show in TWS but not send it to exchange.

Hope it helps.

Thanks,

Pankaj Agarwal


On Sun, May 2, 2021 at 10:58 AM <moshe.peled@...> wrote:
Is there a way to create the order through the API and the confirmation through the IB workstation?


Re: options order

 

开云体育

So you want to create an order that does not execute, then view in TWS ?? Then what ?


options order

 

Is there a way to create the order through the API and the confirmation through the IB workstation?


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

On Fri, Apr 30, 2021 at 07:47 PM, Ace wrote:
Are there other major quirks of the paper trading I should be aware of?
In fairness, it's likely one of the best paper systems out there these days.? I just seem to have a nack for finding it's flaws.? Often where permissions from the prod account don't map the same to the paper one.? Family account permissions, and Volatility/leveraged eft trading auth were recent troubles.? Had troubles last week with short term VWAP orders where the orders were canceled instead of filled if they were small (100 shares) with a short duration (1 minute).? I'm also often using Prime accounts, which is likely a small subset of the overall account base.? Helps with market data lines (+30k is typical), but some bits are less polished than other vendors in the Prime world.??

-Peter


Re: TWS API earning dates..

 

Hi,

?

with Wall Street Horizon subscription, reqFundamentalData(reqId:10000001, Contract:<XOM>, FundamentalType.CalendarReport) gives:

<?xml version="1.0" ?>

<WSHData>

<Company>

<Name>Exxon Mobil Corp.</Name>

<Ticker>XOM</Ticker>

<ISIN>US30231G1022</ISIN>

<Exchange>NYSE</Exchange>

<Country>USA</Country>

<conid>177017693</conid>

<conid>38708363</conid>

<conid>242506913</conid>

<conid>13977</conid>

<conid>12973868</conid>

<EarningsList>

<Earnings>

<Q1>4/30/2021</Q1>

<Q2>7/31/2020</Q2>

<Q3>10/30/2020</Q3>

<TimeZone>EST</TimeZone>

<Q4>2/2/2021</Q4>

<Period>Q1</Period>

<Time>Before Market</Time>

<Etype>Completed</Etype>

<Date>4/30/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</Earnings>

</EarningsList>

<EarningsCallList>

<EarningsCall>

<TimeZone>EST</TimeZone>

<GotoBroadcast>http://mmm.wallstreethorizon.com/u.asp?u=379567</GotoBroadcast>

<Time>9:30 AM</Time>

<Date>4/30/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</EarningsCall>

</EarningsCallList>

<EarningsCallTranscriptList>

<EarningsCallTranscript>

<TimeZone>EST</TimeZone>

<Period>Q1 2021</Period>

<URL>https://seekingalpha.com/article/4422992-exxon-mobil-corporation-xom-ceo-darren-woods-on-q1-2021-results-earnings-call-transcript?utm_source=wallstreethorizon.com&amp;utm_medium=referral</URL>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</EarningsCallTranscript>

</EarningsCallTranscriptList>

<ShareHolderMeetingList>

<ShareHolderMeeting>

<Type>S</Type>

<TimeZone>EST</TimeZone>

<Date>5/26/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</ShareHolderMeeting>

</ShareHolderMeetingList>

</Company>

</WSHData>

?


Re: TWS API earning dates..

 

hi Robbo , I tried the same, not getting results, Do I need WSJ subs? I tried it with that too. but not getting

<Annual endMonth="12" fYear="2021" fyNum="0" periodLength="12" periodUnit="MNS">
<Interim endCalYear="2021" endMonth="3" periodLength="3" periodNum="1" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="6" periodLength="3" periodNum="2" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="9" periodLength="3" periodNum="3" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="12" periodLength="3" periodNum="4" periodUnit="MNS" type="Q"/>
?


Re: The 'EtradeOnly' order attribute is not supported.

Nick
 

开云体育

If TWS allows a connection from your version of the API then the attributes themselves are supported. It's particular values of the attributes that are no longer accepted so setting to False is the right thing to do.


On 4/30/2021 3:55 PM, neil@... wrote:

This is untested, but since the two attributes are unsupported, I feel comfortable just setting them to False when I create the order object.
```
order_object = self.create_order(order)
order_object.eTradeOnly = False
order_object.firmQuoteOnly = False
```
The error messages went away.


Re: The 'EtradeOnly' order attribute is not supported.

 

This is untested, but since the two attributes are unsupported, I feel comfortable just setting them to False when I create the order object.
```
order_object = self.create_order(order)
order_object.eTradeOnly = False
order_object.firmQuoteOnly = False
```
The error messages went away.


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

开云体育

Ace, my experience of the paper-trading system, which I actively use all day every trading day, would lead me to suggest that it's unlikely that what you describe indicates a flaw in the system. My bet would be that there's something you've overlooked in your program.

?

As a ?general suggestion, I'd say that if you cannot prove from your logs that your position was exactly what you think it was and that your closing order was for exactly that quantity, then you're probably not logging enough information.

?

And if you can prove it from your logs, then you should raise it with IB because I'm quite certain that they'd be keen to know of such a flaw.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Ace
Sent: 30 April 2021 18:48
To: [email protected]
Subject: Re: [TWS API] Long on the stock, want to exit but: Order rejected The contract is not available for short sale

?

Hi Peter,

I found the paper trading testing of algo to be pretty good...up to now.

Are there other major quirks of the paper trading I should be aware of?

Thank you


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

Hi Peter,

I found the paper trading testing of algo to be pretty good...up to now.

Are there other major quirks of the paper trading I should be aware of?

Thank you