How to remove symbol(with white space as name) from the database

I think it was due to bugs in my AFL testing earlier, some tickers were created in the database with no name and no data. ie the sysmbols are displayed as white space visually.

I tried to delete them using the AB UI but just cannot get ride of them. As the symbols cannot be displayed it make it difficult to code AFL to delete them either.

Would appreciate if senior users can suggest some solution for getting rid of the white symbols.

Thank you,
jimmy

@etcjkam, did you run the built-in cleanup script? (from the “Tools” menu select “Cleanup database”),

This procedure will run a built-in script (located in the “scripts” subfolder of AmiBroker that should get rid of the tickers with no quotes or no longer traded.

But the fact that you see some “empty” ticker names is a bit surprising… Each ticker in AB is saved as a single file, and in Windows, you cannot have “empty” filenames or filenames that start with some spaces!
See the documentation about Amibroker database structure: Understanding AmiBroker database concepts
You may take a look under the subfolders in your database directory (I mean the ones that are named a, b, c, d, etc.) if there is something strange there and report it.
As an additional step, with the AmiBroker application closed, delete the “broker.master” file in the main database folder. AmiBroker will rebuild it as needed.

On the other hand, if the problem is that you have some tickers (and corresponding associated filenames) that includes some space (or other some strange chars) that causes the “empty” display issue, probably the best way to get rid of them is to do it again via the OLE interface. To achieve it, you should modify the built-in cleanup.js script (or better create a similar one) in which you add a new condition that search for a space/or a special char in the “oStock.Ticker”; if found you ask (or do it without asking as appropriate) to add that ticker to the “oStocksToDelete” list.

But do this only if you are familiar with JScript; in any case before doing it backup your database!

An if nothing helps… delete the database and rebuild it from scratch reimporting all the quotes as needed!

1 Like

Dear Beppe,
Thank you very much for your patience and detailed explanation. I think your comments make lots of sense and did the following.
I ran the database cleanup script and saw a series of dialog box asking if the symbol should be deleted and “yes” I choosed. At the end the script ask for confirmation of deleting hundreds of symbols and I confirmed. The script end with a termination message. All is well so far.
I closed AB then went into the database directory and deleted the broker.master file. When I reopen AB, strangely those symbols seems to be there still. i ran database purify and those white symbols remain in the database still.

I wonder what was wrong and why the script was not able to delete the symbols

Best regards
jimmy

@etcjkam, as said your situation is strange: in theory, AmiBroker should not allow any empty ticker name (by the way which version of AmiBroker are you using?).

There is one additional test that could help to understand better what is going on on your PC: when you select an empty ticker (no name) and you open the “Quote editor” window (from the main menu “Symbol” / “Quote editor”) what is displayed? Any quote? Any chars in the “Ticker” column?

As a further attempt, I suggest you run (from the command line or the graphical user interface) a Windows “Check Disk” procedure (search in Google how to do it if you are not familiar with it).
This will check the integrity of your hard disk data (if you have multiple hard disks start with the disk where your AmiBroker database is located).
If you specify the flag to fix data errors the procedure may require a full system reboot and could take quite a while to complete.

To save this thread from a lot of blabla leading to no where…

You dont require to delete DB.

Go to Symbol - Organize assignments
https://www.amibroker.com/guide/w_organizer.html

Then choose the market having your empty symbol rows and mark all of them at once. Then click delete button in the middle of assignment window. Choose multiple symbols option in appearing next window. Done! Save DB.

If we talk about the same thing then upper method will work because it worked on another guy PC’s AB DB I fixed.

@fxshrat thanks for jumping on this thread. I hope this will solve it for @etcjkam.

I hoped that someone that already saw/experienced a similar problem could post the proper solution (my search for it was unsuccessful, but I was quite puzzled how this empty tickers could happen so I tried to give some basic AmiBroker DB maintenance suggestions).

If upper method does not work then actual solution would be the following…

  1. Close AmiBroker first.
  2. Go to your problematic database on your hard drive.
  3. Open the DB folder and in there at the bottom of all subfolders there is a file named Broker.master
  4. Just delete that file named Broker.master of your data base.
  5. Start AmiBroker again
  6. “Symbols” having no name should have been gone (I tested it and it worked here)

What is deletion of Broker.master doing? After restart of AmiBroker it will re-create the database from the existing stock symbol files because the symbol information is available in each of those individual symbol data files (being located in the DB sub folders) also.

So since empty symbols rows without any name have no information and since they do not have any data files they will be removed after upper procedure.


More information on AB files
http://www.amibroker.com/guide/x_files.html
as well as DB concept
http://www.amibroker.com/guide/h_workspace.html

As for the symbol data files of database’s 0-9, a-z, ‘_’ subfolders…
Quote:

A database (or a workspace) is a directory that holds a set of binary files, which are stored in 0-9, a-z, ‘_’ subdirectories. Those binary files hold quotes, symbol information, your studies (trend lines, Fibonacci stuff). Each symbol’s information is stored separately in the file with the name of the ticker symbol located in the subdirectory corresponding to the first character of the symbol, so IBM quotation data/studies are stored in the ‘IBM’ file located in the ‘I’ subdirectory (more information on this in the User’s Guide).

3 Likes

@beppe,
Thank you for the suggestion. I did see the white tickers with no quotes from the quote editor but unable to delete them.

@fxshrat,
I used the category assigment function and saw the tickers. I highlighted them and choosed delete. However I could still not delete them.
I exit AB try to find the broker master in the db direction but could not find it. I actually deleted them before per @beppe suggestion earlier on. The strange thing is that since then I have restart AB several time and AB work normally but broker master is not recreated. This may shed some light on the problem.

Looking forward to your analysis and advises.

Again thanks to both gentleman help so far. It is much appreciated.

Jimmy

To have the broker.master file recreated you have to save at least once your database.
You can do it in different ways: like importing new quotes using AmiQuote or, for instance, use the “Symbol Information” window (from the main menu select “Symbol” then “Information”). Change any property of one or more tickers (like the “Full name”, and/or the “Alias” field).
Once done your change, you can save your database and/or watchlists and save the changes (from the main menu select “File” then “Save All”).
If you do not do it explicitly a “save” prompt may appear when you exit the application (in such a case answer positively).

If you do the above steps, the broker.master should be recreated automatically. Verify its presence.

Reopen the application and use the Symbol/Information window again to verify that also your previous changes were properly saved.

Yes deleting broker.master is quickest solution. This file is just for speeding up loading symbol list so AmIBroker does not need to open thousands of files at start. But other than that it contains redundant information (found in individual symbol files) so it can be safely deleted.

1 Like

Hi gentleman,
I updated the database, save all, exit AB. reopen AB but still can find broker.master under the said directory.
I am being to suspect maybe something in AB has been damaged?

jimmy

sorry I meant cannot find...

Not "Save all" but File->Save Database.

@Tomasz,
I updated the database again, choose save db, exit and restart AB. The broker master file still not in sight.

I am using 6.20.1

Jimmy

THANKS "FXSHRAT".
IT SOLVE MY PROBLEM EASILY.
BROKER .MASTER CREAT IT SELF AND EMPTY SYMBOL IS NOT THERE.

THANKS ONCE AGAIN SIR.[quote="fxshrat, post:7, topic:4019, full:true"]
If upper method does not work then actual solution would be the following...

  1. Close AmiBroker first.
  2. Go to your problematic database on your hard drive.
  3. Open the DB folder and in there at the bottom of all subfolders there is a file named Broker.master
  4. Just delete that file named Broker.master of your data base.
  5. Start AmiBroker again
  6. "Symbols" having no name should have been gone (I tested it and it worked here)

What is deletion of Broker.master doing? After restart of AmiBroker it will re-create the database from the existing stock symbol files because the symbol information is available in each of those individual symbol data files (being located in the DB sub folders) also.

So since empty symbols rows without any name have no information and since they do not have any data files they will be removed after upper procedure.


More information on AB files
http://www.amibroker.com/guide/x_files.html
as well as DB concept
http://www.amibroker.com/guide/h_workspace.html

As for the symbol data files of database's 0-9, a-z, ‘_’ subfolders...
Quote:

A database (or a workspace) is a directory that holds a set of binary files, which are stored in 0-9, a-z, ‘_’ subdirectories. Those binary files hold quotes, symbol information, your studies (trend lines, Fibonacci stuff). Each symbol’s information is stored separately in the file with the name of the ticker symbol located in the subdirectory corresponding to the first character of the symbol, so IBM quotation data/studies are stored in the ‘IBM’ file located in the ‘I’ subdirectory (more information on this in the User’s Guide).
[/quote]