finance

Overlapping Dates in Candlestick Plot from a Pandas DataFrame

一世执手 提交于 2019-11-29 02:57:30
问题 I have a pandas dataframe output as follows Open High Low Close 2016-06-01 69.60 70.20 69.44 69.76 2016-06-02 70.00 70.15 69.45 69.54 2016-06-03 69.51 70.48 68.62 68.91 2016-06-04 69.51 70.48 68.62 68.91 2016-06-05 69.51 70.48 68.62 68.91 2016-06-06 70.49 71.44 69.84 70.11 I've used the following code to make the candlestick plot: import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mticker from matplotlib.finance import candlestick_ohlc import

Programmatically access Currency Exchange Rates from Yahoo Finance by Date

懵懂的女人 提交于 2019-11-29 02:38:36
问题 I found the answer to this question VERY useful, but I would like to also get exchange rates for dates in the past, not just today's exchange rates. I'm writing an iPhone app that uses the exchange rate to calculate money made from sales in different countries. Here's the example from the answer mentioned above to get today's echange rate for GBP to EUR: http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=sl1d1t1ba&e=.csv Does anyone know how to do this for any other dates? THANK YOU!

If you know the future prices of a stock, what's the best time to buy and sell?

隐身守侯 提交于 2019-11-29 02:07:27
Interview Question by a financial software company for a Programmer position Q1) Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to buy one share of the stock and sell one share of the stock, design an algorithm to find the best times to buy and sell. My Solution : My solution was to make an array of the differences in stock prices between day i and day i+1 for arraysize-1 days and then use Kadane Algorithm to return the sum of the largest continuous sub array.I would then buy at the start of the largest continuous array and

SciPy optimization with grouped bounds

怎甘沉沦 提交于 2019-11-28 18:30:04
I am trying to perform a portfolio optimization that returns the weights which maximize my utility function. I can do this portion just fine including the constraint that weights sum to one and that the weights also give me a target risk. I have also included bounds for [0 <= weights <= 1]. This code looks as follows: def rebalance(PortValue, port_rets, risk_tgt): #convert continuously compounded returns to simple returns Rt = np.exp(port_rets) - 1 covar = Rt.cov() def fitness(W): port_Rt = np.dot(Rt, W) port_rt = np.log(1 + port_Rt) q95 = Series(port_rt).quantile(.05) cVaR = (port_rt[port_rt

Webservice to get stock quotes? [closed]

走远了吗. 提交于 2019-11-28 17:48:43
问题 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 7 years ago . I want to create a website similar to Yahoo finance, but much less complex for an independent study. I will be using Java to do this

Downloading Yahoo stock prices in R

≡放荡痞女 提交于 2019-11-28 15:40:20
This is a newbie question in R. I am downloading yahoo finance monthly stock price data using R where the ticker names are read from a text file. I am using a loop to read the ticker names to download the data and putting them in a list. My problem is some ticker names may not be correct thus my code stops when it encounters this case. I want the following. skip the ticker name if it is not correct. Each element in the list is a dataframe. I want the ticker names to be appended to variable names in element dataframes. I need an efficient way to create a dataframe that has the closing prices as

Performance of C++ vs Virtual Machine languages in high frequency finance

元气小坏坏 提交于 2019-11-28 15:32:40
I thought the C/C++ vs C#/Java performance question was well trodden, meaning that I'd read enough evidence to suggest that the VM languages are not necessarily any slower than the "close-to-silicon" languages. Mostly because the JIT compiler can do optimizations that the statically compiled languages cannot. However, I recently received a CV from a guy who claims that Java-based high frequency trading is always beaten by C++, and that he'd been in a situation where this was the case. A quick browse on job sites indeed shows that HFT applicants need knowledge of C++, and a look at Wilmott

Download history stock prices automatically from yahoo finance in python

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 15:06:55
Is there a way to automatically download historical prices of stocks from yahoo finance or google finance (csv format)? Preferably in Python. Short answer: Yes. Use Python's urllib to pull the historical data pages for the stocks you want. Go with Yahoo! Finance; Google is both less reliable, has less data coverage, and is more restrictive in how you can use it once you have it. Also, I believe Google specifically prohibits you from scraping the data in their ToS. Longer answer: This is the script I use to pull all the historical data on a particular company. It pulls the historical data page

storing massive ordered time series data in bigtable derivatives

[亡魂溺海] 提交于 2019-11-28 13:46:40
问题 I am trying to figure out exactly what these new fangled data stores such as bigtable, hbase and cassandra really are. I work with massive amounts of stock market data, billions of rows of price/quote data that can add up to 100s of gigabytes every day (although these text files often compress by at least an order of magnitude). This data is basically a handful of numbers, two or three short strings and a timestamp (usually millisecond level). If I had to pick a unique identifier for each row

Best/Most Comprehensive API for Stocks/Financial Data [closed]

試著忘記壹切 提交于 2019-11-28 13:10:52
问题 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 7 years ago . What is the most recommended free/public API for accessing financial market stats and stock quotes (preferrably real-time quotes)? I'm