Message Boards Message Boards

1
|
5817 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Way to convert a DateListPlot to a FinancialData data object?

Posted 3 years ago

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

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
Posted 3 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"}];
Head@ge
(* 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"],
   122645696}}, 
 {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"],
   102480596}}}
*)

Convert from List to TimeSeries

geTS = TimeSeries@geList

TradingChart@geTS

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

Group Abstract Group Abstract