Closed storewaladotcom closed 5 years ago
Hello @storewaladotcom, to use this library, you need to subscribe to IQFeed developer which gives you the PRODUCT_ID.
Thanks, Mathieu
ok so once I do that, I develop the application, and then say I stop subscribing to IQfeed developer. What happens then? thanks
not sure.. I think you might be able to continue using your product id...
hi, so this library is meant for developers? I have an IQFeed account but not a developer account. I just want to access some streaming data that the software that I am using does not provide or make available. Why is this product ID needed? Is this a requirement made by IQFeed? I mean there is other Python code out there that is able to connect to IQFeed without this product ID,
thanks
I got the sample code running IF I am running IQFeed already inside another program. However, after it printed the tick data it gives an error that the product key has changed. This is because in the Python code I used 0 for the product_ID
Is there any way to retrieve the product ID once I am already running IQFeed? Since this is how I want to use it anyway. I already run IQFeed using other software. This other software probably already is using a product_ID, namely the product_ID from the developer of that software.
Solved it :) when I am already running IQFeed I can just skip this line because IQFeed is already launched
IQFeedLauncher.Start( username, password, productid )
just comment it out and it works !!! 👍 great
@dutchy54321 please dont forget to star the project. have a look at this https://github.com/mathpaquette/IQFeed.CSharpApiClient/issues/25#issuecomment-441163239
@mathpaquette not sure what you mean by "star" the project.
is this plugin meant for people who already have a developer account? Since I have it working but I do not have access to the manual so I do not know function names etc. I actually only want access to some data because inside Amibroker I have access to most. I just want to have access to streaming bid/ask prices. I want to buffer them in say 1 minute blocks. Not exactly sure yet what I want to use yet but it would be helpful if we somehow could have access to the function names etc.
Or do I need a developer account first?
@dutchy54321
@mathpaquette not sure what you mean by "star" the project.
is this plugin meant for people who already have a developer account? Since I have it working but I do not have access to the manual so I do not know function names etc. I actually only want access to some data because inside Amibroker I have access to most. I just want to have access to streaming bid/ask prices. I want to buffer them in say 1 minute blocks. Not exactly sure yet what I want to use yet but it would be helpful if we somehow could have access to the function names etc.
Or do I need a developer account first?
Yes, if you want to have access to the documentation, yes, you need developer access.
ok thanks that's too bad.
OK I gave it a star 👍 number 99
yes.... I mean, their model is a bit old school I think.
hi Math,
maybe you can help me with 1 thing.
Once IQFeed is launched the IQFeed connection Manager has started (little blue icon). If you right mouse click on the icon there are several menus to choose from. 1 is "Display Apps". Inside "Display Apps" go to "Time & Sales" Then the "Time & Sales" window opens.
Now you can put in a symbol for instance QPL# and data Type tick. If you go into the settings and enable to Display "Enable Quote Updates" then the output in the T&S window will be the actual trades PLUS the quotes. A quote update is an update of either/or a change in the bid/ask price/size.
I want to access these quotes. In your Level1 streaming example this data is not available. Could you give me an example where you get access to these quote lines?
thank You
actually your example code already gives the information I need. I just compared it with the T&S window of IQFeed and the information is there using the level1 example code calling for instance:
level1Client.ReqWatch("@ES#")
so this is great
hi,
I will probably not get a reply, which is fine. I am not a real programmer, just a coder inside trading programs
So Amibroker has a bridge to Python. I can start getting bid and ask data inside Amibroker using a function
def startOutputSomeDataInAmibroker( sym1 ):
AmiPy.Print('In A')
# Subscribe to Summary/Update events
level1Client.Summary += level1UpdateSummaryHandler
level1Client.Update += level1UpdateSummaryHandler
# Connect
level1Client.Connect()
# Request streaming
level1Client.ReqWatch(sym1)
this works. How do I now stop the streaming? I tried:
def stopOutputSomeDataInAmibroker( sym1 ):
AmiPy.Print('In B')
# UnSubscribe to Summary/Update events
level1Client.Summary -= level1UpdateSummaryHandler
level1Client.Update -= level1UpdateSummaryHandler
# DisConnect
level1Client.DisConnect()
# Request streaming
level1Client.ReqUnWatch(sym1)
But it says level1Client has no attribute ReqUnWatch and DisConnect yet I checked in the source code and it seems they are there. How would I stop the streaming of data after I started it? Thank you
You have a typo.. src/IQFeed.CSharpApiClient/Streaming/Level1/ILevel1Client.cs
ReqUnwatch..
thanks. Yes I found that also (also DisConnect needs to be Disconnect) but I still can't get it working.
So if I call the ReqUnwatch directly after ReqWatch it stops the stream. So the code that starts the streaming, outputs the data inside Amibroker and stops streaming looks like this:
assembly_path = r'C:/Program Files/AmiBroker/IQFeedCSharpApiClient'
import sys
sys.path.append(assembly_path)
import clr
clr.AddReference("IQFeed.CSharpApiClient")
from IQFeed.CSharpApiClient.Streaming.Level1 import Level1ClientFactory
import time
import AmiPy
import numpy as np
import pandas as pd
# global level1Client
level1Client = Level1ClientFactory.CreateNew()
def getStopStatusFromAmibroker( status ):
global stat
stat = int(status)
# Level 1 handler function
def level1UpdateSummaryHandler(msg):
#print(msg.Ask)
AmiPy.Print('Ask: ' + str(msg.Ask) + ' Bid: ' + str(msg.Bid) + '\n')
def startOutputSomeDataInAmibroker( sym1 ):
AmiPy.Print('In A')
# Subscribe to Summary/Update events
level1Client.Summary += level1UpdateSummaryHandler
level1Client.Update += level1UpdateSummaryHandler
# Connect
level1Client.Connect()
# Request streaming
level1Client.ReqWatch(sym1)
# stop streaming
level1Client.ReqUnwatch(sym1);
so the level1Client I activate globally. This code works.
However if I try to stop the stream using another function called stopOutputSomeDataInAmibroker, see code below
assembly_path = r'C:/Program Files/AmiBroker/IQFeedCSharpApiClient'
import sys
sys.path.append(assembly_path)
import clr
clr.AddReference("IQFeed.CSharpApiClient")
from IQFeed.CSharpApiClient.Streaming.Level1 import Level1ClientFactory
import time
import AmiPy
import numpy as np
import pandas as pd
# global level1Client
level1Client = Level1ClientFactory.CreateNew()
def getStopStatusFromAmibroker( status ):
global stat
stat = int(status)
# Level 1 handler function
def level1UpdateSummaryHandler(msg):
#print(msg.Ask)
AmiPy.Print('Ask: ' + str(msg.Ask) + ' Bid: ' + str(msg.Bid) + '\n')
def startOutputSomeDataInAmibroker( sym1 ):
AmiPy.Print('In A')
# Subscribe to Summary/Update events
level1Client.Summary += level1UpdateSummaryHandler
level1Client.Update += level1UpdateSummaryHandler
# Connect
level1Client.Connect()
# Request streaming
level1Client.ReqWatch(sym1)
# stop streaming
# level1Client.ReqUnwatch(sym1);
def stopOutputSomeDataInAmibroker( sym1 ):
AmiPy.Print('In B')
# UnSubscribe to Summary/Update events
# level1Client.Summary -= level1UpdateSummaryHandler
# level1Client.Update -= level1UpdateSummaryHandler
# DisConnect
# level1Client.Disconnect()
# stop streaming
level1Client.ReqUnwatch(sym1)
I get an error message saying:
Error 99. Error occured during function call: PyErr type: SocketException PyErr value: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied at IQFeed.CSharpApiClient.Socket.SocketClient.Send(String message) PyErr callstack: * File: 'C:\Users\win 10\AppData\Local\Programs\Python\Python38\mypython\iqfeed\getBidAskInsideAmibroker.py', line 57 (in stopOutputSomeDataInAmibroker) MyFormulas\mypython\iqfeedcsharp\iqfeedcsharptest.afl 23 17
Not sure how to solve it. Because I defined the level1Client globally I thought it would work. Thanks.
hi Math,
I was just looking at your application again. I want to access Level1 IQFeed data. The msg line is ok for me but it does not contain the tickID.
the output I get looks like (see below). Basically all I need except for the TickID which is not in the message line. Would it be possible to add the tickID?
thank you,
Ed
Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 16, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 15, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 13, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 13, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121537, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121538, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 5, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 6, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 7, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 8, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 9, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 10, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 11, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01
Op do 28 apr. 2022 om 13:19 schreef Mathieu Paquette < @.***>:
You have a typo.. src/IQFeed.CSharpApiClient/Streaming/Level1/ILevel1Client.cs
ReqUnwatch..
— Reply to this email directly, view it on GitHub https://github.com/mathpaquette/IQFeed.CSharpApiClient/issues/38#issuecomment-1112084049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYUT6EUNPYEFUABCVGATMKTVHJX43ANCNFSM4HJ6BPFQ . You are receiving this because you were mentioned.Message ID: @.***>
hi Mathieu,
I made some Python TEST code to read the IQFeed data into a pandas dataframe.
I have a historical part and a streaming part. In the historical part I was not able to get the timestamp that gives me Microseconds. In the code below I show in yellow where I add this. As a dummy I add Milliseconds. It is a DateTime Object but it does not give me the Microseconds.
Could you maybe tell me how to do this? And I will not bother you again 😀
regards, Ed
''' https://github.com/mathpaquette/IQFeed.CSharpApiClient/blob/master/docs/USING-WITH-PYTHON.md https://www.quantstart.com/articles/Downloading-Historical-Intraday-US-Equities-From-DTN-IQFeed-with-Python/ https://github.com/mathpaquette/IQFeed.CSharpApiClient/blob/master/src/IQFeed.CSharpApiClient.Examples/Examples/StreamingLevel1/StreamingLevel1DynamicExample.cs
to run this code: open CMD window and type: csharptestCombi1.py
''' assembly_path = r'C:/Program Files/AmiBroker/IQFeedCSharpApiClient' import sys sys.path.append(assembly_path) import clr clr.AddReference("IQFeed.CSharpApiClient") from IQFeed.CSharpApiClient.Lookup import LookupClientFactory
IHistoricalMessage
from IQFeed.CSharpApiClient.Streaming.Level1 import Level1ClientFactory from IQFeed.CSharpApiClient.Streaming.Level1 import DynamicFieldset from IQFeed.CSharpApiClient.Streaming.Level1.Handlers import Level1MessageDynamicHandler import time import numpy as np import pandas as pd from datetime import datetime
headers = ['Month','Day','Year','Hour','Minute','Second','Millisecond','Microsecond','Last','LastSize','TotalVolume','Bid','Ask','TickId'] df1 = pd.DataFrame(columns=headers) df2 = pd.DataFrame(columns=headers)
level1Client = Level1ClientFactory.CreateNew(Level1MessageDynamicHandler())
def getHistory(sym: str, nlines: int): global df1, headers lookupClient = LookupClientFactory.CreateNew() lookupClient.Connect() ticks = lookupClient.Historical.GetHistoryTickDatapoints(sym, nlines) for tick in ticks: trade={ 'Month':tick.Timestamp.Month, 'Day':tick.Timestamp.Day, 'Year':tick.Timestamp.Year, 'Hour':tick.Timestamp.Hour, 'Minute':tick.Timestamp.Minute, 'Second':tick.Timestamp.Second, 'Millisecond':tick.Timestamp.Millisecond, 'Microsecond':tick.Timestamp.Millisecond, 'Last':tick.Last, 'LastSize':tick.LastSize, 'TotalVolume':tick.TotalVolume, 'Bid':tick.Bid, 'Ask':tick.Ask, 'TickId':tick.TickId} df1 = df1.append(trade, ignore_index=True)
def level1UpdateSummaryHandler(msg):
#print(msg)
global df2, headers
#print(msg.DynamicFields.LastTime)
#print(msg.DynamicFields.LastTime.TotalMilliseconds)
#print(int( 1000 * ( msg.DynamicFields.LastTime.TotalMilliseconds % 1 )
) )
dd = msg.DynamicFields.LastDate
trade={ 'Month':msg.DynamicFields.LastDate.Month,
'Day':msg.DynamicFields.LastDate.Day,
'Year':msg.DynamicFields.LastDate.Year,
'Hour':msg.DynamicFields.LastTime.Hours,
'Minute':msg.DynamicFields.LastTime.Minutes,
'Second':msg.DynamicFields.LastTime.Seconds,
'Millisecond':msg.DynamicFields.LastTime.Milliseconds,
'Microsecond':int(1000*(msg.DynamicFields.LastTime.TotalMilliseconds % 1)), 'Last':msg.DynamicFields.Last, 'LastSize':msg.DynamicFields.LastSize, 'TotalVolume':msg.DynamicFields.TotalVolume, 'Bid':msg.DynamicFields.Bid, 'Ask':msg.DynamicFields.Ask, 'TickId':msg.DynamicFields.TickID} df2 = df2.append(trade, ignore_index=True)
def startOutputSomeDataInAmibroker(sym: str, nsec: int):
level1Client.Summary += level1UpdateSummaryHandler
level1Client.Update += level1UpdateSummaryHandler
# Connect
level1Client.Connect()
fields = [DynamicFieldset.Symbol,
DynamicFieldset.LastTime,
DynamicFieldset.ExtendedTradeDate,
DynamicFieldset.LastDate,
DynamicFieldset.MostRecentTradeDate,
DynamicFieldset.Last,
DynamicFieldset.LastSize,
DynamicFieldset.TotalVolume,
DynamicFieldset.Bid,
DynamicFieldset.Ask,
DynamicFieldset.TickID]
level1Client.SelectUpdateFieldName(fields)
# Request streaming
level1Client.ReqWatch(sym)
time.sleep(nsec)
if name == "main": sym = @.***#" nlines = 10 # nlines lines of historical data nsec = 3 # nsec seconds of streaming data getHistory(sym,nlines) startOutputSomeDataInAmibroker(sym,nsec) df1 = df1.sort_index(ascending=False) frames = [df1, df2] df = pd.concat(frames) print(df)
Op ma 11 apr. 2022 om 14:49 schreef Mathieu Paquette < @.***>:
@dutchy54321 https://github.com/dutchy54321 please dont forget to star the project. have a look at this #25 (comment) https://github.com/mathpaquette/IQFeed.CSharpApiClient/issues/25#issuecomment-441163239
— Reply to this email directly, view it on GitHub https://github.com/mathpaquette/IQFeed.CSharpApiClient/issues/38#issuecomment-1095009221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYUT6EUF4NERCJAAYNUP7QTVEQNURANCNFSM4HJ6BPFQ . You are receiving this because you were mentioned.Message ID: @.***>
hi Math,
i think I succeeded.
My test code below. Still have to test when markets are open but it gives me 1 line output as expected
regards, Ed
''' https://github.com/mathpaquette/IQFeed.CSharpApiClient/blob/master/docs/USING-WITH-PYTHON.md https://www.quantstart.com/articles/Downloading-Historical-Intraday-US-Equities-From-DTN-IQFeed-with-Python/ https://github.com/mathpaquette/IQFeed.CSharpApiClient/blob/master/src/IQFeed.CSharpApiClient.Examples/Examples/StreamingLevel1/StreamingLevel1DynamicExample.cs
to run this code: 1) you need to have IQFeed running in AmiBroker 2) the plugin file IQFeedCSharpApiClient.dll needs to put here: C:\Program Files\AmiBroker\IQFeedCSharpApiClient 3) put this file (csharptest.py) inside the same directory where you have the other Python files (because of PATH) 4) open CMD window and type: csharptest.py
// Step 3 - Create an array that includes the fields desired for Update and Summary messages var fields = new[] { // The IQFeed servers ALWAYS include Symbol as first message data field, regardless of fields requested via SelectUpdateFieldName/SELECT UPDATE FIELDS // DynamicFieldset.Symbol MUST be the first dynamic field in the array at this time. Parsing errors will result otherwise.
DynamicFieldset.Symbol,
DynamicFieldset.SevenDayYield,
DynamicFieldset.Ask,
DynamicFieldset.AskChange,
DynamicFieldset.AskMarketCenter,
DynamicFieldset.AskSize,
DynamicFieldset.AskTime,
DynamicFieldset.AvailableRegions,
DynamicFieldset.AverageMaturity,
DynamicFieldset.Bid,
DynamicFieldset.BidChange,
DynamicFieldset.BidMarketCenter,
DynamicFieldset.BidSize,
DynamicFieldset.BidTime,
DynamicFieldset.Change,
DynamicFieldset.ChangeFromOpen,
DynamicFieldset.Close,
DynamicFieldset.CloseRange1,
DynamicFieldset.CloseRange2,
DynamicFieldset.DaysToExpiration,
DynamicFieldset.DecimalPrecision,
DynamicFieldset.Delay,
DynamicFieldset.ExchangeID,
DynamicFieldset.ExtendedTrade,
DynamicFieldset.ExtendedTradeDate,
DynamicFieldset.ExtendedTradeMarketCenter,
DynamicFieldset.ExtendedTradeSize,
DynamicFieldset.ExtendedTradeTime,
DynamicFieldset.ExtendedTradingChange,
DynamicFieldset.ExtendedTradingDifference,
DynamicFieldset.FinancialStatusIndicator,
DynamicFieldset.FractionDisplayCode,
DynamicFieldset.High,
DynamicFieldset.Last,
DynamicFieldset.LastDate,
DynamicFieldset.LastMarketCenter,
DynamicFieldset.LastSize,
DynamicFieldset.LastTime,
DynamicFieldset.Low,
DynamicFieldset.MarketCapitalization,
DynamicFieldset.MarketOpen,
DynamicFieldset.MessageContents,
DynamicFieldset.MostRecentTrade,
DynamicFieldset.MostRecentTradeConditions,
DynamicFieldset.MostRecentTradeDate,
DynamicFieldset.MostRecentTradeMarketCenter,
DynamicFieldset.MostRecentTradeSize,
DynamicFieldset.MostRecentTradeTime,
DynamicFieldset.NetAssetValue,
DynamicFieldset.NumberOfTradesToday,
DynamicFieldset.Open,
DynamicFieldset.OpenInterest,
DynamicFieldset.OpenRange1,
DynamicFieldset.OpenRange2,
DynamicFieldset.PercentChange,
DynamicFieldset.PercentOffAverageVolume,
DynamicFieldset.PreviousDayVolume,
DynamicFieldset.PriceEarningsRatio,
DynamicFieldset.Range,
DynamicFieldset.RestrictedCode,
DynamicFieldset.Settle,
DynamicFieldset.SettlementDate,
DynamicFieldset.Spread,
DynamicFieldset.Tick,
DynamicFieldset.TickID,
DynamicFieldset.TotalVolume,
DynamicFieldset.Volatility,
DynamicFieldset.VWAP,
};
''' assembly_path = r'C:/Program Files/AmiBroker/IQFeedCSharpApiClient' import sys sys.path.append(assembly_path) import clr clr.AddReference("IQFeed.CSharpApiClient") from IQFeed.CSharpApiClient.Streaming.Level1 import Level1ClientFactory from IQFeed.CSharpApiClient.Streaming.Level1 import DynamicFieldset from IQFeed.CSharpApiClient.Streaming.Level1.Handlers import Level1MessageDynamicHandler import time import numpy as np import pandas as pd
level1Client = Level1ClientFactory.CreateNew(Level1MessageDynamicHandler())
def level1UpdateSummaryHandler(msg):
# AmiPy.Print('Ask: ' + str(msg.TickId) + ' Bid: ' + str(msg.Bid) +
'\n') print(msg)
def startOutputSomeDataInAmibroker( sym ):
level1Client.Summary += level1UpdateSummaryHandler
level1Client.Update += level1UpdateSummaryHandler
# Connect
level1Client.Connect()
fields = [DynamicFieldset.Symbol,
DynamicFieldset.LastTime,
DynamicFieldset.Last,
DynamicFieldset.LastSize,
DynamicFieldset.TotalVolume,
DynamicFieldset.Bid,
DynamicFieldset.Ask,
DynamicFieldset.TickID]
level1Client.SelectUpdateFieldName(fields)
# Request streaming
level1Client.ReqWatch(sym)
# stop streaming
# level1Client.ReqUnwatch(sym1)
time.sleep(5)
if name == "main": sym = @.***#" startOutputSomeDataInAmibroker( sym )
Op di 27 sep. 2022 om 09:18 schreef Dutchy @.***>:
hi Math,
I was just looking at your application again. I want to access Level1 IQFeed data. The msg line is ok for me but it does not contain the tickID.
the output I get looks like (see below). Basically all I need except for the TickID which is not in the message line. Would it be possible to add the tickID?
thank you,
Ed
Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 16, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 15, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 13, Ask: 3706.5, AskSize: 3, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 13, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.5, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.5169530, MostRecentTradeMarketCenter: 43, TotalVolume: 121536, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121537, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121538, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 12, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: C, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 4, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: b, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 5, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 6, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 7, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 8, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 9, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 10, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01 Symbol: @ES#, MostRecentTrade: 3706.25, MostRecentTradeSize: 1, MostRecentTradeTime: 03:07:45.6361840, MostRecentTradeMarketCenter: 43, TotalVolume: 121539, Bid: 3706.25, BidSize: 9, Ask: 3706.5, AskSize: 11, Open: 3668, High: 3712, Low: 3663.75, Close: 3670, MessageContents: a, MostRecentTradeConditions: 01
Op do 28 apr. 2022 om 13:19 schreef Mathieu Paquette < @.***>:
You have a typo.. src/IQFeed.CSharpApiClient/Streaming/Level1/ILevel1Client.cs
ReqUnwatch..
— Reply to this email directly, view it on GitHub https://github.com/mathpaquette/IQFeed.CSharpApiClient/issues/38#issuecomment-1112084049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYUT6EUNPYEFUABCVGATMKTVHJX43ANCNFSM4HJ6BPFQ . You are receiving this because you were mentioned.Message ID: @.***>
What is the product id parameter and where to get it from ?