Delete the Quotes and keep the Symbol/Watchlists in my DB

I have an ASCII DB that i have imported and have WatchLists associated with that DB. I can update the DB by importing new data. However, I noticed that there are many bad dates in the DB which I have cleaned up in a new ASCII folder but when I re-import the data, if a bad date is present in the existing DB but not in the new DB, the bad date is not deleted from the file.

How can I delete all files in the existing ASCII DB in AmiBroker and still keep the Datalists of symbols?

Thanks,

Mike

hello Mike

ASCII data base for me means an .txt or .csv file. So your question is no correct.

Also i think this is a dublicate post like this one. sorry

One more addition of how to delete Quote is go to Amibroker Menu -> Symbol -> Quote Editor

I have 10,000 plus securities in my AmiBroker DB so the Quote editor it not efficient way to handle.

I think my question correctly states that I imported an ASCII DB to AmiBroker not that I am working with an ASCII DB is AmiBroker. The data is imported and Watchlists created from the imported DB.

If I can’t delete the data and re-import a new DB with all the same symbols as those in the created WathLists the efficient solution will be to copy all the symbols in each Watchlist as file, then delete/remove the symbols, import and create a new DB, and then recreate the WatchLists.

Since the imported DB is static, an option to overwrite all data on the import would be helpful. As if now, it seems you can import data and it will overwrite the data if a date if the date exists in the new & old file, but if the date exists in the old file and not in the new file, the old date and data is kept and not deleted.

Thanks for your reply.

Mike

1 Like

Hello Mike.
this is what i read " How can I delete all files in the existing ASCII DB"
Any way i don’t think there is a better way of what @Tomasz answer already on the other post

Yes I understood your problem is “how to delete the dates that are not exist in your ASCII data file“

if you like visit that links also
https://www.amibroker.com/guide/h_workspace.html
https://www.amibroker.com/guide/h_watchlist.html

Good luck Mike.
i hope there is another solution

edit:
I never try but I just saw with right click on watch list and then export…

As explained in manual
http://www.amibroker.com/guide/x_files.html

You can keep broker.master and broker.workspace files and it will keep all your symbols without keeping quotes.

Of course direct manipulation / deletion of files in AmiBroker database when done incorrectly will lead to data loss.

Hi Tomasz,

I reviewed your link but do not see any direct instructions on how to do it correctly. I did see a highlight that “in most cases you should not touch files in an AmiBroker database” and your comment above re direct manipulation does give me pause. I do see all the files and folders in the AmiBroker “data” folder, including broker.master and broker.workspace. Can all files except broker.master and broker.workspace simply be deleted manually?

If not I think my safest course of action is to copy the symbols from each Watchlist and then create a new DB with the corrected data, and then create the watchlists again. Is there a simple way to export all the symbols in a watchlist to a txt file?

Thanks,

Mike

The document I pointed in previous reply says this:

Data - default database folder, contains broker.master, broker.workspace, 0-9, A-Z, ‘_’ symbol data subfolders and Layouts subfolder. Read this to learn more about AmiBroker database concepts

So you just can delete: 0-9, A-Z, ‘_’ symbol data subfolders
This will delete quotes and annotations, without touching anything else.

Tomasz,

OK, will give give it a shot.

Thank you!!

Mike

Tomasz,

Worked perfectly!

Thanks again,

Mike

1 Like

Good morning, I read the article named " How to delete quotes without removing the symbol from a database" . You can find it in this link: AmiBroker Knowledge Base » How to delete quotes without removing the symbol from a database

In that document Tomasz provides the OLE code to delete a single symbols. Unfortunately I do not know Java and I do not know how to modifiy such code so you can delete several symbols at once. The code is the following:
/ THIS IS NOT AFL // This is Windows script to be run from the outside of AmiBroker function RemoveAllQuotes( Name ) { AB = new ActiveXObject("Broker.Application"); Stk = AB.Stocks( Name ); Quotes = Stk.Quotations; iQty = Quotes.Count; for( i = iQty - 1; i >= 0; i-- ) { Quotes.Remove( i ); } AB.RefreshAll(); } RemoveAllQuotes("MSFT"); WScript.Echo ( "Completed" );


I do not know if adding the symbols you want to delete separated by comas would work , I would be like RemoveAllQuotes ("MSFT", "APPL")  : i am Afraid it wil not be so simple. Ideally , It would be great  to include a list of the symbols  or that the code refers to a list of symbols . In addition , I guess that We would have to include in the code also the Database from  which we want to delete the quotes.  I am not sure If this line of code wil do that: AB. LoadDatabase( "C:\\programfiles\\Amibroker\\"Name of the database"). I would place this line of code After the current first line. 

Does anyone know how to do it?. 
Thanks a lot

@Eddie, if you want to delete the quotations only for a limited number of stocks, the easiest way is to modify the JScript code of the cited article by duplicating the line that invokes the function and changing the stock name for each line as below:

// THIS IS NOT AFL
// This is Windows script to be run from the outside of AmiBroker
function RemoveAllQuotes( Name )
{
    AB = new ActiveXObject("Broker.Application");
    Stk = AB.Stocks( Name );
    Quotes = Stk.Quotations;
    iQty = Quotes.Count;
    for( i = iQty - 1; i >= 0; i-- )
    {
       Quotes.Remove( i );
    }
    AB.RefreshAll();
}

RemoveAllQuotes("MSFT");
// Add all the stocks you want to remove the quotations
RemoveAllQuotes("FB");
RemoveAllQuotes("AMZN");
RemoveAllQuotes("AAPL");
RemoveAllQuotes("NFLX");
RemoveAllQuotes("GOOGL");
RemoveAllQuotes("GOOG");
// etc... this is a comment ignored during the execution
WScript.Echo ( "Completed" );

Be sure to carefully follow the provided instructions.

Since probably you are unfamiliar with OLE, I suggest making a backup copy of your database before launching the JS script.

1 Like

Thanks a lot beppe.

I apreciated a lot.

Best

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.