Programmatically access currency exchange rates [closed]
You can get currency conversions in a simple format from yahoo: For example, to convert from GBP to EUR: http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=sl1d1t1ba&e=.csv
You can get currency conversions in a simple format from yahoo: For example, to convert from GBP to EUR: http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=sl1d1t1ba&e=.csv
When you’re going to work with such time series in Python, pandas is indispensable. And here’s the good news: it comes with a historical data downloader for Yahoo: pandas.io.data.DataReader. from pandas.io.data import DataReader from datetime import datetime ibm = DataReader(‘IBM’, ‘yahoo’, datetime(2000, 1, 1), datetime(2012, 1, 1)) print(ibm[‘Adj Close’]) Here’s an example from the pandas … Read more
I recently wrote a simple python script to download the history of a single stock. Here an example how to invoke it: python get_quote_history.py –symbol=IBM –from=2017-01-01 –to=2017-05-25 -o IBM.csv This will download IBM historical prices from 2017-01-01 to 2017-05-25 and save them in IBM.csv file. import re import urllib2 import calendar import datetime import getopt … Read more
It is important to note that there are various ways of defining the RSI. It is commonly defined in at least two ways: using a simple moving average (SMA) as above, or using an exponential moving average (EMA). Here’s a code snippet that calculates various definitions of RSI and plots them for comparison. I’m discarding … Read more
If you create an “as.acntngFmt” method for the accounting format, you can read (or perhaps re-read with a text connection using colClasses(“acnt”). setClass(“acntngFmt”) # [1] “acntngFmt” setAs(“character”, “acntngFmt”, function(from) as.numeric( gsub(“\\)”, “”, gsub(“\\(“, “-“, from)))) Input <- “A, B, C (1.76), 1%, 3.50€ 2.00, 2%, 4.77€ 3.000, 3% , €5.68” DF <- read.csv(textConnection(Input), header = … Read more
Replace ^DJI with INDU (that’s one of the tickers for the Dow) – that will work. No idea why ^DJI stopped working last weekend – someone has made a ‘negative enhancement’. Cheerio GT
Floating point arithmetic will almost always be significantly faster because it is supported directly by the hardware. So far almost no widely used hardware supports decimal arithmetic (although this is changing, see comments). Financial applications should always use decimal numbers, the number of horror stories stemming from using floating point in financial applications is endless, … Read more
You can use yahoo’s symbol lookup like so: http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=yahoo&callback=YAHOO.Finance.SymbolSuggest.ssCallback Where query is the company name. You’ll get something like this in return: YAHOO.Finance.SymbolSuggest.ssCallback( { “ResultSet”: { “Query”: “ya”, “Result”: [ { “symbol”: “YHOO”, “name”: “Yahoo! Inc.”, “exch”: “NMS”, “type”: “S”, “exchDisp”: “NASDAQ” }, { “symbol”: “AUY”, “name”: “Yamana Gold, Inc.”, “exch”: “NYQ”, “type”: “S”, “exchDisp”: … Read more
Create a datetime object with as.POSIXct: as.POSIXct(paste(x$date, x$time), format=”%Y-%m-%d %H:%M:%S”) [1] “2010-02-02 08:00:03 GMT” “2010-02-02 08:00:04 GMT” “2010-02-02 08:00:04 GMT” [4] “2010-02-02 08:00:04 GMT” “2010-02-02 08:00:04 GMT”
You should probably scale your decimal values by 100, and represent all the monetary values in whole cents. This is to avoid problems with floating-point logic and arithmetic. There is no decimal data type in JavaScript – the only numeric data type is floating-point. Therefore it is generally recommended to handle money as 2550 cents … Read more