PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Kapil Marwaha" <kapilmar@xxx> wrote:
>
> Friends,
>
> Can anyone tell me how I can delete the intra-day tick data of a
> particular date or a group of dates for all the scrips in my database
> or a select number of scrips in my database.
>
> Can it be done at all in Amibroker? Tomasz ?
>
I wrote script, which remove all quotations in last X days.
/*
** AmiBroker/Win32 scripting Example
**
** File: remove_xdays.js
** Version: 0.1 beta
** Purpose: Remove all quotations from last xx days for
all symbols !
** Language: JScript (Windows Scripting Host)
**
**
** CHANGE variable nDaysToDelete
** CHANGE variable DataDir
**
** ENJOY :-)
*/
// How many last days you want to delete
var nDaysToDelete = 2;
// where database is stored
fs = new ActiveXObject("Scripting.FileSystemObject");
a = fs.OpenTextFile("path.txt", 1, true,0);
DataDir=a.ReadLine();
a.Close();
//DataDir = "C:\\BossaIntra2"
var oAB = new ActiveXObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
file = fso.OpenTextFile( "_remowe_xdays.log", 2, true );
oAB.LoadDatabase( DataDir );
var oStocks = oAB.Stocks;
var Qty = oStocks.Count;
var MiliSecInDay = 24 * 60 * 60 * 1000;
var Today = new Date();
// make date with time 00:00:00
var DayDeleteFrom = new Date((Math.floor(Today / MiliSecInDay
)-nDaysToDelete+1) * MiliSecInDay);
var DayDeleteFromNum = (Math.floor(Today / MiliSecInDay
)-nDaysToDelete+1) * MiliSecInDay;
file.WriteLine( "Starting delete quotes from date:" + DayDeleteFrom);
file.WriteLine( "" );
for( i = 0; i < Qty; i++ )
{
oStock = oStocks( i );
file.Write( i + ". " + oStock.Ticker + "=" );
for (j=oStock.Quotations.Count-1;j>=0;j--)
{
//file.Write( "j=" + j + "," );
//tmpDate = new Date( oStock.Quotations( j ).Date );
tmpDateNum = oStock.Quotations( j ).Date ;
if (tmpDateNum >= DayDeleteFromNum)
{
//file.WriteLine( "Delete data=" + tmpDateNum);
oStock.Quotations.Remove(j);
}
else
{
//file.WriteLine( "Last data no to delete=" +
tmpDateNum);
break;
}
}
file.WriteLine( "OK" );
}
oAB.SaveDatabase( );
file.Close();
WScript.Echo("Cleanup ended :-)" );
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|