home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a079 / 1.img / FPDG.LZH / VOL2NUM0 / STOCK / STOCK.APP (.txt) < prev    next >
Encoding:
MS Visual FoxPro App  |  1993-02-03  |  10.5 KB  |  179 lines

  1. Stock
  2. quickf
  3. Stocks
  4. symbol
  5. PRINTz
  6. Printer was turned off
  7. MYPATH
  8.  teHEADER
  9. erePDISPLAY
  10. tNAME
  11. ditSYMBOL
  12. NSYMBOLS
  13. SYMTABLE
  14. DESCRIP
  15. PRTFLAG
  16. PCHAR
  17. TFLAG
  18. CHOOSE
  19. MESSAGE
  20. teANS
  21. teDESC
  22. reDESCRIP
  23. tVOLUME
  24. ditLAST
  25. LVMIN1
  26. VMAX1
  27. INCREMENT
  28. VINCREMENTNAVERAGE
  29. SHOWHEAD
  30. PDISPLAY
  31. ERAGE
  32. CHANGE
  33. AMOUNT
  34. SVALUE
  35. PLOTALINE
  36. Symbol: 
  37. Name:   
  38. Stock Range:
  39. ###.###
  40. ###.###
  41. Volume Range:
  42. ########
  43. ########
  44. HEADER
  45. teSYMB
  46. reDESC
  47. tMIN1
  48. ditMAX1
  49. VMAX1
  50. VMIN1
  51. teVOL
  52. reAMT1
  53. ditLO
  54. INCREMENT
  55. VMIN1
  56. LVINCREMENTHILO
  57. PCHAR
  58. MENTVMAX1
  59. IHIGH
  60. Select a stock
  61. Z - Toggle PLOT display mode
  62. DO Action
  63. STOCK
  64. teISYM
  65. reNSYMBOLS
  66. tSYMTABLE
  67. STOCK
  68. tePRMPT
  69. rePDISPLAY
  70. tHEADER
  71. tPLOTTER
  72. Pause
  73. Pick an item...
  74. *TH \<Continue;\<Menu;\<Repeat
  75. PROMPTER
  76. eCHOICE
  77. eWAITER
  78. el o(
  79. PLOTTER
  80. SHOWHEAD
  81. PLOTALINE
  82. CHOOSE
  83. ACTION
  84. PROMPTER
  85. stock1
  86. stock
  87. Symbol
  88. STOCKS
  89. stock1
  90. STOCK1
  91. STOCK
  92. OLDSCREEN
  93. SYMBOL
  94. NSYMBOLS
  95. SYMTABLE
  96. DESCRIP
  97. FOUND
  98. COMPANY
  99. FINDVALUESDATE
  100. STOCKS
  101. GETVALUES
  102. VOLUME
  103. CCHANGE
  104. COPEN
  105. CHANGE
  106. CHIGH
  107. CONVERT
  108. CLAST
  109. STOCKVALUEAST
  110. SLASH
  111. ALUEVALUE
  112. VALUEDATE
  113. XVALUE
  114. LUEVOLUME
  115. LUELAST
  116. ALUECHANGE
  117. SVALUE
  118. AMOUNT
  119. FINDVALUES
  120. CONVERT
  121. GETVALUES
  122. stocks
  123. symbol
  124. STOCKS
  125. SYMBOL
  126. SVALUE
  127. VOLUME
  128. Program: STOCK.PRG
  129. The STOCK.PRG program maintains a database file that contains stock quotes.  APPENDs a text file containing stock quotes to a database file and then. The text file is downloaded from a stock quote service periodically and imported to the database file. I normally run this program after the stock market closes each day.
  130. In this application, the stock quotes are downloaded from the Prodigy Network. However, you can download stock quotes from other telecommunications services such as CompuServe. 
  131. Picking through the Prodigy menus to access the stock quotes takes time and effort. Therefore, I use a batch file that executes one of the available shareware keyboard macro programs that executes Prodigy and provides the necessary keystrokes to retrieve a list of stock quotes. I also use a shareware program that redirects printed output to a text file, STOCK.TXT. In Prodigy, you can create a list of up to thirty stocks (JUMP QUOTE TRACK 1). batch file STOCK.BAT is as follows:
  132.    d:
  133.    cd \
  134.    erase stock.txt
  135.    prn2file stock.txt
  136.    key /mc
  137.    key prodigy /ml
  138. The following listing contains the keyboard macro script, PRODIGY.MAC that executes PRODIGY, signs on to the Prodigy network and retrieves the stock quotes:
  139. <BEGDEF><alt.>
  140. <AUTO>
  141. <ENTER>
  142. pr<ENTER>
  143. (user-id)<ENTER>
  144. (password)<ENTER>
  145. j<ENTER>
  146. Quote Track 1<ENTER>
  147. C<ENTER>
  148. j<ENTER>
  149. Quote Track 2<ENTER>
  150. C<ENTER>
  151. <ENDDEF>
  152. An example of the stock quote text file (STOCK.TXT) downloaded from prodigy is shown in Listing 14.3 of the book.
  153. Next, FoxPro executes and STOCK.PRG, shown in Listing 14.4 in the book is executed. The STOCK.PRG procedure first appends the STOCK.TXT text file to the STOCK1.DBF database file. Stock quotes are presented as a whole number plus a fraction of a quote. These are converted to a decimal number. For example, 16 1/4 is converted to 16.25. Mutual fund values appear as a decimal number so no conversion is necessary.
  154. You can use the STOCKS.DBF stock quote database to perform a variety of analysis operations. However, in this example, the data is simply plotted. The PLOT.PRG program plots all the stocks. However, you can access a menu to plot a single stock. 
  155. The PLOTTER procedure uses the CALCULATE command to compute the minimum and maximum values for plot scaling. Then it calls the PlotALine procedure to plot a line. The ShowHeader procedure displays the name and minimum and maximum stock quote and volume values.
  156. The CHOOSE procedure displays a popup menu containing a selection bar for each stock symbol. When the user selects an option, the ACTION procedure is called that either QUITs the PLOT program or generates a plot for the selected stock. The program also features an option (Z) that toggles between two plot display modes. One mode displays all the available quotes entries in the database for a stock. If more entries to plot exist than lines on-screen, the display scrolls. The second mode compresses the plot so that all data for a stock displays on a single screen.
  157. PROGRAM: CALC2.PRG
  158. There are other analysis operations that you can perform on the stock quote database file, STOCK.DBF. Program CALC2.PRG illustrates the use of the CALCULATE command. this program computes stock market quote statistics for different companies.
  159. Program CALC2.PRG calls procedure CalcStock, which calls the CALCULATE command to compute statistics based on daily stock values. It computes the stock high, low, and average stock value; the standard deviation; and the minimum and maximum value of the stock sales volume. The records in the STOCKS.DBF database are processed. 
  160. Each record in STOCKS.DBF contains a daily summary for selected stocks. It contains the daily volume, the high and low stock value, the last stock quote for the day and the stock symbol. Here is an example of output from program CALC2.PRG.
  161. Stock: MSFT Stock Performance Statistics for last: 1254 days
  162. Starting Date: 03/16/89   Ending Date:  08/21/92
  163. High:                 133.25  Low:                     45.00
  164. Average:               87.07  Standard Deviation:      22.28
  165. Maximum Volume:   4712000.00  Minimum Volume:      188200.00
  166. Today's Date:  08/24/92 --- Statistics for Previous 30 Days
  167. High:                 74.75  Low:                     68.00
  168. Average:              71.61  Standard Deviation:       1.50
  169. Maximum Volume:  4539800.00  Minimum Volume:      857300.00
  170. PLOT.PRG
  171. c:\windows\temp\
  172. PLOT.FXP
  173. STOCK.PRG
  174. STOCK.FXP
  175. UPDATE.PRG
  176. UPDATE.FXP
  177. c:\foxprodg\vol2num0\stock\
  178. STOCK.ART
  179.