Question

As I am trying to plot a few financial time series in Mathematica, I just ran into a problem illustrated in the figure below :

It seems the data are no longer dealt with after Year 2000

Is there a way to fix that ?

What would be the best format to export time series from Bloomberg or Excel to use them in Mathematic (Using version 8).

I do know about the FinancialData function. However, not knowing the exact symbols, it makes it extremely difficult to use Mathematica directly for this.

enter image description here

Was it helpful?

Solution

Use the DateFunction option to tell DateListPlot how to convert dates:

DateFunction -> (DateList[{#, {"MonthNameShort", "YearShort"}}] &)

(The parentheses are important.)

OTHER TIPS

Why not to use WolframAlpha[...] function - it imports native to Mathematica format and goes up to current dates:

    timeseries = WolframAlpha["msft close Jan 1, 2010 to Jan 21 2011",
{{"DateRangeSpecified:Close:FinancialData", 1}, "TimeSeriesData"}];
DateListPlot[timeseries]

enter image description here

That was just an example of input. I am not sure what kind of data you need exactly, but you can get a lot of them via WolframAlpha function. Read this:

1) WolframAlpha 2) Data Formats in Wolfram|Alpha

Here's a function to convert those date strings to a format Mathematica can handle better:

dateConv = With[{s = StringSplit[#, "-"]}, {DateList[{s[[2]], "YearShort"}][[1]],
     DateList[s[[1]]][[2]]}] &

You can try

DateListPlot[data, DateFunction -> dateConv]

EDIT: Originally I tried DateList[{"Nov-11", {"MonthNameShort", "YearShort"}}] but this tells me String "Nov- 11" cannot be interpreted as a date in format {"MonthNameShort", "YearShort"}.. Perhaps a bug?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top