Message Boards Message Boards


Way to convert a DateListPlot to a FinancialData data object?

Posted 2 years ago
3 Replies
4 Total Likes

I'm receiving financial data from Bloomberg and would love to convert the data received to a FinancialData object that can be consumed by InteractiveTradingChart, etc. Any tips to accomplish this would be helpful.

POSTED BY: Luke Jennings
3 Replies
Posted 2 years ago

Hi Luke,

TradingChart and InteractiveTradingChart expect OHLCV data as TemporalData or TimeSeries. e.g.

ge = FinancialData["GE", "OHLCV", {"Oct. 29, 2020", "Nov. 1, 2020"}];
(* TemporalData *)

geList = Normal@ge
{{DateObject[{2020, 10, 29, 0, 0, 0.}, "Instant", "Gregorian", -6.], 
 {Quantity[7.659999847412109, "USDollars"], 
   Quantity[7.739999771118164, "USDollars"], 
   Quantity[7.309999942779541, "USDollars"], 
   Quantity[7.369999885559082, "USDollars"],
 {DateObject[{2020, 10, 30, 0, 0, 0.}, "Instant",  "Gregorian", -6.], 
  {Quantity[7.340000152587891, "USDollars"], 
   Quantity[7.539999961853027, "USDollars"], 
   Quantity[7.289999961853027, "USDollars"], 
   Quantity[7.420000076293945, "USDollars"],

Convert from List to TimeSeries

geTS = TimeSeries@geList


Convert the Bloomberg data into a list like geList then generate a TimeSeries from it.

POSTED BY: Rohit Namjoshi

I was able to get this into the interactive trading chart by formatting the data at each iteration for the time series in the parameterized format of InteractiveTradingChart.

POSTED BY: Luke Jennings

You don't need to go from a TimeSeries object to a TradingChart[ Normal[ TimeSeries[..] ]] since both TradingChart and InteractiveTradingChartChart accept TimeSeries objects with values of dimension 5, ie OHLCV. Eg

In[108]:= FinancialData["GE","OHLCV",{"Oct. 29, 2019","Nov. 1, 2020"}]
Out[108]= TimeSeries[Time: 29 Oct 2019 to 30 Oct 2020 Data points: 255  \[SpanFromLeft]]
In[109]:= InteractiveTradingChart[%] 

Michael WRI Senior Consultant

POSTED BY: Michael Kelly

Group Abstract Group Abstract