Classic Computer Magazine Archive ANTIC VOL. 6, NO. 5 / SEPTEMBER 1987


Annual % Rate

How much do your $$$ really earn?


It's confusing to try to figure out the real percentage of gain you're earning from your savings and investments. But Annual % Rate will help you find the answers. This BASIC program works on Atari 8-bit computers with at least 32K. A disk drive is required.

Have you ever wondered what was the real percentage of gain from your own savings program--such as your investment plan at work or that IRA nest egg you've been saving? Or what if you save different amounts at irregular intervals while the rate of return changes or is unknown?

Your handy calculator would probably let you down if you tried to crunch these numbers with it. But with the Annual % Rate program, your Atari can find the "effective annual rate of return" for many investments and savings plans. This program works for savings accounts, stocks, bonds and mutual funds, as well as combinations of these investments.

Total balances, gains, averages and durations are calculated from the amounts and dates that you put into a data file. The yield percentages (effective rates of return) are computed from your average daily balance and the gains received or compounded are calculated from your savings.

The program also can estimate gains accrued since the last payment date, based on the rate of return from the previous period. Percent yields are shown for both the current term and overall (from the starting date to the most recent gain date). All data, along with descriptions of each entry, can be saved to a disk file called APR.DAT, for later additions or modifications.

Although the word gain is used for consistency throughout these instructions, the terms interest, dividend, or appreciated value can he substituted when you use the program to track savings accounts, stocks, bonds, mutual funds, etc. to determine the current value of your holding. The gain would then be that value, minus your total savings to date, minus the sum of any previously posted gains. This might just be the change in value since the last posted gain.

For some investments, the gain could be a negative number--a loss. Enter losses as negative gains using the "Gain Credit (Fund Change)" selection from the entry type menu. The total gains received to date are included on the results screen and as part of the printout. You may choose to track a fund weekly, monthly, annually or whenever you'd like to know how you're doing.

Remember that fees, commissions, points, premiums, etc. can be included in your entry amounts to help find the actual APR of return. By learning actual returns from alternative investments, your ability to make better financial decisions will be enhanced.


Type in Listing 1, APR.BAS, checking it with TYPO II, and SAVE a copy before you RUN it.

   No matter which computer you use, it may be convenient to include an AUTORUN.SYS file on your Annual % Rate disk to make the programs load and run automatically.

Listing 2 will create this type of file for you. Type in Listing 2, check it with TYPO II, and SAVE a copy before you RUN it. When RUN, Listing 2 creates a disk file called AUTOAPR.SYS. (Antic Disk owners will find AUTOAPR.SYS on the September 1987 monthly disk.) Change the name of AUTOAPR.SYS to AUTORUN.SYS and your Annual % Rate program will load and run automatically. Note that you don't need these files to use Listing 1.

When the main APR menu appears, use the first two menu items to enter the amounts, dates and descriptions for an account, fund or investment.

The first time through, just make up some simple numbers and work through the program cycle so you can become familiar with it. Some prompts ask you to press a key, while others want you to type in a number, amount or description. A single keypress makes menu selections, while you need to press the [RETURN] key following each entry of "inputted" data. Often [RETURN] is all you need for a blank or default entry.


Choose selection 1 from the main menu. This initial entry is the balance and date for the beginning of computations. It could be the initial amount saved or the cost of the investment. For existing accounts use the balance (value) on the gain (interest payment) date that represents the beginning of the period to be checked.

For subsequent entries, you can choose among five types:

   1--Gain stays (is compounded) in the account.
   2--Gain leaves the account. For example, when you get an interest check in the mail.
   3--Deposits (new savings) in the account.
   4--Withdrawals from the account.
   5--Estimate of accrued gain since the last gain entry date.

Don't worry if you make an error while typing in the data--it can be corrected later. Just complete the other items making up that entry.

After typing one or two entries of each type, use main menu selection 3 to display the entries onscreen. Note that each entry is numbered and the amounts are lined up in debit/credit columns. The second line of each entry shows whatever description you may have typed in. If you entered 10 for ten dollars, it appears as 10.00. The program adds the decimal and trailing zeros.

If you're familiar with BASIC editing via the [ARROW] keys, try main menu selection 4 to correct a date, description, or amount. Move the cursor to the entry and type over it. Just remember: Don't change the locations of the decimal point or the date delineators (/). After making corrections, press [RETURN] while the cursor is on either line of the entry. If you make a mistake in typing an entry number for correction, press [RETURN] without moving the cursor. The program then returns you to the main menu.

If you aren't familiar with the BASIC editor, use main menu selection 5 to delete an entry and selection 2 to re-insert the corrected version. Also, try the MOVE and SWAP features of 5. Display the entries as you go along, to prove to yourself that the repositioned entries were renumbered to stay in sequence.

When you're familiar with these menu items, put the entries in chronologiual order using the SWAP and MOVE features from main menu selection 5. If the program finds entries with the dates out of sequence, it either notes the error or thinks one of the dates is in the next century.

Next, use main menu selection 6 to calculate and display the yields. These may not make much sense with your made-up data sample, but the screen will show the date of the last entry, the current balance, the percentage yield between the last two gain dates and the approximate accrued gain since the date of the most recent gain entry. (A default rate of 5% is used if a gain entry was not found.) The total of all gains received to date is shown next, followed by the overall average daily balance since the first entry.

Finally, you see the annual effective rate of return (yield to date) from the first entry date to the date of the most recent gain entry. While computing, accrued gains are added to all type 5 "Calculation (No Fund Change)" entries. View these by returning to the main menu and using selection 3 to display the entries. Type 5 entries have no effect on percentage calculations or account balance. They're particularly useful for approximating the accrued gains to the current date or to some future date.


If your printer can work in compressed mode (about 130 characters per line) you may be able to use selection 7 to print a report showing how the percentages changed at each gain entry. This program was written for the Atari 825 or XMM801 printer. For proper alignment, centering and pagination on your own printer, you may need to know how to change the printer control codes in the HEADING and FILL subroutines.

Be sure to use main menu selection 8 to save the data lack to disk--it's a good idea to save to disk often. The data currently in memory replaces any APR.DAT file on that disk. If saved, the data is loaded automatically into memory the next time that you run Annual % Rate. If you do not wish to exit the program, type an "N" at the Do you really want to quit? prompt. This will return you to the main menu.

If you don 't want to save the data, use the "Delete All" function of 5 before quitting. When there are zero entries in memory, item 8 will not disturb an APR.DAT file.

You can use multiple disks when concurrently tracking sepatate accounts. It's also possible to find the overall performance for several items with a single set of data en tries, especially when the gain amounts can be combined on the same date (from market quotations, for example).

The number of possible entries for the particular Atari computer model used is shown in main menu selection 1. The program automatically adjusts to the particular configuration being used. The 48K and 64K computers can hold about 260 entries. These numbers could be increased slightly by deleting the REM lines from the program and deleting the lines 3380-3460, which are used only by the 130XE. As coded, the program recognizes and uses the extra 130XE memory. If the APR disk also has the DOS 2.5 RAMDISK.COM file, there will be room for 635 entries (770 if DUP.SYS is also deleted).

On the 130XE,the data is accessed from the RAMdisk rather than from the large data string (S$) located in "regular" memory of the other computers. The bottom of the title screen indicates entry numbers while the RAMdisk is being set up on the 130XE. For example, you might need additional entries when regular savings are deducted from each paycheck over a period of several years.

Bob Mueller is an electrical engineer with the Delco Products Division of General Motors. He has written several financial programs in BASIC on his Atari 800. This is his first publication in Antic.

Listing1:APR.BAS Download

Listing2:AUTOAPR.SYS Download