How to read real time ticker data from a text file ( it is update by every ticker )

The futures broker give quote API for user by VC++ or VC# (In asia , not USA )
but this is not good way for end user.
because the API ver. update every time , the user must modify plugin-in (DLL) again for new funtion or even frome vc++ change to vc# (because new API not support VC++ any more)

so The futures broker has new idea is : (because they receive too much Customer complaints) :

API ( RT quote: ticker level data ) ----> TXT FILE <------ any program ( etc AB , R , python )
API (Order) <------ EXE FILE <------ any program ( etc AB , R , python )

the ticker data like below (time -- price --- volume )


If you put the TXT FILE in ram-disk , it is not slow
so my problem is :
to write a loop to read last line from the TXT FILE (RT , it is updating now)
is very easy , but how to put the data to AB is very hard.

I read ASCII sample code in ADK .
it seems must read data in

PLUGINAPI int GetQuotesEx( LPCTSTR pszTicker, int nPeriodicity, int nLastValid, int nSize, struct Quotation *pQuotes, GQEContext *pContext )

but the TXT FILE it is updating now , if the loop in GetQuotesEx()
It is wrong.

Could you tell me have any sample code it is easy tell me how to let ticker data (updating)
to AB ?



There are examples in the ADK (see ASCII plugin and QT plugins). ASCII plugin is pretty much it. But broker's idea is weak (using text files). It is slow. And it does not matter if you have data in RAM. What is slow is conversion from binary to text (on their side) and then conversion back from text to binary (on client side). Two things that are done without sense.

Anyway to improve performance you can read the file in one thread and put it to array in binary form and observe only updates so you just add last line if file changes. Then in GetQuotesEx just memcpy() ready to use table (possibly only from nLastValid) so only few bytes are actually copied.


You need a data plugin that takes care of all. Refer ASCII and QT samples from ADK 2.10a. I know it is easy to suggest but i can say Once Data Plugin runs forget how Amibroker is importing the data. You are not suppose to or need to open data base symbol files to write data on low level.