financial

SQL query to retrieve financial year data grouped by the year

喜你入骨 提交于 2019-12-04 12:30:11
问题 I have a database with lets assume two columns (service_date & invoice_amount). I would like to create an SQL query that would retrieve and group the data for each financial year (July to June). I have two years of data so that is two financial years (i.e. 2 results). I know I can do this manually by creating an SQL query to group by month then run the data through PHP to create the financial year data but I'd rather have an SQL query. All ideas welcome. Thanks 回答1: SELECT CASE WHEN MONTH

Get Financial Option Data with YQL

两盒软妹~` 提交于 2019-12-04 12:01:27
问题 I am using YQL to retrieve Financial Option data. Something like: select * from yahoo.finance.options where symbol="AAPL" and expiration="2011-07" However, the above query returns an optionsChain of data. Is there a way to retrieve just the record for a specific option symbol, e.g. symbol=AAPL110716C00155000 ? Thanks for your time. 回答1: You can apply a "local filter", for your desired symbol, on the result set brought back from yahoo.finance.options in addition to the "remote filters" (

financial python library that has xirr and xnpv function?

半世苍凉 提交于 2019-12-04 11:44:47
问题 numpy has irr and npv function, but I need xirr and xnpv function. this link points out that xirr and xnpv will be coming soon. http://www.projectdirigible.com/documentation/spreadsheet-functions.html#coming-soon Is there any python library that has those two functions? tks. 回答1: With the help of various implementations I found in the net, I came up with a python implementation: def xirr(transactions): years = [(ta[0] - transactions[0][0]).days / 365.0 for ta in transactions] residual = 1

Database design question

你离开我真会死。 提交于 2019-12-04 10:15:17
I accumulated a quite a lot of data in a raw form (csv and binary) - 4GB per day for a few months to be precise. I decided to join the civilized world and use database to access the data and I wondered what would be the correct layout; the format is quite simple: a few rows for every time tick (bid, ask, timestamp, etc.) x up to 0.5Million/day x hundreds of financial instruments x monthes of data. There is a MySQL server with MYISAM (which I understood would be the correct engine for this type of usage) running on commodity harware (2 x 1GB RAID 0 SATA, core 2 @ 2.7GHz) What would be correct

Moving average for time series with not-equal intervls

江枫思渺然 提交于 2019-12-04 09:24:36
I have a dataset for price of the ticker on the stock exchange: time - price. But intervals between data points are not equal - from 1 to 2 minutes. What is the best practice to calculate moving average for such case? How to make it in Matlab? I tend to think, that weights of the points should depend on the time interval that was last since previous point. Does we have function in Matlab to calculate moving average with custom weights of the points? Here is an example of the "naive" approach I mentioned in the comments above: % some data (unequally spaced in time, but monotonically non

Stock candlestick drawing issues with geom_boxplot (R)

主宰稳场 提交于 2019-12-04 07:53:48
I am using geom_boxplot to draw candlesticks using stock market data. The problem is that the individual boxplot's upper and lower edges as well as the upper whisker end point show up way higher on the y-axis than their corresponding values. The relative height (difference between upper and lower edges) and the end point of the lower whisker of each boxplot are fine though. Here's my code : candlestickPlot <- function(x){ library("ggplot2") # x is a data.frame with columns 'date','open','high','low','close' x$candleLower <- pmin(x$open, x$close) x$candleUpper <- pmax(x$open, x$close) x

“For money, always decimal”?

爱⌒轻易说出口 提交于 2019-12-03 12:16:50
Well, the rule " For money, always decimal " isn't applied inside the Microsoft development team, because if it was: Namespace: Microsoft.VisualBasic Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll) Financial.IPmt and all the other methods would receive/return decimal and not double as it is. Now I wonder if I can use these methods without worry with round mistakes? Should I use some other libraries to work with finances? If yes, could you point me some good ones (for C# use) ? You can use this class: public class Financial { #region Methods public static decimal IPmt(decimal

FigureCanvasAgg' object has no attribute 'invalidate' ? python plotting

假装没事ソ 提交于 2019-12-03 11:35:48
问题 I've been following 'python for data analysis'. On pg. 345, you get to this code to plot returns across a variety of stocks. However, the plotting function does not work for me. I get FigureCanvasAgg' object has no attribute 'invalidate' ? names = ['AAPL','MSFT', 'DELL', 'MS', 'BAC', 'C'] #goog and SF did not work def get_px(stock, start, end): return web.get_data_yahoo(stock, start, end)['Adj Close'] px = pd.DataFrame({n: get_px(n, '1/1/2009', '6/1/2012') for n in names}) #fillna method pad

looking for stock charting component [closed]

我怕爱的太早我们不能终老 提交于 2019-12-03 11:29:26
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. i am writing a financial WPF desktop application and i am looking for a component that would allow me to display (and print) OHLC, candlestick, and possibly other types of financial charts. I need to be able to embed custom graphics into the chart, i mean

simple financial rate function in javascript

痞子三分冷 提交于 2019-12-03 09:31:46
I'm looking for a simple javascript financial RATE function, and I found this one. But it seems too difficult to understand. I want to simplify this function, and I need your help. If anyone has a simplest function, please answer. (It's a excel RATE function equivalent.) var rate = function(nper, pmt, pv, fv, type, guess) { if (guess == null) guess = 0.01; if (fv == null) fv = 0; if (type == null) type = 0; var FINANCIAL_MAX_ITERATIONS = 128;//Bet accuracy with 128 var FINANCIAL_PRECISION = 0.0000001;//1.0e-8 var y, y0, y1, x0, x1 = 0, f = 0, i = 0; var rate = guess; if (Math.abs(rate) <