Importing ASCII data from stoxx.com
Author: AbsoluteReturn
Creation Date: 8/15/2013 7:41 AM
profile picture

AbsoluteReturn

#1
Hello

I would like to ask if it is possible to download ASCII data from the following Website into WL:

http://www.stoxx.com/download/historical_values/hmsppe.txt

At this site the data for all STOXX 600 Supersector indices are updated every day and I would like to import the data for analysis.

Thanks in advance
profile picture

Eugene

#2
Sorry, it's not possible.

Wealth-Lab's ASCII provider only supports "one symbol, one file" scenario. The Database provider in ODBC mode could do for "many symbols, one file, single symbol per row" scenario. Unfortunately, this particular ASCII file follows a rare and unsupported convention: "many symbols, one file, several symbols per row". You need to find the data in a supported format.
profile picture

AbsoluteReturn

#3
Thanks for the explanation.

Because it is not possible to download this file with many symbols per row, I search for an other possibility to get this data into WL.
Is there possibly a way with the aid of an additional WL script which is parsing the ASCII rows and then storing the data for each symbol in a seperate ASCII file with a supported format?
profile picture

Eugene

#4
Okay, got a complete solution for you:

1. downloads the file to your disk (required for FillSeriesFromFile to work),
2. parses the file, creating DataSeries for each index
3. exports them to CSV files (to create an ASCII DataSet)
4. puts them in Wealth-Lab's global memory so you can access them w/o setting up a DataSet (see below)
5. plots them on the chart

Here you go (but read NOTES below):

CODE:
Please log in to see this code.


NOTE:

1. Requires LATEST version of Community Components installed
2. Run in single symbol mode.
3. Adjust the folder where the downloaded data file will be saved:
CODE:
Please log in to see this code.

A new folder "ASCII" will be created here with CSV files containing exported data

4. After getting the file downloaded, comment this line out - you don't want to download it over and over (perhaps only once a day)!
CODE:
Please log in to see this code.


5. Finally, to access the downloaded DataSeries in any strategy w/o having to set up an ASCII DataSet, use this code (each index has a name like SXAP etc.):

CODE:
Please log in to see this code.
profile picture

AbsoluteReturn

#5
Hello Eugene

Thank you very much for this great support.

profile picture

AbsoluteReturn

#6
Hello Eugene

Unfortunately the following problem occurs with the data stored in the created CSV files:
The price is always stored in Integer format, the decimal separator is ignored. Because the original data file contains data with mostly 2, but sometimes with only 1 or even no any decimal places, the Integer values in the CSV files have mostly 5, but sometimes only 4 or 3 numbers. Therefore using these CSV files for analysis is not possible.

I would like to ask if you could modify the script in order to get the data in decimal format instead of integer numbers.

Thanks in advance
profile picture

Eugene

#7
My files always come out correct, and I can not reproduce this issue here. There's no restriction and/or error.

As German/Austrian users usually do, you probably have that "," set as the default decimal separator in Windows. I can imagine that you won't be able to import ASCII files separated with "," properly with this setup. My decimal separator is "." which is highly recommended.

So your job is to adjust separator character in the ASCII export routine from comma (line 31) to anything else like ";" and then re-create the ASCII DataSet (use the uber-helpful "Copy format from a DataSet" feature but specify a different separator char). It's super easy and you can do it yourself.