update amibroker database with csv quotes file from excel VBA.

#1
It seems a simple task but tricky one...
I have a .csv file that I need to periodically get imported in Amibroker database. How Can I do that? I have tried below code in Excel VBA. but it does not work.

AB is version 5.5 64 bit. I can switch to 32 bit if required.
Excel is 2007 32 bit.
###############

Sub AmiAsciiImport()

' import the data using appropriate format definition file

Dim Amibroker As Object
Dim filename As String

Set Amibroker = CreateObject("Broker.Application")
filename = "F:\Prakash_Docs\ATS\Mydata.csv"
Call Amibroker.Import(0, filename, "Mydata.Format")
Call Amibroker.RefreshAll
MsgBox "yo Done!"

End Sub
 
#3
yes. the format file is consistent.
I can manually doi the same job and it works fine.
also the similar code works fine from within afl.

excel will fetch live data from vendor every 1 minute, in CSV file.
Amibroker will scan strategies every 1 minute.

Challenge is to update the amibroker database without causing file sharing issues(of .csv file) between excel and AB

Option 1 : the (afl intraday scan + data import via AFL ) run every 1 minute.
Option 2 : excel updates live data and then import it in amibroker.

option 1 is working ok. But that gives timing isses periodically.
So I want to try option2, as it will not give any timing issues.
 
#4
Mydata.csv
==========

Name,Symbol,Last,Change,Mkt cap,Volume,Open,High,Low,Date
,AAN,34.89,0.5,2519.77,557384,34.42,34.955,34.25,6/18/2014
,AA,14.64,0.16,17162.23,11258908,14.41,14.67,14.29,6/18/2014
,AAON,33.5,0.74,1226.75,139965,32.8,33.56,32.5075,6/18/2014



Mydata.format
============
# Format definition file generated automatically
# by AmiBroker's ASCII Import Wizard
$FORMAT Skip, Ticker, Close, Skip, Skip, Volume, Open, High, Low, Date_MDY, Skip, Skip
$SKIPLINES 1
$SEPARATOR ,
$CONT 1
$GROUP 255
$AUTOADD 1
$DEBUG 1
$NOQUOTES 1
 

Similar threads