Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Twsapi
- Messages
Search
Re: the fields commission, max/min Commission in openOrder state are broken
the max_int, min_int, max_float, min_float values mean ¡°no value¡± in the API, similar to NaN in numpy. If an exact commission is returned, you wouldn¡¯t expect to also receive a commission range, so those fields are used as placeholders.?
|
Collection of Historical Data
I'm working in pulling down a significant set of 1 min price data from the API using the following code:
The code works well.? I put a wrapper around this code and run the app on a single symbol with start and end date windows once every 15 secs or so and I can collect the data I need over time.? There's only one gotcha.? Occasionally, a historical stock listing won't be available via the "SMART" exchange.? When this happens the app hangs and loses its connection to IB and my looping stops.?? I'm looking for some work arounds here.? Can I do a reqContractDetails to understand which exchange my stock is listed on?? How can I access this information (the exchange associated with a particular stock) in advance so I'm not asking for invalid info? Another possibility is to be able to catch this error some how and have a second try with a different exchange value (e.g. "ISLAND").? This is a little tricky since I'm running the code above at arm's length with os.system but I'm open to suggestions about how to modify the original code or my wrapper code to catch these exceptions so they aren't catastrophic. |
Re: TWS vs Gateway at reconnections
Why do you think the gateway is insufficient? In my experience it is considerably faster than the TWS and works great. The only thing is that you don't see things like you do with the TWS.
And to return to my original question. Isn't there a setting that controls the TWS behaviour at the loss of connection. I don't see why it shouldn't reconnect like the gateway does. |
Re: TWS vs Gateway at reconnections
Stuart Cracraft
toggle quoted message
Show quoted text
On Jun 2, 2021, at 2:48 PM, RobDawg35 <rob.sandberg26@...> wrote:
|
Re: TWS vs Gateway at reconnections
I do not think it would be too difficult to spin up that linux command, no? On Wed, Jun 2, 2021 at 3:07 PM Stuart Cracraft via <smcracraft=[email protected]> wrote:
|
Re: TWS vs Gateway at reconnections
Stuart Cracraft
toggle quoted message
Show quoted text
On Jun 2, 2021, at 2:02 PM, Stuart Cracraft via groups.io <smcracraft@...> wrote:
|
Re: TWS vs Gateway at reconnections
Stuart Cracraft
¿ªÔÆÌåÓýWhat is needed is a thin auto-restarting Linux client using systemctl with auto-login after outages, maintenances and whenever it disconnects.? Otherwise, this requires too much hand-holding.? My two cents.? On Jun 2, 2021, at 1:47 PM, RobDawg35 <rob.sandberg26@...> wrote:
|
Re: TWS vs Gateway at reconnections
I have not used Alpaca....would using Gateway over TWS be more beneficial on an AWS instance? On Wed, Jun 2, 2021 at 2:28 PM Stuart Cracraft via <smcracraft=[email protected]> wrote:
|
Re: TWS vs Gateway at reconnections
Stuart Cracraft
¿ªÔÆÌåÓýI run Ubuntu on AWS and twsapi on it plus check it daily as I think their client side automation is weak.? Clumsy, and in the case of IB, necessary.? Unfortunate! Anyone used alpaca? On Jun 2, 2021, at 12:46 PM, RobDawg35 <rob.sandberg26@...> wrote:
|
Re: TWS vs Gateway at reconnections
Hi all,? I have also had this problem and am currently switching to run this on a server. I am going to be paying around $20-40/month.? I am in-between using "VULTR" or spinning up an EC2 instance then creating a UI for Linux on the server.? Best, Rob On Wed, Jun 2, 2021 at 12:32 AM Despair <boris@...> wrote: The problem is not the reconnection to the API. The problem is the TWS shuts down completely. So I have to restart the TWS manually before the client can connect to it again. |
Re: the fields commission, max/min Commission in openOrder state are broken
hello josh,?
thank you for considering my question. there are 3 fields related to commissions: minCommission, maxCommission, and commission. sys.float_info.max is not a reasonable number. and it appears on different fields on different (types of)? accounts. acct1 (paper): commission:(sys.float_info.max), minCommission:0.1786933, maxCommission:0.7546933 acct2(live): commission:2.0, minCommission:(sys.float_info.max), maxCommission:(sys.float_info.max) for my tests i took the max value that is not (sys.float_info.max), but wondered whether it's a real problem. thanks again, alex |
Re: Handling -1.0 TickPrices?
When you look at processTickPriceMsg() deep in the API in EDecoder.java it seems that price and size actually arrive in the same message. Once decoded, tickPrice() is called right before tickSize() for ASK, BID, LAST, and the DELAYED versions. You might also get more tickSize() callbacks without additional tickPrice() calls.
So it appears the detection is quite simple. When tickPrice() indicates a price of -1 just wait for the next tickSize() to confirm. JR. |
Re: Handling -1.0 TickPrices?
On Wed, Jun 2, 2021 at 03:31 AM, JR wrote:
he way I read the is that both price and size must be -1 to indicate missing data. That seems to be the necessary and sufficient condition.Thanks JR, that does make sense.. I'm mostly doing algo work these days, so the size isn't something I've watched in quite some time..? I do wish they came in on the same event though, so I could process this case before passing the price along in the system..? Alas, it's nearly 4am and it's been a long day. -Peter |
Handling -1.0 TickPrices?
IB gives a -1.0 price when there's no data available via tickPrice(tickerid, field, price, attribs).? I get how that may have seemed like an alright idea ~30 years ago, but bad designs live longer than bad designers.. |
Re: TWS vs Gateway at reconnections
Amine
Hi Despair
My answer is not the smartest and could help. I use TWS and its data disconnected due to internet disconnection, then it it was restored once internet was restablish, I run TWS API (python) in a loop: app = IBapi()
app.connect('127.0.0.1', port=port, clientId=clientId)
print("serverVersion:%s connectionTime:%s" % (app.serverVersion(),
app.twsConnectionTime()))
def run_loop():
app.run()
api_thread = threading.Thread(target=run_loop, daemon=True)
api_thread.start()
|
Re: Historical bars and WAP
Hi Alex,
Thank you for sharing your experiment. I have a question though, I tried to plot the WAP (thinking that it corresponds to VWAP) but this wasn't the case after confirming with TWS software. My question: Is there a relation between WAP and VWAP or I am missing something. Thank you in advance. Amine |
Please help with 321-Error validating request.-'b8' : cause - Unified group name is invalid-
Charles
Hey,
?
I'm trying to place a Bracket order from the IBApi using C#.
My code is:
? ? ? ? var bracket = BracketOrder_MKT(parentOrderId,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"BUY",
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?shares,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?takeProfitLimitPrice,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?stopLossPrice);
?
? ? ? ? foreach (var order in bracket) {
? ? ? ? ? clientSocket.placeOrder(order.OrderId, USStock(symbol), order);
? ? ? ? }
? ? ? ? ClientId += 3;
? ? ? ? SetRequestID(ClientId);
?
? 321-Error validating request.-'b8' : cause - Unified group name is invalid-
?
What causes this error, and how can I fix it.
?
Any help will be greatly appreciated.
?
Charles |
to navigate to use esc to dismiss