[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Culling database



PureBytes Links

Trading Reference Links

Hello, David & Peter:

On 29-Nov-00, Peter B. White wrote:

> Further to David's question about cleaning up the database.
> Is it possible to create a routine which will select stocks which have not
> been quoted for a week? If that list could be created then it would be a
> simple matter to delete them using the Delete function.

I have written to the list about this in the past, but it won't hurt to go
over it again. Maybe this needs to be made into an FAQ. Having built a number
of databases of complete exchanges, over the years, I still manually cull
non-trading stocks.

Why?

Some reasons that I use follow. Some may apply to how you update databases.
Other people may have just as valid reasons to do this automatically, but it's
not my style, since I use a method of adding *any & all* tickers found in the
data that I collect for my main databases. Therefore, deleting any currently
valid ticker would be pointless. My REBOL US data collecting programs depend
on the database itself being up-to-date - that keeps it simple.

In Canada (most countries now have one or more stock exchanges), we have three
main exchanges, plus a brand new NASDAQ Canada exchange. Some junior stocks on
junior exchanges grow up to be the big stocks, and I don't want to lose these
histories of possibly interesting & profitable companies. With a large
database, knowing when major changes occur to each and every ticker is nearly
impossible. If a company moves from a junior exchange to the senior TSE, I
would not want to automatically lose the history from the junior exchange's
database.

Even some fairly large US companies, such as Gateway (GATE @ NASD, now GTW @
NYSE), move between exchanges.

Also, not all stocks (micro-caps, prefereds, different classes, warrants &
rights, etc.) of a complete exchange will trade daily. Some trade only once or
twice a year. The Australian ASX has other worries.

If a take-over/merger makes a ticker redundant because it changed (JDS into
JDU), you may not want to lose the supporting data in an otherwise current AB
file.

An automatic culling program would delete these still important files. If you
make a mistake, you need to rebuild a file. While not usually a big deal
(depending upon the country, the data may be irreplacable!), it still takes
time).


Now, even if you don't follow a whole exchange, here are some suggestions to
make manual deletion more efficient. Some involve *no* programming, just
common sense & good organisation.

- decide more strictly, in the first place, whether you actually want to add a
new stock into your main database
- set up a database for new stocks, then move those you actually keep
up-to-date into your permanent database
- don't delete them (if the company interested you in the past, it might be
best to just keep the file - use filters to ignore low-interest tickers)
- use a script to make a list of all "last trades" or not recently traded
stocks, with tickers (and other useful info, if you wish...)
- refer to a hard copy for deletions, especially if you have many tickers
- an ARexx program, "names.rexx", at my web site may help with the program
logic
- this idea has many useful applications, so it is a good one to learn
- use a script to sequentially select any stock that hasn't traded in n-days,
then, optionally, manually do a delete (this should be pretty efficient
with small databases)
- set up a group for new tickers and use a script to delete all remaining in
that group** (be careful that the group really is up-to-date, first)
- look with your file manager at the file dates of the database files,
then delete out-of-date stocks
- do this only with AmiBroker *not* running
- ONLY do this if you know your tickers *very, very* well
- alternatively, don't delete the files, move them to a temp drawer,
then delete them later (if you change your mind, you don't need to
rebuild the file, just up-date it)

I am sure there are more ways of doing this, but this should be enough to get
you thinking about some very different ways to get the job done. Just think
>very seriously< as to whether you really want to do it automatically, though.


One subject that I still have to work on is automatically deleting any
supporting files, such as a profile, for a stock that we need to eliminate.

** I still think it would be a good idea to be able to display only those
stocks in a group, sector, industry or market.

Please let me know if this helps anyone out there.

-- 

---===///||| Donald Dalley |||\\\===---
The World of AmiBroker Support
http://webhome.idirect.com/~ddalley
UIN/ICQ#: 65203020