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

Re: [amibroker] Import Script



PureBytes Links

Trading Reference Links


Good greef Tomasz you're an absolute STAR man, thankyou 
very much...you will feel us all smile on this side in a short while, I'll give 
it a good try and comment soon...once more thank you very very 
much....
 
Kind regards
 
 
Louw Coetzer
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Tomasz Janeczko 

To: <A 
href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, October 11, 2001 8:10 
PM
Subject: Re: [amibroker] Import 
Script

Dear Louw 
Coetzer,
 
As for the importing of the .EED files you 
can use the following script
(make sure your import definition is called 
"eed.format") :
 
var FileSystemObject = new 
ActiveXObject("Scripting.FileSystemObject");var AmiBroker = new 
ActiveXObject("Broker.Application");var ForReading = 1;var DataFolder 
= <FONT 
color=#0000ff>"c:\\ID\\"
 
 
function RunAmiUpdate(filename){  AmiBroker.Import(0, 
filename + ".EED", "eed.format");  
AmiBroker.RefreshAll();}
 
function 
ImportEED(filename){ 
 
  if( ! FileSystemObject.FolderExists( 
DataFolder ) )  { WScript.echo("A data folder:\n" + 
DataFolder + "\ndoes not exist.\nIf your data are in another location please 
enter the path to this location\nto the 'Arguments' edit field in the 
Tools->Customize dialog."); return;  }
 
 
    RunAmiUpdate( DataFolder + 
filename );    
 try {      
FileSystemObject.DeleteFile( DataFolder + filename + 
".EED");    } catch (e) { /* Ignore errors 
*/    }  }  
  return;
 
}
 
function UpdateToday()
{
 var CurDate = new Date();<FONT 
face=Tahoma>
   y = 
CurDate.getFullYear();   m = CurDate.getMonth() + 
1;   d = CurDate.getDate();
 
 
   filename = y + ( m < 10 ? 
"0" : "" ) + m + ( d < 10 ? "0" : "" ) + d;
 
   
   ImportEED( filename );
 
}
 
 
UpdateToday();
 
<FONT face=Tahoma 
size=2>====================================
 
Note: This is just a code scratch 
written at once.  Please 
give me a week or so to finish 3.8 
first,
then I can prepare a "real" script.
 
Best regards,Tomasz Janeczko===============AmiBroker - the 
comprehensive share manager.<A 
href="">http://www.amibroker.com
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A href="" 
title=lcoetzer@xxxx>Louw-Roux Coetzer 
To: <A 
href="" title=amibroker@xxxxxxxx>AMI 
Broker Group 
Sent: Thursday, October 11, 2001 
7:50 PM
Subject: [amibroker] Import 
Script

Dear 
Tomasz
 
PLEASE help !   I am only starting out with 
scripting now and unfortunately have to ask for your help on this one...a 
friend of mine recently bought AB from you and I wish to make importing 
the daily update files easy for him..and also a few other South African 
users...I have come across.
 
In the current AB there is an "Sharenet Import " 
function under the "tools" option.  I know how to add more 
scripts to this menu, what I do not know is how the script should be written 
to do the following:
 
We all have a data folder located 
at:     <FONT 
color=#0000ff>c:\ID
In this folder lives the daily update file withthe 
name of e.g.  <FONT 
color=#0000ff>20011011.eed<FONT 
color=#0000ff> 
I have already written an working import function 
which lives in the following place:    <FONT 
color=#0000ff>c:\Program 
Files\AmiBroker\Formats\
I now wish to put a menu option with the othersin the 
tools menu to update this file and then delete it when finished and then to 
automatically save the new amended database thereafter instead of clicking 
on the "save" button.
 
The following is an clipping from one of theupdate 
files and the format of these lines are as follows:
 
Ticker, Date_YMD, Close, High, 
Low, Volume, Open, OpenInt , DY, EY
AMROC 20010920 3 3 3 20000 
3 0 0 1333333SANLAM 20010920 854 890 850 8543605 890 0 35128 
124824SANTAM 20010920 3400 3550 3400 110092 3400 0 42794 93234SAPPI 
20010920 6970 7160 6700 844606 7100 0 26838 
158536
 
Here is the code for the manual import I currently 
use:
 
<FONT 
color=#000000>$FORMAT Ticker, Date_YMD, Close, High, Low, Volume, Open, 
OpenInt$SKIPLINES 0$SEPARATOR $PRICEFACTOR 
0.01     ( very important this line, 
otherwise prices go all haywire ! )$AUTOADD 1$DEBUG 
1
<FONT 
color=#000000> 
OK,now there 
is also another file that accompanies this data file, almost like the header 
file that comes with sharenet's eod file.  Here are two samples of 
these type of files which deals with "new shares listed " , " name changes " 
etc....
<FONT 
color=#000000> 
Example 
#1:
 
NEW 
UB-INT-P3 YYYYYN 1 8 59 0 
0        I suspect these figures has 
something to do with sector placement and     
             
                
                
                
            
can be ignored for the mean time as this process can be done 
manually...NEW UB-MCE-C3 YYYYYN 1 8 59 0 0NEW UB-NED-P3 
YYYYYN 1 8 59 0 0NEW UB-OML-P3 YYYYYN 1 8 59 0 0NEW BP-SOL-C5 YYYYYN 
1 8 59 0 0NEW KINGCO-NP YYYYYN 3 14 37 0 
0
 
Example 
#2:
 
DEL BP-AGL-C1DEL BP-FSR-C1DEL 
BP-GFI-C1DEL BP-AMS-C2DEL BP-VNF-C3DEL BP-STX-C5DEL 
CLYDE
 
Example 
#3:
 
FIX ANGLOS 20011005 11440 11700 11360 3479603 
11500 0 0 0FIX ANGLOPLAT 20011005 30820 31100 30500 446906 30500 0 0 
0FIX ANGGOLD 20011005 30880 31500 30700 352972 30700 0 0 0DEL 
UD-SAB-P3DEL CCH
Here price errors were rectified - very important 
....
 
Please help me to help the other's as we have all had 
the same problems with data quality from Sharenet and have all changed over 
to Investordata....I have already helped all these people change their 
database and so on...I really love AB and I'm telling the whole world about 
it, I think and hope that last  week you sold another package to a 
young chap in Johannesburg...I have already sent him a copy of the new 
database and he is running at full steam....
 
Kind regards
 
 
Louw CoetzerYour use of 
Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.