quantitative-finance

How far back in time can I query historical quotes from Yahoo Finance YQL?

你说的曾经没有我的故事 提交于 2019-12-11 13:48:11
问题 I'm building a small proof-of-concept app that requires historical stock quotes. The UI in my app allows users to select a date range, and I've been using the YQL console to generate the REST calls to request the historical quote data. YQL calls like this: select * from yahoo.finance.historicaldata where symbol = "JNJ" and startDate = "2015-01-01" and endDate = "2015-12-11" work fine, but if I go too far back into time like this: select * from yahoo.finance.historicaldata where symbol = "JNJ"

Should the positioning of the external regressors change the output of arma-garch? (Possible rugarch bug/error)

人走茶凉 提交于 2019-12-11 08:31:19
问题 Got an interesting issue with the rugarch package. I noticed that when I changed the order of the external regressors, there are different values for the robust coefficient matrix. The values should be the same (respective to the ordering of the variables). However, I am getting drastically different results. At that time the model was arma(2,2) + garch(1,0). Is this considered a normal behavior of the rugarch package? I assume that when you change the ordering of the external regressors the

how to get series of requests in ibapi on python

泪湿孤枕 提交于 2019-12-10 11:54:53
问题 I am new both in Python and ibapi, I have ask Interactive Broker itself, they told me only : The self.done is originally defined in the parent class EClient that is used to indicate the current API connection is "done". You should not use it as an indicator to stop a loop that is build by yourself. You can keep one API client connection live until you have finished downloaded all the historical data you need. If you need to slow down the pace in requesting data, you can use other thread

Converting html table to a pandas dataframe

巧了我就是萌 提交于 2019-12-09 21:34:13
问题 I have been trying to import a html table from a website and to convert it into a pandas DataFrame . This is my code: import pandas as pd table = pd.read_html("http://www.sharesansar.com/c/today-share-price.html") dfs = pd.DataFrame(data = table) print dfs It just displays this: 0 S.No ... But if I do; for df in dfs: print df It outputs the table.. How can I use pd.Dataframe to scrape the table? 回答1: HTML table on the given url is javascript rendered. pd.read_html() doesn't supports

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 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 weekend , therefore using next business day as start date. In our case, 2034-04-08 is a Saturday, so we end

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 =