# Tag Info

## Hot answers tagged finance

43

Well, let me try to answer the OP's question. And thanks MMA.SE, for reopening this interesting question! DATA To answer this question, you have to get the data using Mathematica's FinancialData function. This was the only thing originally done by the OP! First step: define which stocks will be included in the portfolio: Portfolio = {"AAPL", "...

26

portf = {"AAPL", "BA", "IBM", "BMW.DE", "DIS", "R", "PEP", "BRBY.L", "AXP", "BTI"}; prices = FinancialData[#, "Price", {{2004}, {2011}, "Month"}] & /@ portf; Returns are often calculated as the difference of the logarithms of the prices: Differences[Log@#] &[prices[[1, All, 2]]] This works because $\log(\text{price}_{new})-\log(\text{price}_{old})... 23 Here's a set of functions that allows to do this. The code uses many ideas found on this site and on other places on the web. It is a bit factorized already so it should be easily reusable. More on YQL and available tables here: https://developer.yahoo.com/yql https://github.com/yql Query test Edit: this API is great also and simple http://www.quandl.com/... 19 I'm not sure if I correctly understood what you want... However, I could read in the question that you want to simulate Ito Processes and, at the same time, to be able to change its parameters, especially the processes drifts and volatilities. In the comments I've read about the processes being correlated, so, let me try to put everything together in this ... 15 You can get exchange rates from the Federal Reserve using their data download package maker at:- http://www.federalreserve.gov/datadownload/ See the link for Exchange Rates and International Data. The package maker produces a download link that can be used as shown. startdate = "12/31/1995"; enddate = DateString[{"Month", "/", "Day", "/", "Year"}]; ... 15 Using Annuity: pmt /.Solve[TimeValue[Annuity[pmt, 52, 1], .02, 0] == 5000, pmt] 155.545 Exercise left for the reader... 12 I also use Mathematica for calculating derivatives prices. As I understand FinancialDerivative[(*option params*),"GridSize"->{}] is equivalent to Finite Differences method. And FinancialDerivative[(*option params*), "Paths"->] is equivalent to Monte-Carlo method. By default Mathematica chooses optimal method depending of option type and time to ... 10 Maybe this question will be closed again. Anyway I'll try to answer the question not correcting the original code, but using a new one with some basic explanations... First of all, you can basically divide stocks in two big groups: growth stocks and value stocks. This is important, because the way you simulate growth stocks is completely different from that ... 10 I implemented this function using YQL: acquireOptions[stock_String, expiration_, type_] := Module[{options, list, data}, options = Cases[Import[ "http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.finance.option_chain%20WHERE%20symbol%3D'" <> stock <> "'%20AND%20expiration%3D'" <> expiration <> "'%20and%... 10 Mathematica 10 has a way to do this: http://www.wolfram.com/mathematica/new-in-10/dimensional-variables/convert-currencies-using-historical-exchange-rates.html The relevant new functions in Mathematica 10 are DatedUnit[] and InflationAdjust[]. If I wanted to convert 1 USD to EUR using the January 1, 2015 exchange rate, for example, I would execute: ... 10 From the question formulation I am not sure what is the desired end result: a time series or a table. It seems to be the latter but I give solutions for both. I am using a sample of the stocks for clarity. stdate = "04/21/1982"; enddate = "10/31/2014"; rSP = {"ADP", "ALL", "CNP", "ED", "EMR", "EXPD", "FB", "FLIR", "HAR", "NEE", "OKE", "PHM", "PLD", "... 10 TimeZoneConvert (V10) With version 10+, we can use TimeZoneConvert. It requires that we convert our date list to a DateObject: TimeZoneConvert[DateObject[{2015,3,17,16,10,0}, TimeZone->11], 1] The result is also a DateObject. A DateObject has an advantage over a date list because the object carries an explicit time zone specification. DateList If ... 10 Dataset has been designed for hierarchical data and will fit your problem well. You should start by mapping out the hierarchy and then building a function that builds that hierarchy as an association. tickerData[ticker_, dateSpan_] := Module[ {nameDetails, tradeHistory, analystEstimates, nameColumns = {"Name", "Exchange", "Sector"}, ... 10 Here is something I quickly came up with after a cursory reading of the docs:$alphaVantageKey = (* insert your API key here *); alphaVantageTradingChart[symbol_String, opts___] := Module[{daily, meta, msg, raw, series}, daily = StringTemplate["https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&datatype=json&outputsize=compact&...

9

Mathematica's FinancialData (and the economic data in CountryData, for that matter) promise much but for serious work you are often better off going to other sources. That way you are more likely to get more detailed metadata so you know what you re looking at. In your specific case you are better off going to the Reserve Bank of Australia’s web site, and ...

9

So here's some stuff to get you started: We'll start with a more general candle image function: candle[width : _Integer : 5, heightFactor : _Real : 1][{start_, end_, x_: 0}] := candle[{start, end, x}, width, heightFactor]; candle[{start_, end_, x_: 0}, width : _Integer : 5, heightFactor : _Real : 1. ] := Graphics[ { Blue, Line[{{x, ...

8

Although I have found ItoProcess an excellent tool in nearly all cases, in those situations where a correlation matrix is supplied to it ItoProcess incorrectly uses the Cholesky decomposition of the correlation matrix when it should actually be using the transpose of the Cholesky. Note that I discovered this bug back in December 2012 when I was looking at ...

8

You can suppress those functionalities with PerformanceGoal: chart = TradingChart[data, {FinancialIndicator["AverageDirectionalMovementIndex", 7]}, Appearance -> "Line", PerformanceGoal :> "Speed"] and proceed further with Cases to extract what you need: Cases[chart, _Graphics, ∞] Cases[Cases[chart, _Graphics, ∞][[3]], Line[x_, ___] :&...

8

You also can use: Financial data from Quandl in Wolfram Language using QuandlLink << QuandlLink AUDvsUSDrates = QuandlFinancialData["CURRFX/AUDUSD", startDate -> "1995-1-1", endDate -> "2015-5-1"]; DateListPlot[Transpose[{#[[All, 1]], #[[All, 2, 1]]} &@Rest[AUDvsUSDrates]], PlotTheme -> "Detailed&...

8

Using Mathematica (v10) Reverse[SortBy[ EntityClass["AdministrativeDivision","USCountiesMaryland"][{"Name","MedianHouseholdIncome"}], Last]] // TableForm

8

Perhaps just an extended comment... I recommend that you convert everything you need to track everything to GMT, but this begs a larger question, which I suggest includes your second question. To trade effectively anywhere (and it seems everywhere) one needs a way to keep track of all trading and trade accounting implementation details - both static ...

8

FinancialData["AustraliaASX", "Members"] and DateListPlot[ FinancialData["AX:CBA", "Volume", {{2000, 1, 1}, {2000, 4, 1}}], Filling -> Axis] You can get the names of all available exchanges with FinancialData["Exchanges"]

8

Can Mathematica 10 do elliott wave calculations? Yes. Has anyone tried an Elliott Wave implementation in Mathematica? No one can speak for everyone, but I haven't. I don't know of any specific implementation. Empirical observations, particularly of ill defined patterns don't rise to the level of explanation. Physicist David Deutsch writes extensively ...

8

The general formula can be derived as follows. First@RSolve[{prin[n] == (1 + int) prin[n - 1] - pay, prin[0] == loan}, prin[n], n]; First@Solve[(prin[n] /. %) == 0, pay] (* {pay -> (int (1 + int)^n loan)/(-1 + (1 + int)^n)} *) where pay is the payment per period, int is the interest per period, and loan is the original principal. For the example given ...

8

The situation with FinancialData has been discussed in some detail on https://community.wolfram.com/groups/-/m/t/1847045. In a nutshell: data availability has indeed been affected as a result of changes in our data providers. Documentation will more accurately reflect the current capabilities of FinancialData[] in the upcoming 12.1 release of the Wolfram ...

7

The reason might be gleaned from examining the output from TracePrint. DateDifference["Jan 2, 2013", "Jan 8, 2013", "Week"] // TracePrint (* Warning Huge Output *) Somewhere close to the end of this humongous output we see the following: DataPacletsCalendarDataDumpn:Except[_Integer] :> N[DataPacletsCalendarDataDumpn] 6/7 /. DataPaclets...

7

1. You can also use all FinancialIndicator[...] functions directly on data: data = FinancialData["IBM", "OHLCV", {{2013, 12, 31}, {2014, 3, 31}}]; admi = FinancialIndicator["AverageDirectionalMovementIndex", 7][data] (* {22.3186, 25.4227, 27.7113, 30.474, 34.1408, 38.1074, 41.6553, 44.6964, 47.9435, 51.9707, 55.5629, 55.1122, 52.5314, 45.1471, 38.9678, ...

7

What is included in FinancialData["NYSE", "Members"] appear to be stocks, indices, and exchange traded funds (ETFs). One can see this by finding the intersection of the group with the various "Classes" of FinancialData: nyse = FinancialData["NYSE", "Members"]; {#, Length@ Intersection[FinancialData@#, nyse]} & /@ FinancialData@"Classes" {{"Currencies",...

7

Another possibility with built-in functions: (* Define the process *) proc = ItoProcess[ⅆs[t] == μ s[t] ⅆt + σ s[t] ⅆw[t], s[t], {s, s0}, {t, 0}, w \[Distributed] WienerProcess[]] Now the process can be used as: Expectation[z, z \[Distributed] proc[t]] (* E^(t μ) s0 *) Simplify[Expectation[Log[z], z \[Distributed] proc[t]], Assumptions -> {σ >...

7

This might not even come close to the real distribution and I'm also not going to comment on the usefulness of this endeavor or the final result. I'll take your data as five points of a CDF assigning kind of arbitrary probability values to the maximum loss and maximum profit values data = {{-4305, 0.01}, {-1801, 0.25}, {4044, 0.5}, {4938, 0.75}, {6120, 1....

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