Expand data from Monthly to Daily
Author: pichu_1972
Creation Date: 6/11/2016 7:51 PM
profile picture

pichu_1972

#1
Hello, I hava a CSV with monthly close, in fact the first day of each month.
I could import it to Wealth Lab as monthly ASCII.

For example:

D/M/Y Close
01/01/2000 100
01/02/2000 107
...............

I dont know if it is possible to expand to daily data and create a new symbol I mean:

D/M/Y Close

01/01/2000 100
02/01/2000 100
................
31/01/2000 100
01/02/2000 107
02/02/2000 107
..................
28/02/2000 107


And so on.
Thank you very much.
profile picture

Eugene

#2
Hello,

That's not required. Wealth-Lab does synchronization automatically. See the WealthScript Programming Guide > DataSeries > Accessing Secondary Symbols > Secondary Series Synchronization.
profile picture

pichu_1972

#3
Hello Eugene, yes I only wanted the CSV, but I think I have found the way with two different codes(I am trying now).

A monthly code with setglobal and a tuple (month,year,close)
A daily code with getglobal and create txt (StreamWriter)

Thank you very much
profile picture

Cone

#4
Really, it's much easier than that. You only need to:
1. Create an ASCII DataSet that points to your monthly data.
2. Run a script on a daily series (like AAPL), and use GetExternalSymbol("Your monthly symbol", true);
3. Export that series.

Below is the Wiki's ASCII export script modified to do that. You just need to enter your symbol and export path.

Untested, but it compiles fine...

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

pichu_1972

#5
Hi Cone, thank you very much,
But if I run your script on a daily series (like AAPL) I find the error: Attempting to deserialize an empty stream
If I run your script on a monthly series (like AAPL) it works but I get a monthly CSV.
profile picture

Eugene

#6
Hi Juan,
If you had searched this in the Wiki you would find this solution: "Runtime error: Attempting to Deserialize an empty stream."
profile picture

pichu_1972

#7
Hi Eugene, thank you very much.
Now it is working with GetExternalSymbol("your DataSet with CSFB name here", "csfb", true);

But I receive a csv like this:
"30/11/1980 7,23"
"30/11/1980 7,23"
"30/11/1980 7,23"
"30/11/1980 7,23"
..............................
...............................

"31/12/1980 7,43"
"31/12/1980 7,43"
"31/12/1980 7,43"
"31/12/1980 7,43"
................................
.................................

Dates remains const untill next month.
profile picture

Eugene

#8
There was a typo in Cone's code above (edited), here's a fix for it:

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

pichu_1972

#9
Hi Eugene, I was trying to find the error, but I am not so fast.
Everything OK now.
Wonderful software and wonderful team!!!!
profile picture

Eugene

#10
You're welcome!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).