quantitative-finance

QuantLib-Python: Solving non positive time forward error using quantlib Schedule for VanillaSwap instrument

家住魔仙堡 提交于 2019-12-08 16:11:29
I am trying to price a forward swap using a bootstrapped curve in the QuantLib environment. For my valuationDate of 2019-04-04, the curve bootstrap runs as expected. I am also able to easily price a 10Y10Y foward start swap. The problem arise when I try pricing a 15Y5Y forward swap. Assume my

Pyalgotrade - TA-LIB - Indicator Returns “NONE”

懵懂的女人 提交于 2019-12-08 13:04:18
问题 I'm working with Pyalgotrade to test a trading strategy in python. Pyalgotrade allows for the use of a library called TA-LIB,which is a technical analysis library. For some reason, when I use the PPO indicator it returns "None". The indicator takes in a few arguments:(http://gbeced.github.io/pyalgotrade/docs/v0.12/html/talib.html) I provided a snippet of the output which for now is only the closing stock price of the day and what was supposed to be the output from this indicator. 'DDD' is the

Get Annual Financial Data for a Stock for many years in R

我是研究僧i 提交于 2019-12-08 09:21:26
问题 Suppose I want to regress in R Gross Profit on Total Revenue. I need data for this, and the more, the better. There is a library on CRAN that I find very useful: quantmod , that does what I need. library(quantmod) getFinancials(Symbol="AMD", src="google") #to get the names of the matrix: rownames(AMD.f$IS$A) Total.Revenue<-AMD.f$IS$A["Revenue",] Gross.Profit<-AMD.f$IS$A["Gross Profit",] #finally: reg1<-lm(Gross.Profit~Total.Revenue) The biggest issue that I have is that this library gets me

MQL4, Code layout for big EA

不羁的心 提交于 2019-12-08 07:47:04
问题 It is mostly a theoretical question ( but example code is always welcome ). The real question is: how to correctly code the 'frame' of an EA that tests multiple scenarios from multiple custom indicators? The way I'm ( busy ) building an EA, is not very much focused on 1 strategy, but is gonna try to 'test' multiple strategies and 'picks' the most appropriate one. So I have created a few custom indicators, that are all returning an array of 'status data'. For example I have the following

QuantLib-Python: Solving non positive time forward error using quantlib Schedule for VanillaSwap instrument

有些话、适合烂在心里 提交于 2019-12-08 05:09:46
问题 I am trying to price a forward swap using a bootstrapped curve in the QuantLib environment. For my valuationDate of 2019-04-04, the curve bootstrap runs as expected. I am also able to easily price a 10Y10Y foward start swap. The problem arise when I try pricing a 15Y5Y forward swap. Assume my settlement is t+2 (2019-04-08), and I find the forward start date of the swap using the settlement date and the calendar object, The error seems to arise mostly when my forward start date falls on a

Pandas DataFrame column assignment ValueError: Wrong number of items passed

删除回忆录丶 提交于 2019-12-07 21:50:34
问题 I am having an issue with a script that was functioning prior to an upgrade of Anaconda (thus an upgrade of pandas and numpy) I have a DataFrame that I would like to use one column from and multiply by the values in a column of another DataFrame, outputting the final value to a column in a new DataFrame. As I said this code was working until I upgraded to pandas 0.17. class MarketOnClosePortfolio(Portfolio): def __init__(self, symbol, bars, signals, initial_capital=10000.0): self.symbol =

Getting stock news data from google in R [closed]

岁酱吖の 提交于 2019-12-07 17:23:10
问题 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 9 months ago . I can use quantmod to get historical data and close-to-realtime quotes for stocks. I can also use quantmod to get financials data from Google. Are there any existing R packages that would let me grab Google's news feed for a given stock? If not, is there a package for reading and parsing RSS feeds in R? 回答1:

Error: C stack usage 7970184 is too close to the limit

[亡魂溺海] 提交于 2019-12-07 14:10:29
问题 I would like to compute the RSI function, which is given as follows: RSI = 100 * RS / ( 1 + RS ), where RS = n_up / n_down and n_up( t ) = ( 1 - b ) * n_up( t - 1 ) + b * U( t ), and n_down( t ) = ( 1 - b ) * n_down( t - 1 ) + b * D( t ). where U( t ) = 1 for P( t ) > P( t - 1 ) and 0 otherwise; and D( t ) = 1 for P( t ) < P( t - 1 ) and 0 otherwise. So here is my code: p <- data[,6] rsi <- function(P,t,n) { U <- function(P,t) { if (diff(P)[t] > 0) { return(1) } else { return(0) } } D <-

Create efficient frontier in PortfolioAnalytics without an xts object

十年热恋 提交于 2019-12-07 07:25:15
问题 Is there a way to create an efficient frontier in the PortfolioAnalytics package without specifying an xts object of asset returns? Instead I'd like to supply the vector of expected returns and the covariance matrix. 回答1: There are two ways. First you can supply a list containing containing your matrices with the structure shown below and then call optimize.portfolio including this list as an argument. # num_assets is the number of assets in the portfolio momentargs <- list() momentargs$mu <-

Pandas DataFrame column assignment ValueError: Wrong number of items passed

烂漫一生 提交于 2019-12-06 13:23:23
I am having an issue with a script that was functioning prior to an upgrade of Anaconda (thus an upgrade of pandas and numpy) I have a DataFrame that I would like to use one column from and multiply by the values in a column of another DataFrame, outputting the final value to a column in a new

工具导航Map

JSON相关