Hi all,
I posted a file by "nduroman" in the File section of the QP user
group. I wrote my example in VB.Net as more people are probably
familiar with it though I use C++ these days. My code is in the 2003
version. I have mentioned problems I have had with 2005. To make the
code run follow the instructions I have posted. This sample program
goes steps (iterates) through the database and prints to the console
those common stocks with a closing price of > $10. Note that the
last stock will not be evaluated in the "while" loop. This isn't a
major problem for me '1 out of 8000+ but could be solved if Quotes
Plus would add either a COUNT property to the Symbols class or a
MOVENEXT method to the Symbols class.
My code is commented using "'" as is done in VB. Comments are not
actually part of the code. If you really want to learn this stuff I
once again recommend "Modeling Financial Markets" by Van Vliet and
Hendry both financial markets professors at IIT Chicago. VB.Net is
the language used and there is not a better source. It gets you up
to speed on classes and objects in .Net, databases and ADO.Net, and
the very important collection classes in .Net like a hashtable.
Hope this helps.
John
*****************************
'IN VB.NET 2003
'1. Open a CLR Console Application in Visual Studio VB 2003.
Choose "File" , "New", "Project" , ".NET", "Console Application".
You will probably later use a Windows Form Application to create a
GUI (Graphical User Interface) but the principles are the same.
'2. Go to "Project" in the menu
'3. Choose "Add Reference"
'4. Click on the COM tab and find "Quotes Plus 1.1 Type Library.
Highlight this and press "Select" then OK.
'Until you follow the steps above the code below will not
compile!!!!!!
Imports QuotesPlus
Module Module1
Sub Main()
Dim mySymbols As New QuotesPlus.SymbolsClass 'create an
instance of the Symbols class
mySymbols.LISTBY = LISTBY.QPLB_STOCKS 'we want to list only
stocks
mySymbols.SORTORDER = SORTORDER.QPSO_ASCEND 'we want to sort
in A-Z order
Dim myPrices As New QuotesPlus.Price2Class 'create an
instance of the Price2 class
Dim myCompanyInfo As New QuotesPlus.CompanyInfoClass 'create
an instance of the CompanyInfo class
mySymbols.Last() 'set the interator at the last symbol in
the list
Dim str_LastSymbol$ = mySymbols.Symbol 'set the string
variable to the value of the last symbol
mySymbols.First() 'set the iterator at the first symbol in
the list
Dim str_CurrentSymbol$ = mySymbols.Symbol 'set the string
variable to the value of the first symbol
'This while loop goes through all symbols but the last one
in the list. There is no Count method
'in the QP database so we miss the last symbol unless we run
all our methods specifically on it
'as well. I choose to live with missing the last symbol.
While (Not (str_LastSymbol = str_CurrentSymbol))
myPrices.Symbol = mySymbols.Symbol 'you must link the
instance of the Price2 class
'to the Symbols class by Symbol
myCompanyInfo.Symbol = mySymbols.Symbol 'you must link
the of the CompanyInfo class
'to the Symbols class by Symbol
Dim dbl_IssueStatusCode# =
myCompanyInfo.IssueStatus_Code ' I am creating a double variable
'so that I can further filter on common stocks (Issue
Status Code in database is 48)
Dim dbl_CloseBack1 = myPrices.Close(-1) 'Get closing
price 1 day back (use negatives);
'Close(0) is the most recent close
'if common stock and close > 10 then write to console
If ((dbl_IssueStatusCode = 48) And (dbl_CloseBack1 >
10)) Then
Console.WriteLine(str_CurrentSymbol & vbTab &
dbl_CloseBack1)
'print out symbol and closing price 1 back to console
End If
mySymbols.Next() 'set iterator to next symbol
str_CurrentSymbol = mySymbols.Symbol() 'set current
symbol to next symbol
End While
End Sub
End Module
------------------------ Yahoo! Groups Sponsor --------------------~-->
Home is just a click away. Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/quotes-plus/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/