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

RE: [amibroker] exporting to txt file modified data



PureBytes Links

Trading Reference Links

Year format is YYYYMMDD

KR
        Michael.


At 05:59 AM 23/03/2003 +0800, you wrote:

I am having a little problem getting the export right so that I can 
convert the csv file back into MS database. The MS downloader wont accept 
the date format that is standard, so I removed the normal first 2 columns 
and tried alternatives. They seem to come up with funny dates in the 
exploration. In the example below I have used datenum()+19000000 to get 
the date format in yyyymmdd. To show the prob I have put back the standard 
ticker & date columns. Basically I get the same date for 3 consecutive 
bars. Datenum() is the 3rd column J The datenum() result is ok if I do not 
add the 19,000,000.



BPT     14/03/2003      20030314        30.5     31.0     30.0     30.0 
 30634

BPT     17/03/2003      20030316        30.5     31.0     30.0     31.0 
 124793

BPT     18/03/2003      20030318        30.0     31.0     30.0     30.0 
 16885

BPT     19/03/2003      20030320        31.0     31.0     30.0     30.0 
 21608

BPT     20/03/2003      20030320        30.5     31.0     30.5     31.0 
 81143

BPT     21/03/2003      20030320        31.0     31.5     31.0     31.0 
 154565

Cheers,
Graham

<http://groups.msn.com/ASXShareTrading>http://groups.msn.com/ASXShareTrading

http://groups.msn.com/FMSAustralia

-----Original Message-----
From: Graham [mailto:gkavanagh@xxxxxxxxxxxxx]
Sent: Sunday, 23 March 2003 5:32 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] exporting to txt file modified data



Thanks, but just tried the link and after closing, then re-closing many 
pop up adds, the site ends up being non existent, then I got a request to 
make another site my home page. Do you have another link for this.?



Cheers,
Graham

<http://groups.msn.com/ASXShareTrading>http://groups.msn.com/ASXShareTrading

http://groups.msn.com/FMSAustralia

-----Original Message-----
From: Panos Boufardeas [mailto:akaraman@xxxxxxx]
Sent: Sunday, 23 March 2003 12:24 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] exporting to txt file modified data



Frst export your data
// Exporting more than one stock to CSV or txt
Filter =1; /* all stocks and quotes accepted */
AddColumn(Open,"Open ", 1.2);
AddColumn(High,"High ", 1.2);
AddColumn(Low,"Low  ", 1.2);
AddColumn(Close,"Close", 1.2);
AddColumn(Volume,"Volume", 1.0);

Then
I use www.ultraeditor.com programm

A 32mb ascii file take less than one minute on AMD 1200hz

i dont know if you are looking for something like that but
This macro find comma ,end zeros at the end of the line
And delete this line
---------macro start------------
InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Loop
Find MatchCase RegExp ",0+"
IfFound
Find MatchCase RegExp ",0+"
DeleteLine
Top
Else
ExitLoop
EndIf
EndLoop
Top

-----------end of macro

  Thanks
Panos  Boufardeas
akaraman@xxxxxxx


At 05:10 μμ 22/3/2003 +0200, you wrote:

hi
can you send me a sample of your ASCII file  i think i can help you

  Thanks
Panos  Boufardeas
akaraman@xxxxxxx



At 12:45 μμ 22/3/2003 +0800, you wrote:
>I use the export dll supplied on the Amibroker library to back up and make
>some modifications to my databases. Thanks to who supplied it, absolutely
>fantastic.
>I have used this before to round off the data supplied in the far past. This
>works ok when you just need to make changes to the OHLCV data directly, but
>I want to remove all zero volume days from the database without it taking a
>month of Sundays to complete.
>I have tried adding filters and additional buy condition to the line
>Buy=bhExportAsMetaStock("c:\\MSBackup");
>
>Such as:
>
>Buy=bhExportAsMetaStock("c:\\MSBackup") AND V>0;
>
>But it still exports the whole data without change.
>
>Can anyone help me with a method of doing this
>TIA
>
>Cheers,
>Graham
>http://groups.msn.com/ASXShareTrading
>http://groups.msn.com/FMSAustralia
>
>
>
>
>Send BUG REPORTS to bugs@xxxxxxxxxxxxx
>Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
>-----------------------------------------
>Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
>(Web page: http://groups.yahoo.com/group/amiquote/messages/)
>--------------------------------------------
>Check group FAQ at:
>http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: 
<http://groups.yahoo.com/group/amiquote/messages/)>http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: 
<http://groups.yahoo.com/group/amibroker/files/groupfaq.html>http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


Your use of Yahoo! Groups is subject to the 
<http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: 
<http://groups.yahoo.com/group/amiquote/messages/)>http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: 
<http://groups.yahoo.com/group/amibroker/files/groupfaq.html>http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


Your use of Yahoo! Groups is subject to the 
<http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.

Yahoo! Groups Sponsor
ADVERTISEMENT
<http://rd.yahoo.com/M=243066.2784921.4151384.1927555/D=egroupweb/S=1705632198:HM/A=1377502/R=0/*http://www.verisign.com/cgi-bin/go.cgi?a=b31550113206004000>813666d.jpg
81366c7.jpg

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: 
<http://groups.yahoo.com/group/amiquote/messages/)>http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: 
<http://groups.yahoo.com/group/amibroker/files/groupfaq.html>http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


Your use of Yahoo! Groups is subject to the 
<http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.


/*
** AmiBroker/Win32 scripting Example 
** Modified for Exporting to StockAnal History
**
** File:	HistoricalExport_all.js
** Created:	Tomasz Janeczko, December 12th, 1999
** Modified:	OzFalcon@xxxxxxxx, March 10th, 2003
** Purpose:	Exports quotations to CSV file to update archive backup.
** Language: 	JScript (Windows Scripting Host)
*/

FileSys = new ActiveXObject( "Scripting.FileSystemObject" );

/* The folder where the DOHLC *.csv file will be exported into */

DestDir = "HIST\\";

function CheckFolder()
{
	if( ! FileSys.FolderExists( DestDir ) )
	{
		FileSys.CreateFolder( DestDir );
	}
}

CheckFolder();

function FormatFloat( number )
{
	number = 0.001 * Math.round( number * 1000 );
	str = number.toString();

	return str.substring( 0, str.indexOf(".") + 4 );
}

var oAB = WScript.CreateObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");

var oStocks = oAB.Stocks;
var StockQty = oStocks.Count

WScript.Echo("Export of ALL Tickers start" );

for( s = 0; s < StockQty; s++ )
{
	oStock = oStocks( s );

	var Ticker = oStock.Ticker;
	var Qty = oStock.Quotations.Count; 
	
	oQuote = oStock.Quotations(Qty-1);

	 var oDate = new Date( oQuote.Date );
	
	 y = oDate.getFullYear();
	 m = oDate.getMonth() + 1;
	 d = oDate.getDate();
 
	outdate = y + ( m < 10 ? "0" : "" ) + m + ( d < 10 ? "0" : "" ) + d;	

	Qoutfile = DestDir + Ticker + "_historical_" + outdate + ".csv"
	
	f = fso.OpenTextFile( Qoutfile, 2, true );
			
	f.Writeline("Historical for " + Ticker);
	f.Writeline("Daily Historical Data for " + Ticker);
	f.Writeline("Data Dump From AmiBroker");
	f.Writeline("Historical Export ALL Tickers");
	f.Writeline(" ");
	f.WriteLine("Date,Open,High,Low,Close,Volume");

	for( i = 0; i < Qty; i++ )
	{
	 var cnt = (Qty - i);
	
	 oQuote = oStock.Quotations(cnt-1);

	 var oDate = new Date( oQuote.Date );
	
	 y = oDate.getFullYear();
	 m = oDate.getMonth() + 1;
	 d = oDate.getDate();
 
	 outdate = ( d < 10 ? "0" : "" ) + d + "/" + ( m < 10 ? "0" : "" ) + m + "/" + y;		

	 f.WriteLine( 	outdate + "," +
			FormatFloat( oQuote.Open ) + "," + 
			FormatFloat( oQuote.High ) + "," +
			FormatFloat( oQuote.Low ) + "," +
			FormatFloat( oQuote.Close ) + "," + 
			Math.round( oQuote.Volume )  );
	}

f.Close();
}

WScript.Echo("Export finished" );
/*
** AmiBroker/Win32 scripting Example 
** Modified for Exporting to StockAnal History
**
** File:	HistoricalExport.js
** Created:	Tomasz Janeczko, December 12th, 1999
** Modified:	OzFalcon@xxxxxxxx, March 10th, 2003
** Purpose:	Exports quotations to CSV file
** Language: 	JScript (Windows Scripting Host)
*/

FileSys = new ActiveXObject( "Scripting.FileSystemObject" );

/* The folder where the DOHLC *.csv file will be exported into */

DestDir = "hist//";

function CheckFolder()
{
	if( ! FileSys.FolderExists( DestDir ) )
	{
		FileSys.CreateFolder( DestDir );
	}
} 

CheckFolder();


function FormatFloat( number )
{
	number = 0.001 * Math.round( number * 1000 );
	str = number.toString();

	return str.substring( 0, str.indexOf(".") + 4 );
}

var oAB = WScript.CreateObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");

var oStocks = oAB.Stocks;

Ticker = oAB.ActiveDocument.Name;

oStock = oStocks( Ticker );

var Qty = oStock.Quotations.Count; 

WScript.Echo("Export of " + Ticker + " start" );

	 oQuote = oStock.Quotations(Qty-1);

	 var oDate = new Date( oQuote.Date );
	
	 y = oDate.getFullYear();
	 m = oDate.getMonth() + 1;
	 d = oDate.getDate();
 
	 outdate = y + ( m < 10 ? "0" : "" ) + m + ( d < 10 ? "0" : "" ) + d;	

Qoutfile = DestDir + Ticker + "_historical_" + outdate + ".csv"

WScript.Echo("Outfile: " + Qoutfile );

f = fso.OpenTextFile( Qoutfile, 2, true );

f.Writeline("Historical for " + Ticker);
f.Writeline("Daily Historical Data for " + Ticker);
f.Writeline("Data Dump From AmiBroker");
f.Writeline("Historical Export Single Ticker");
f.Writeline(" ");
f.WriteLine("Date,Open,High,Low,Close,Volume");

for( i = 0; i < Qty; i++ )
{
	var cnt = (Qty - i);
	
	oQuote = oStock.Quotations(cnt-1);

	var oDate = new Date( oQuote.Date );

	y = oDate.getFullYear();
	m = oDate.getMonth() + 1;
	d = oDate.getDate();

	outdate = ( d < 10 ? "0" : "" ) + d + "/" + ( m < 10 ? "0" : "" ) + m + "/" + y;		

	f.WriteLine( 	outdate + "," +
			FormatFloat( oQuote.Open ) + "," + 
			FormatFloat( oQuote.High ) + "," +
			FormatFloat( oQuote.Low ) + "," +
			FormatFloat( oQuote.Close ) + "," + 
			Math.round( oQuote.Volume )  );
}

f.Close();

Attachment: Description: "WScript.Echo("Export finished" );"

Attachment: Description: ""