home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
t
/
tas501.zip
/
PERFCHK.TAS
< prev
next >
Wrap
Text File
|
1993-03-07
|
2KB
|
76 lines
#TITLE Calculate Performance for specific securities
{ PERFCHK.TAS ( Author Martin Moore)
Script to print out the performance of specific securities since a
particular date.
To add a ticker and date to the list of stocks to be tracked, edit
the file PERFCHK.DTA (the data file for this script) and
put a line like this in:
tickerName,dateSince,numShares
where 'tickerName' is the stock ticker
'dateSince' is the year, month and day (format YYMMDD)
'numShares' is the number of shares to compute change on
}
FTicker : String;
FDate : Number;
FShares : Integer;
TickerFound : Integer;
ClArray : Array; { Closing price array}
DtArray : Array; { Date array }
TotProfit : Number;
Profit : Number;
choice : integer;
Prolog BEGIN
OutputFile('PerfChk.Lst');
writeln(' Transaction Current ',
'Percent Points Profit');
writeln('Ticker Shares Date Close ',
' Change Change /Loss');
choice = VMenu('Create Performance Report ',
'Update Performance Data ');
End;
if choice = 2 then goto UpdateList; { Update perfchk.dta}
{ Open the performance data file for reading }
FileNo = AOpen('perfchk.dta','r');
{ Read Ticker, Date, Shares from file }
While AGet(FileNo,Fticker,Fdate,Fshares)
Begin
{ Locate the date on or before the date found in
the PERFCHK.DTA file for this ticker}
DtArray = Load(FTicker,'D');
ClArray = Load(FTicker,'C');
For I=Quote_Count; I > 0; I = I-1;
if DtArray[i] <= Fdate then Break;
If I <> 0 Then
Begin
Write(Expand('%-6s %5d %8s %9.3f %8.3f%% %8.3f',
Fticker,
Fshares,
DateStr(DtArray[i]),
ClArray,
ROC(ClArray,Quote_Count-I,'%'),
ROC(ClArray,Quote_Count-I,'$')));
Profit = (ClArray[0]-ClArray[I]) * Fshares;
WritelN(Expand('%11.2f ',Profit));
TotProfit = TotProfit + Profit;
End;
End;
AClose(FileNo);
WriteLn(Expand('Total Profit %55.2f',TotProfit));
Stop;
:UpdateList
choice = VMenu('Add A Symbol','Quit');
if choice = 1 Then
Begin
Ask('Symbol',FTicker,
'Number of Shares',Fshares,
'Date',FDate);
FileNo = AOpen('perfchk.dta','a');
APutLn(FileNo,Expand('%s,%6.0f,%d',FTicker,FDate,FShares));
Aclose(FileNo);
End;
if choice = 1 then goto UpdateList;
Stop;