|
Chaim6
2014-12-04 00:00:11
|
|
The following code in a downloader Pre-Script does not seem to add a new row of 'Content'. Any idea why?
string[] t = {"Working Capital Currency", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY", "JPY"};
Content.AddRow(t);
// The following returns the last pre-existing row.
Global.Trace(String.Join(", ", Content.Rows[Content.Rows.Length - 1].Data));
Thanks.
|
|
|
|
QuantShare
2014-12-04 01:09:05
0
|
|
You must match exactly what is been parsed with the array you add to Content.AddRow.
If in your parser settings, the "Columns" looks like this:
Quotes -> Date
Quotes -> Close
Quotes -> Volume
Then you should add for example
Content.AddRow("2014-10-10", "12.5", "100");
|
|
|
|
Chaim6
2014-12-04 12:47:18
0
|
|
I am working on an improved Morningstar downloader. This code was part of a pre-parsing that was done. Let me explain:
Morningstar has the data organized with dates at the top as row headings, not column headings like QS likes. Therefore one of the jobs of the downloader is to transpose the rows and columns. One way to do this is by setting the IsIgnoreLine flag to true for the pre-existing rows and adding the new transposed lines with Content.AddRow(). This is how it was done in the original Morningstar downloader and it makes sense.
The code that I wrote in the prior post was for before the transposition. My plan was to add a few rows of data before the Content was transposed and copy it in a later step. This way was easier.
Is it true that after adding a row using Content.AddRow() the code cannot access it? In other words the content object will still appear to be the same to the pre-script code?
Thanks.
|
|
|
|
QuantShare
2014-12-05 02:46:47
0
|
|
Yes, that is true. If you want to make further updates to the data later, you can use the "Post-script" (which will contain all parsed data including those added with AddRow)
|
|
|
|
Chaim6
2014-12-05 09:48:48
0
|
|
Thanks. I hope to have this thing finished by the end of next week. There are a number of improvements in this downloader to make the backtests much more accurate. I hope to upload it when done.
Question: What's the best way to deal with dividends and splits? Backtesting fundamentals with adjusted price data and comparing it to unadjusted fundamentals doesn't work.
Option 1:
Switch to using unadjusted price data. The downside is that backtests need to have dividends explicitly added. In simulations this can be done with the AMM. But when testing ranking systems I think that the buckets will reflect the prices as is without adjusting for dividends. Is this correct?
Option 2:
Continue using unadjusted price data but create a function to unadjust it for fundamental comparison purposes. Is this possible? This method would mean that I will not have to change all my downloaders to get unadjusted prices and I will not have to add AMM.
Thanks.
|
|
|
|
QuantShare
2014-12-06 01:38:54
0
|
|
You are going to compare fundamental data with values and other metrics, you are not going to compare it with stock prices.
Not sure I understand what you mean here by "unadjusted fundamentals".
|
|
|
|
Chaim6
2014-12-06 21:39:44
0
|
|
My plan is to calculate Earnings/Price ratios, price/book, price/sales etc. and backtest systems using them in a way that is similar to Portfolio123.com but on int'l stocks.
Example:
EarningsYield = GetData("mstar", "eps ttm") / close;
This QS code should be getting the EarningsYield ratio which is the inverse of the PE ratio (because some companies have negative PE).
For a live system this should work as long as the downloaders get price and fundamental data. But for a backtest there will be an issue if there were dividends or stock splits. Dividends make the stock appear cheaper in the past than it really was. Stock splits do the same. How do we adjust for this, option 1 or option 2?
|
|
|
|
QuantShare
2014-12-08 01:41:48
0
|
|
Best Answer
In this case, you must use unadjusted close price. You can use these unadjusted prices only for fundamental calculation.
Adjusted & Unadjusted stock prices
(by QuantShare,
uploaded several months ago)
No notes
|
|
|
|
|
Chaim6
2014-12-08 17:20:18
0
|
|
Thank you, that should work!
|
|
|
|