Yep that's a fair comment, we built it because we were sharing so much stuff that it became difficult to remember who had sent which link, and what exactly was in the article. Plus we're super-lazy and saving that 5-10 seconds 20 times a week seemed worth it. Ultimately I see the value in this being the summarization of articles - there's too much stuff to read, so anything that helps in that area could be cool. But thanks for the feedback, we may need to improve that message :-)
# helper methods
def content_ar_from(doc, xpath)
doc.xpath(xpath).map {|d| d.content.strip}
end
def first_value_for(doc, xpath)
content_ar_from(doc, xpath).first
end
# download the file to 'path'
doc = Nokogiri::XML(File.read(path))
# try to find the declared namespace
uk_gaap = doc.namespaces.select {|k, v| v =~ /http:\/\/www.xbrl.org\/uk\/gaap\/core\/2009-09-01/}
uk_bus = doc.namespaces.select {|k, v| v =~ /http:\/\/www.xbrl.org\/uk\/cd\/business\/2009-09-01/}
# if it's not there use default
uk_gaap_ns = uk_gaap.keys.first.gsub(/xmlns:/, "") rescue "uk-gaap"
uk_bus_ns = uk_bus.keys.first.gsub(/xmlns:/, "") rescue "uk-bus"
# example of getting the company number
company_number = first_value_for(doc, "//*[@name='#{uk_bus_ns}:UKCompaniesHouseRegisteredNumber']")
# example of getting the cash in hand
cash_bank_in_hand = first_value_for(doc, "//*[@name='#{uk_gaap_ns}:CashBankInHand']")
This is the end result of some nasty XML-munging of the newly-available Companies House data sets (http://www.companieshouse.gov.uk/toolsToHelp/dataProducts.sh...). I know you can get similar stuff from Duedil, but this is free and open, and you can download stuff without paying. Enjoy!
Currently it's daily. One of the possible future extensions is into intra-day but it brings a whole load of extra technical problems. Honestly the problems look really fun, things like keeping the backtest running relatively fast, caching the large amounts of extra data and the added complexity of intra-day strategies. However at the moment we need more data on how people want to use it as that's a pretty big outlay on development time.
we've all been salivating about the potential for an 'Optimise' button. It would be really cool, it has a few wrinkles though, e.g. there might not be a unique maximum solution, so how do you choose the best one? Once there are a few variable involved it may be a job for a genetic algo, but it would have to be in the background. All food for thought ;-)
Here's how I'd do it:
Don't let the variable be the stock itself because otherwise your search space will be too big... limit the number of stocks you can optimise on and constrict it to variables like "moving average duration". That way you can load the stock data onto the client side and do the processing there (presumably you're already doing this for your graphs anyway) - kick it off with a few generations of pretty loose genetic algorithm then when you get near your time limit switch to simulated annealing with the best handful of results to narrow down the answer as fast as possible. Keep it quick, say 2 seconds tops. Then what you can do is give the client a confidence rating so you can say something like "Found the following result with 89% confidence. Click here to perform a longer search for higher accuracy". Work out your confidence rating based on how bumpy the ride was.
yeah that caught us out - we found that even though the data is freely available from those sources, you're not allowed to include that data in a commercial app :-(
Oh really? That's interesting - does that apply even if it's not distributed with the commercial app? I'm sure I've used trading platforms before which use Yahoo...
Our understanding of the Yahoo/google T&Cs was that we couldn't aim to profit from their data (http://finance.yahoo.com/badges/tos). We may be being overcautious but we didn't want to risk getting into trouble ;-)
https://www.sec.gov/Archives/edgar/data/1447669/000104746916...