AmiQuote and free data from Yahoo

There are a couple of things you need to know about Yahoo Finance pages that AmiQuote uses to download “historical” and “current” quotes.

Current quotes are quotes for current day (or previous day if there is no trading session today). For example MSFT current quote page is here:
http://finance.yahoo.com/q?s=MSFT
AmiQuote uses rather “download data” link which is: http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&f=sl1d1t1c1ohgv&e=.csv
But it is not relevant because both show same current quote.

Now there is a second source. Historical quotes are downloaded from Historical Prices page. For example MSFT historical page is here: http://finance.yahoo.com/q/hp?s=MSFT (again AmiQuote uses rather plain text link: http://ichart.finance.yahoo.com/table.csv?s=MSFT&d=7&e=4&f=2007&g=d&a=2&b=13&c=1986&ignore=.csv )

Why using two sources? That’s simple: current mode gives data during trading session, while historical is only updated many hours after markets close so both compliment each other. Current mode is also much faster as it downloads as many as 200 symbols at once, while historical must download one by one. So recommended usage is to use Yahoo Current mode everyday, and Yahoo Historical once a week.
Of course you may use historical everyday as well if you have time and fast internet connection.

It is important to understand that AmiQuote is just the downloader (like Internet Explorer) and it does nothing except downloading the data, so if you belive that there is a bad quote – it is not AmiQuote, but rather Yahoo problem. To verify always go to relevant page (see links above) and check the quote on Yahoo Finance site directly.

It may happen that quotes on Yahoo Current page and Yahoo Historical pages differ. It is so because Yahoo gets them from different data vendors. If this happens the only solution is to report data error to Yahoo.

There are however 2 things you need to know about importing of data:

  1. AmiBroker by default imports split and dividend adjusted data (”Adj. Close” on Yahoo Historical page). For more information on how data are adjusted see Yahoo Help page at: http://help.yahoo.com/l/us/yahoo/finance/quotes/quote-12.html

  2. AmiBroker by default imports volume in HUNDREDS of shares (so if volume is 183,200 shares, the volume chart will show 1832). NOTE: This will NO LONGER apply in AmiBroker 5.30.

These things are adjustable, so if you don’t like them, you can change them.
The import process of historical quotes is controlled using aqh.format file that you will find inside “Formats” subfolder. By default it looks as follows (you can open it with Windows Notepad).

# AmiQuote historical quotes download format (.AQH extension)
$FORMAT Date_DMY,Open,High,Low,Close,Volume,AdjClose
$SKIPLINES 0
$BREAKONERR 0
$SEPARATOR ,
$DEBUG 1
$AUTOADD 1
$CONT 1
$GROUP 254
$VOLFACTOR 0.01

Lines marked with bold mark important areas.

$FORMAT line controls the import format. AdjClose field says that AmiBroker should use adjusted price. If you don’t want adjusted prices simply replace $FORMAT line with:

$FORMAT Date_DMY,Open,High,Low,Close,Volume
(note no AdjClose field)

$VOLFACTOR line controls the volume multiplier. If you want volume to be expressed in single shares instead of hundreds of shares replace $VOLFACTOR line with:

$VOLFACTOR 1

The same $VOLFACTOR change should be applied to aqd.format file that is responsible for importing data in Yahoo CURRENT mode (if you are using it).

How to display the indicators based on Advances/Declines

In order to display indicators based on Advances/Declines first of all it’s necessary to calculate composities in the database:

  1. Open Categories window using Symbol->Categories menu item.
  2. Select base index for given market in Markets tab and Base indexes for – Composites combo.
    For example if you are following NYSE this can by ^DIJ (Dow Jones Average)
    (certain symbol must be marked as index in Symbol -> Information and must belong to the same market)
  3. Choose Symbol ->Calculate composites  menu item to open the window shown below and mark:
    - Number of advancing/declining issues and
    - Apply to: all quotes, All markets
  4. Click Calculate . From now on ADLine, AdvVolume() and TRIN indicators will be visible.

Q: Why does AB need “base index”?
A: Just because it may happen that not all stocks are quoted every businness day and AB needs must calculate number of advancing/declining issues per market. So it checks the “base index” quotations dates and tries to find corresponding quotes of all stocks belonging to that market to find out how many issues advanced, declined and not changed at all.

Q: What are “Volume for base index” and “Copy volume to all indexes” checkboxes for?
A: “Volume for base index” and “Copy volume to all indexes” are provided in case you DON’T have real volume data for index quotes. In that case AmiBroker can calculate volume for index as a sum of volumes of all stocks belonging to given market. First option assigns calculated volume only to “base index”, the second copies the volume figure to all indexes belonging to given market.

Setting up with FXCM (forex broker)

I have just prepared instructions how to connect to FXCM (Forex broker) to get their real-time quotes.
Also included is small example database (1 day worth of 1 minute data) and all required programs.

For the details check: http://www.amibroker.com/fxcm.html

How to combine two databases into one

If you ever wondered how to combine two databases into one this short article will show you how, but let us start with some background first… (more…)

AmiBroker for FOREX

Here is an article that tells you everything you need to know about using AmiBroker for trading FOREX markets. (more…)

How does the intraday-to-daily compression work?

When you are using intraday database daily candles are usually constructed by time-compression of intraday (for example 1-minute data). AmiBroker offers lots of flexibility when it comes to defining intraday-to-daily time compression.
(more…)

How to export quotations from AmiBroker to CSV file ?

The easiest way to export quotes to CSV file is to use the below formula from Automatic Analysis window:
(Analysis -> Automatic Analysis)
(more…)