Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: 4AM opening price (not official one) but real one in timestamp
U made my day, mate! i been looking that for ages...Thats exctly i needed:
? "1658908800" : [ { ? what request did u use to get it. Can u give me exactly how u wrote. Thanks a lot! Sorry i am not dev, just want to pass that information to my dev. |
||||||||||||||||||||
Re: 4AM opening price (not official one) but real one in timestamp
Don't use RT Volume ticks since they are aggregated (several trades reported in one tick). Please go ahead and read up on as I had suggested. You get every individual trade from all exchanges with detailed attributes and conditions about the trade. You can then inspect the trades and pick the very first one that meets your needs. For your reference, below the first three trades today at 4AM Eastern/3AM Central for IBM. ´³¨¹°ù²µ±ð²Ô { |
||||||||||||||||||||
Re: 4AM opening price (not official one) but real one in timestamp
Hmm, the problem that if i get FIRST day trade (premarket from 4am or later) it brings me official one from SIP and its wrong because they show block for 100 shares or more.. but if first trade was 1 share.. API ignore it. So i asking how i can get that one which is ignored. RT Volume (Time & Sales) 48 Last trade details (Including both "Last" and "Unreportable Last" trades) ? |
||||||||||||||||||||
Re: 4AM opening price (not official one) but real one in timestamp
You would probably want to look at and specifically for the various data options for trades at 4am.You'd have to set useRth=false, to get values for those early hours (outside of Regular Trading Hours). Not all instruments may have trades at exactly 4am every day, so you might want to request data for the first hour or so to catch the earliest trade. ´³¨¹°ù²µ±ð²Ô |
||||||||||||||||||||
Delayed TickByTick streaming data
From what I understand delayed TickByTick streaming data requires no subscription (besides snapshot and is subject to volume limitations). So I wonder why I get the following error message:
My code:? from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from ibapi.ticktype import TickTypeEnum
import time
from datetime import datetime
import threading
?
?
class TestApp(EWrapper, EClient):
? ? def __init__(self):
? ? ? ? EClient.__init__(self, self)
? ? ? ? self.last_price_list = []
?
? ? def error(self, reqId, errorCode, errorString):
? ? ? ? print("Error: ", reqId, " ", errorCode, " ", errorString)
?
? ? def tickByTickAllLast(self, reqId, tickType, time, price, size, tickAtrribLast, exchange, specialConditions):
? ? ? ? print("Tick Price. Ticker Id:", reqId, "tickType:", TickTypeEnum.to_str(tickType), "Price:", price,?
? ? ? ? ? ? ? ? "tickAtrribLast:", tickAtrribLast, "specialConditions:", specialConditions,? end=' ')
? ? ? ? print("_______________________")
? ??
app = TestApp()
?
app.connect("127.0.0.1", 4002, 0)
? ??
? ? # allow time to connect to server
time.sleep(1)
? ??
contract = Contract()
contract.symbol = "AAPL"
contract.secType = "STK"
contract.exchange = "SMART"
contract.currency = "USD"
contract.primaryExchange = "NASDAQ"
?
app.reqMarketDataType(4)? # switch to delayed-frozen data if live is not available
app.reqTickByTickData(1 ,contract, "Last", 0, True)
#app.reqMktData(1, contract, "", False, False, [])
?
api_thread = threading.Thread(target=app.run)
api_thread.start()
?
Error message: Error:? -1? ?2104? ?Market data farm connection is OK:usfarm
Error:? -1? ?2106? ?HMDS data farm connection is OK:ushmds
Error:? -1? ?2158? ?Sec-def data farm connection is OK:secdefil
Error:? 1? ?10189? ?Failed to request tick-by-tick data.No market data permissions for ISLAND STK. Requested market data requires additional subscription for API. See link in 'Market Data Connections' dialog for more details.
|
||||||||||||||||||||
Re: Flushing the Incoming Message Buffer - C++ Multi-threading
Thanks Hilmar.
|
||||||||||||||||||||
4AM opening price (not official one) but real one in timestamp
Anyone can tell me what tick i need to use to get 4 AM opening price in IBKR api. IB providing official price which has atleast 100 shares and i need the one which first in time stamp and can be any size.
I making scirpt which need find 4 am opening price for 1 year. .can anyone give me right command.. and how to get that in live? Thanks |
||||||||||||||||||||
Re: About commissionReport.realizedPNL
¿ªÔÆÌåÓýThere is a ¡®realizedPNL¡¯ column you can view in TWS as well to see how it works. Basically yes I believe it is calculated for each closing trade, but not necessarily based on the average cost: if you specify ¡¯tax lots¡¯ it is based on the opening cost of the lot you matched the closing trade with. In absence of specifying lots, it will be based on your default setting (which is most likely FIFO if you didn¡¯t change it in the config).RealizedPNL does get reset every day. Unrealized PNL is your PNL to date on all open positions. So as you make dailyPNL (also reported in TWS) that adds to your unrealizedPNL. Then once you close the trade it goes from unrealizedPNL to realizedPNL but
stays in your dailyPNL. ?RealizedPNL and obviously also dialyPNL get reset every day.?
Bart
|
||||||||||||||||||||
Re: About commissionReport.realizedPNL
The short answer is yes, realizedPNL in commissionReports for trades that reduce a position include (the loss from) commissions. We do not use the realizedPNL field from comission reports so we have no practical experience of exactly how realizedPNL is calculated, especially if you have scenarios with multiple entry trades at different prices and an overlapping partial exit trade. But I assume it is based upon the "average cost" as reported by which does get adjusted at every trade. I also cannot say for sure whether the daily PNL reset applies to realizedPNL reported in commission reports. I grabbed a quick example from our object log that shows trading one ES future contract each. Exit trades were made with 1 tick profit or loss (e.g. $12.50 profit or loss from price differences). Below the relevant commissionReport fields tor those? four trades. ´³¨¹°ù²µ±ð²Ô
|
||||||||||||||||||||
Re: Flushing the Incoming Message Buffer - C++ Multi-threading
Even after you cancel a request there may be messages wandering around the Internet that may appear many seconds later.
You need to accept any message at any time. If you receive tick data you're no longer interested in then you need to ignore.it. |
||||||||||||||||||||
DAX data feed via API
¿ªÔÆÌåÓýHi, ? I trade DAX with Ninjatrader connected to Interactive Brokers via TWS (connect to API). ? Since Monday, no data is available for DAX futures when I connect Ninjatrader to TWS to get data feed. ? DAX futures cannot be traded as if the instrument is not known. ? Have someone heard of any problem ? Any solution ? ? Thanks ? David G |
||||||||||||||||||||
Flushing the Incoming Message Buffer - C++ Multi-threading
I have a C++ GUI application which on which at a user request, the list of symbols will be cleared and all the market data requests will be cancelled, and ultimately the buffer holding the records for the GUI display is cleared.
The issue I have is that every now and again I get a crash because there are still incoming tick messages (price, volume, etc.) in the queue after the display and buffer are cleared. Is there any way I can test the incoming message queue to see if there are any messages to process? Is there a way to clear that queue to prevent further GUI update calls from the reader thread? |
||||||||||||||||||||
Re: TwsActiveX - downloading Account info on sample worksheet stuck after 1-2 dozen rows
Great! Here you have tha API reference guide, and also the function which gets the account information: it displays an important?message: "Important:?only?two?active summary subscriptions are allowed at a time!" So if you press the button more times maybe you will get unexpected behaviour or no data sent from TWS.? Hope this helps El lun, 25 jul 2022 a las 14:59, <redcorolla95@...> escribi¨®: Here's the screenshot of what I just downloaded today. |
||||||||||||||||||||
Re: TwsActiveX - downloading Account info on sample worksheet stuck after 1-2 dozen rows
Here's the screenshot of what I just downloaded today.
I realized the problem goes away if I don't change to an xlsx file and leave it in xls - then its like all the lines are populated at once instead of waiting for a few seconds each line like this. |
||||||||||||||||||||
Re: TwsActiveX - downloading Account info on sample worksheet stuck after 1-2 dozen rows
Sorry I do not understand your problem, you downloaded?your account info and it sends you 5/10/40 rows? Could you explain please? And also an image of the issue would help. El dom, 24 jul 2022 a las 10:04, <redcorolla95@...> escribi¨®: Hi all, new to this forum and ActiveX API here. |