Hot answers tagged

7

It appears you can define your own indicators to be used with TradingChart (this doesn't seem to be documented though): myIndicator[data_, OptionsPattern[]] := Module[ {myind}, myind = Accumulate /@ SplitBy[Differences[Log[QuantityMagnitude[data[[4]]["Values"]]]], Sign] // Flatten; {TimeSeries[myind, {Most[data[[4]]["Dates&...


7

Update WL used to provide data for ^N225, it no longer does. The following indexes are currently available FinancialData["Indices"] Names of those indexes AssociationMap[FinancialData[#, "Name"] &, FinancialData["Indices"]] Here is a way using the company name EntityValue[EntityClass["Company", {"Name" -...


6

Assuming the payments change when the rate changes. Then using an example of a 100k mortgage on 4% (nominal) for two years, then 6% for three more years. (Formula derivations shown below.) Note, if using an effective annual rate use r = (1 + 0.04)^(1/12) - 1. s = principal r = periodic rate n = number of periods d = periodic payment s = 100000; r = 0.04/...


5

Here is an example to build on top of Twelve Data OHLCV candles. The advantage is that they offer real-time data throughout the trading session, that AV fails to deliver for some important stocks. TwelveDataTradingChart[symbol_, interval_, apikey_, opts___] := Module[{template, status, data, series}, template = StringTemplate["https://api.twelvedata....


4

This seems to work: Module[{amzn, googl}, amzn = InteractiveTradingChart[{"AMZN", {{2009, 1, 1}, {2009, 12, 31}}}]; googl = InteractiveTradingChart[{"GOOGL", {{2009, 1, 1}, {2009, 12, 31}}}]; TabView[{"AMZN" -> amzn, "GOOGL" -> googl}]]


3

Start: ohlcv = FinancialData["SPY", "OHLCV", {DatePlus[Today, -300], Yesterday}]; chart1 = TradingChart[ohlcv, {"Volume", "BollingerBands"}, ImageSize -> {700, 500}]; myind = Accumulate /@ SplitBy[Differences[ Log[QuantityMagnitude[ohlcv["Values"][[All, 4]]]]], Sign] // Flatten; ...


3

The problem seems to be that the site in question has (pretty basic) defence against bots, and does not let you download it programmatically for a default type of request that Import is making. You can set HTTP headers to pretend that you send a request from a browser, to overcome this: url = "https://es.investing.com/indices/germany-30-futures-...


3

I do not know what you mean by "code name". Perhaps, prop = {"Name", "StandardName", "Symbol", "CIK", "SICCode"}; Grid[Join[{prop}, FinancialData[#, prop] & /@ {"Alphabet", "Microsoft", "Apple"}], Frame -> All] EDIT: all = FinancialData[]; exch = StringCases[all, __ ~~ ":"] // Union // Flatten (* {"DE:", "F:", "HK:", "L:", "MB:", "NASDAQ:",...


2

I don't think there is any way to speed up the process of getting the data. The WSJ archive site takes a long time to load because of the ads and other unrelated content on the page. The errors can be avoided by using WebExecute which will wait for the page to fully load before proceeding. wsjArchiveText[session_, date_] := Module[{archiveDiv}, WebExecute[...


2

names = FinancialData[{"GE", "GOOGL", "MSFT", "AAPL", "HPQ"}, "Name"]; mcaps = FinancialData[{"GE", "GOOGL", "MSFT", "AAPL", "HPQ"}, "MarketCap"]; sortednames = names[[Ordering[mcaps]]] {"HP Inc", "General Electric Co", "Alphabet Inc", "Apple Inc", "Microsoft Corp"} Alternatively, you can construct a list of name and market cap pairs and sort by the ...


2

The main fault is not operating correct on TimeSeries! (*def.of ticks*) maxh = Max[# & /@ data["Values"][[All, 2]]][[1]] minl = Min[# & /@ data["Values"][[All, 2]]][[1]] lstYTicks = Table[i, {i, minl, maxh, (maxh - minl)/6}] *draw chart*) TradingChart[data, Frame -> True, FrameTicks -> {{Automatic, Automatic}, {lstYTicks, ...


2

You can use TradingChart to get the same chart with the added convenience of a hundred built-in indicators: data = FinancialData["IBM", "OHLCV", {{2009, 5, 1}, {2010, 4, 30}}]; Row[{CandlestickChart[data, ImageSize -> Medium], TradingChart[data, {"OHLC"}, ImageSize -> Medium]}] TradingChart[data, {"OHLC", {&...


2

Ran into this 2012 question and thought it deserves some closure. The issue is resolved at least in the current In[]:= $Version Out[]= 12.1.1 for Mac OS X x86 (64-bit) (June 9, 2020) This code will return a single element TimeSeries: data=FinancialData["SPY","Volatility20Day",{{2012,10,11},{2012,10,11}}] with value In[]:= Values[data] ...


2

Adding to kgir answer, this is an attempt to get better control on the name appearing on the chart (here myIndic). A bar chart is used for this example. spy = FinancialData["SPY", "OHLCV", {{2020, 12, 1}, {2020, 12, 10}}]; indicatorData = {{{2020, 12, 1}, 1}, {{2020, 12, 2}, 2}, {{2020, 12, 3}, 3}, {{2020, 12, 4}, 4}, {{2020, 12, 7}, ...


2

myIndicator = FinancialIndicator[TimeSeries[indicatorData] &, "LineStyle" -> Blue, "Filling" -> Bottom, "IndexLine" -> 5, "RenderingElement" -> "Step"]; TradingChart[spy, {myIndicator}, ImageSize -> Large] Use "RenderingElement" -> "Line" to get: You can ...


2

data = {{{2015, 6, 15, 10, 51, 0.}, {53.19, 53.19, 53.19, 53.19, 100}}, {{2015, 6, 15, 12, 19, 0.}, {53.3, 53.33, 53.3, 53.32, 1200}}, {{2015, 6, 15, 13, 49, 0.}, {53.22, 53.24, 53.2, 53.2, 3800}}, {{2015, 6, 15, 15, 14, 0.}, {53.395, 53.41, 53.395, 53.405, 3500}}, {{2015, 6, 16, 10, 6, 0.}, {53.08, 53.09, 53.07, 53.07, 2000}}, {{2015, 6, 16, 11,...


2

(* Get the weekly closing prices *) dataweekly = FinancialData["^SPX", "Close", {{2010, 7, 1}, Today, "Week"}]; (* 6 week rolling weekly return *) rolling = MovingMap[100*(Last[#]/First[#] - 1) &, dataweekly, {6, "Week"}]; DateListPlot[rolling]


2

Not certain what your really want to do, but maybe the following will spark some ideas. Manipulate[ Module[{dw, dpw}, dw = dataweekly[[All, 4]]; dpw = datapercweekly; Grid[{ {ListLinePlot[dw, ImageSize -> 350], ListLinePlot[dpw, ImageSize -> 350]}, {ListLinePlot[MovingAverage[dw, n], ImageSize -> 350], ListLinePlot[...


1

Since the dataset already breaks the data into weeks for you, this is pretty simple. I combine returns from the earlier week with returns from the later week in a two-members list, select the two-member lists that meet the test, then throw out the part about the earlier week. I'm left with a list of changes (*100) for the weeks you care about, and you can do ...


1

Note April 7 and 8 missing. it is working now. It seems to have been just some data delay of some sort for those days before. Here is current output (V 12.1 on windows) FinancialData["IBM", {2020, 4, 3}]["Dates"]


1

This is nothing more than a fusion of the excellent answers by Rod and Sjoerd C. de Vries updated for MMa 12. Extract the prices from Wolfram's data service. portfolio = {"AAPL", "BA", "IBM", "BMW.DE", "DIS", "R", "PEP", "BRBY.L", "AXP", "BTI"}; assetCount = ...


Only top voted, non community-wiki answers of a minimum length are eligible