financial

PHPExcel based function RATE() returning NAN()

吃可爱长大的小学妹 提交于 2019-12-08 04:28:24
问题 I have this code: http://pastebin.com/Sd9WKZFr When i call something like rate(60, -6000, 120000) it returns me a NAN result, but the same function on MS Excel returns me 0,04678... . I have the same problem trying -5000, -4000, -3000 and -2000. When i debug the code, i see that about the 8/9 iteration, the line number 29 begins to return a NAN result, making all of other results to turn NAN too. BUT, when i call something like rate(60, -1000, 120000) it returns me a float -0.02044... ,

What is the most efficient way to get log returns in numpy

 ̄綄美尐妖づ 提交于 2019-12-06 16:42:15
What is the fastest and most elegant solution to building a sequence of log returns? The problem is mainly around mapping a function that takes the i'th and (i+1)'th elements as inputs for every element in the array. for a function and simple array I can define the log returns as follows: import numpy as np ar = np.random.rand(10) f_logR = lambda ri, rf: np.log(rf) - np.log(ri) logR = np.asarray([f_logR(ar[i], rf) for i,rf in enumerate(ar[1:])]) However, I am building a list from individual numpy elements and then converting it back into a numpy array again. I am also accessing the elements in

Convert .csv file for further manipulation using 'highfrequency' package on R

家住魔仙堡 提交于 2019-12-06 12:29:06
问题 The highfrequency package has been created in a way to transform .txt and .csv files from the NYSE TAQ and WRDS TAQ respectively into .RData files of xts objects, which then can be easily manipulated through the package. The problem is that I have limited access to the WRDS database which only enables me to download tick-data from the CRSP (The Center for Research in Security Prices) database but not the TAQ (Trades and Quotes) database. So my data look like this. The downloadable file

Open Source Financial Library Specifically Yield To Maturity [closed]

霸气de小男生 提交于 2019-12-06 12:25:06
问题 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. Closed 6 years ago . Does anyone know of an open source financial library that implements Yield To Maturity and other fixed income calculations? The

Moving average for time series with not-equal intervls

空扰寡人 提交于 2019-12-06 05:37:02
问题 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? 回答1: Here is an example of the "naive"

Database design question

a 夏天 提交于 2019-12-06 04:17:21
问题 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

Stock candlestick drawing issues with geom_boxplot (R)

廉价感情. 提交于 2019-12-06 03:08:33
问题 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

Free API or similar to get Next Earnings Date for stocks [closed]

↘锁芯ラ 提交于 2019-12-05 04:12:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am looking for an API or similar where I can get the next (upcoming) earnings date for a stock. I have googled for it and haven't found anything usable. I know of both the Yahoo and Google finance APIs, but none of them provide the next earnings date. Many sites, i.e. www.finviz.com (look for "Earnings" here

Convert .csv file for further manipulation using 'highfrequency' package on R

守給你的承諾、 提交于 2019-12-04 19:34:29
The highfrequency package has been created in a way to transform .txt and .csv files from the NYSE TAQ and WRDS TAQ respectively into .RData files of xts objects, which then can be easily manipulated through the package. The problem is that I have limited access to the WRDS database which only enables me to download tick-data from the CRSP (The Center for Research in Security Prices) database but not the TAQ (Trades and Quotes) database. So my data look like this . The downloadable file contains tick-data for the REIT index from 2014-01-01 to 2014-01-05. I changed manually the ticker header

simple financial rate function in javascript

守給你的承諾、 提交于 2019-12-04 14:47:53
问题 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