PureBytes Links
Trading Reference Links
|
you have some parts missing - this may give you some guidence.
best
curt
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
WshShell = new ActiveXObject( "WScript.Shell" );
FileSys = new ActiveXObject( "Scripting.FileSystemObject" );
var oAB = new ActiveXObject("Broker.Application");
var t= "_1"; var StocksToDelete ="";var oStocks = oAB.Stocks;//1 NOT
01
var di_r = "d:\\AMIBROKER\\HQUOTE\\Portfolio1\\" ;
//database ()//loads proper database
deleteold()//deletes old tickers from AB
filechgto() //changes filename for import also imports to AB
filechgback()// changes name back for next update or clear files
/*12fffffffffffffffffffffffffffffffffffffffffffffffffffffff*/
function filechgto()
{{ fd = fso.OpenTextFile("QT.txt",1);
ticklinedelete = fd.ReadLine();}
fd.close();
var line = "";
ticker=ticklinedelete.split(",");
f = fso.OpenTextFile( "d:\\AMIBROKER\\HQUOTE\\Portfolio1
\\bat.bat",2);
i=0;
//WScript.echo(f);
var di_r = "d:\\AMIBROKER\\HQUOTE\\Portfolio1\\" ;
while (ticker[i] > "")
{//WScript.echo(ticker[i]);
line = "rename" + " " + di_r + ticker[i] + t+".txt" + " " +
ticker[i] + ".txt";
f.WriteLine(line);
i++
}
f.Close();
WshShell.Run("d:\\AMIBROKER\\HQuote\\Portfolio1\\bat.bat",1);
i=0;
{ while (ticker[i] > "")
{ //WScript.echo("import "+di_r+ ticker[i]);
oAB.Import( 0,(di_r + ticker[i] + ".txt") , "hquote.format" );
i++ }
oAB.RefreshAll();
} }
/*41ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff*/
/*fffffffffffffffffffffffffffffffffffffffffffffffffffffff*/
function filechgback()
/* open QT.txt file , rename files -import-nameback */
{{ fd = fso.OpenTextFile("QT.txt",1);
ticklinedelete = fd.ReadLine();
fd.close();
var line = "";
ticker=ticklinedelete.split(",");
i=0; }
f = fso.OpenTextFile("d:\\AMIBROKER\\HQUOTE\\Portfolio1
\\bat.bat",2);
while (ticker[i] > "")
{line = "rename" + " " + di_r + ticker[i] + ".txt" + " " + ticker
[i] + t + ".txt" ;
f.WriteLine(line);
i++
}
f.Close();
WshShell.Run("d:\\AMIBROKER\\HQUOTE\\Portfolio1\\bat.bat",1);
}
/*62xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/*function Import(di_r,ticker[i])
{
oAB.Import( 0,(di_r + ticker[i] + ".txt") , Format );
oAB.RefreshAll();
} */
/*68xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
function deleteold()
{
f = fso.OpenTextFile("oldlist.txt" ,1);
i=0;
ticklinedelete = f.ReadLine();
var StocksToDelete = ticklinedelete.split(",");
f.close();
//WScript.echo("1"+StocksToDelete[i]);
//WScript.echo("1"+StocksToDelete[i]);
while (StocksToDelete[i] > "")
{
//WScript.echo("2"+StocksToDelete[i]);
oStocks.Remove( StocksToDelete[ i ] );
i ++
}
oAB.RefreshAll();}
//WScript.echo("3"+StocksToDelete[i]);
/*88xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
function database ()
{if (oAB.DatabasePath != "d:\\AMIBROKER\\INTRADAYab");
{ oAB.LoadDatabase("d:\\AMIBROKER\\INTRADAYab");
oAB.SaveDatabase();
}}
--- In amibroker@xxxxxxxxxxxxxxx, "salil_gangal" <salil_gangal@xxxx>
wrote:
> Friends,
>
> I coded the script. It works. It import the data. However, when I
> invoke AmiBroker, all the windows are screwed-up. Their sizes are
all
> different. The securities that they all display is the first
> security in the database. Any input ? (Also, I found that the
> commented section that deals with LoadDatabase produces error
[object
> error]. Any idea how to fix this ? BTW, the database exists in
the
> folder, so its not as if the database is not present for
LoadDatabase
> to load.)
>
> Script ===>
>
=====================================================================
> WScript.Echo( "invoking");
> Amibroker = new ActiveXObject("Broker.Application");
>
> /****
> WScript.Echo( "loading database");
> try
> {
> Amibroker.LoadDatabase("C:\\AMI\\AmiFast");
> }
> catch ( e )
> {
> WScript.Echo( "error loading" + e );
> }
> ****/
>
> WScript.Echo( "importing");
>
> try {
> Amibroker.Import
>
(0,"C:\\AMI\\AMISYSTEMS\\VIX.CSV", "C:\\AMI\\AMISYSTEMS\\VIX.FORMAT")
;
> }
> catch ( e )
> {
> WScript.Echo( "error importing" );
> }
>
> WScript.Echo( "refreshing");
> Amibroker.RefreshAll();
>
> WScript.Echo( "saving");
> Amibroker.SaveDatabase();
>
> WScript.Echo( "done");
>
=====================================================================
>
> Regards,
> - Salil V Gangal
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "salil_gangal"
<salil_gangal@xxxx>
> wrote:
> > Tomasz,
> >
> > True !
> >
> >
> > >>BTW: AmiBroker's OLE interface is the workhorse of
> > many 3rd party tools released recently, unfortunatelly
> > general public never really noticed / used the interface
> > directly.<<
> >
> > (Guilty as charged ! *smile*)
> >
> > However not taking notice will change soon. As the requirements
> > increase, so does the attention paid to the various native
> facilities
> > offered.
> >
> > Regards,
> > - Salil V Gangal
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> <amibroker@xxxx>
> > wrote:
> > > Yes Salil, it is simple indeed, I told you :-))))
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "salil_gangal" <salil_gangal@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Saturday, August 02, 2003 1:37 AM
> > > Subject: [amibroker] Re: Data import automation - Is this
doable ?
> > >
> > >
> > > > Tomasz,
> > > >
> > > > Excellent solution ! I guess this serves my requirement
> exactly
> > as I
> > > > wanted. So it is as simple as ===>
> > > >
> > > > -----------
> > > > try
> > > > {
> > > > AmiBroker.Import( 0, filename, "prnn.format" );
> > > > }
> > > > catch( e )
> > > > {
> > > > return false;
> > > > }
> > > > AmiBroker.RefreshAll();
> > > > return true;
> > > > -----------
> > > >
> > > > Regards,
> > > > - Salil V Gangal
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > <amibroker@xxxx>
> > > > wrote:
> > > > > Hello,
> > > > >
> > > > > Yes it IS doable. Check NEWSLETTERS
> > > > > http://www.amibroker.com/newsletter
> > > > >
> > > > > especially
> > > > > http://www.amibroker.com/newsletter/02-2001.html
> > > > >
> > > > > It describes how to write a simple (few lines) script
> > > > > that allows to import automatically, using AMiBroker's
> > > > > OLE interface.
> > > > >
> > > > > There is a single function "Import" that just imports
ASCII
> > files.
> > > > >
> > > > > BTW: AmiBroker's OLE interface is the workhorse of
> > > > > many 3rd party tools released recently, unfortunatelly
> > > > > general public never really noticed / used the interface
> > directly.
> > > > > (it is not complicated at all)
> > > > >
> > > > > Best regards,
> > > > > Tomasz Janeczko
> > > > > amibroker.com
> > > > > ----- Original Message -----
> > > > > From: "salil_gangal" <salil_gangal@xxxx>
> > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > Sent: Friday, August 01, 2003 6:43 PM
> > > > > Subject: [amibroker] Data import automation - Is this
doable ?
> > > > >
> > > > >
> > > > > > Friends,
> > > > > >
> > > > > > Here is the background.
> > > > > >
> > > > > > 1) I have a 'database' sourced from external source.
> > > > > >
> > > > > > 2) I need to import *just* 1 security based on an ASCII
> file,
> > > > > > which *does not* exist in the external source. The
> format
> > > > > > for record in the ASCII file is ===>
> > > > > > mm/dd/yyyy,Open,High,Low,Close
> > > > > >
> > > > > > 3) The sequence of *manual* operation I perform goes
> something
> > > > like
> > > > > > a) I update the ASCII file (in step 2)
> > > > > > b) I invoke AmiBroker
> > > > > > c) I click thru the menu 'File Import_ASCII'
> > > > > > d) I type-in the name of the file (in step 2)
> > > > > > e) I click 'Open' to start import
> > > > > >
> > > > > > The whole manual operation goes absolutely fine !
> > > > > >
> > > > > > Now what I want to do is to automate steps c), d) and e)
> > above.
> > > > > >
> > > > > > Is this doable. Any inputs about how to do it ?
> > > > > >
> > > > > > Regards,
> > > > > > - Salil V Gangal
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Send BUG REPORTS to bugs@xxxx
> > > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > > -----------------------------------------
> > > > > > 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@xxxx
> > > > Send SUGGESTIONS to suggest@xxxx
> > > > -----------------------------------------
> > > > 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/
> > > >
> > > >
> > > >
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->
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/
|