Hi all. Not sure how many people might find this useful, but thought I'd share anyway.
One aspect I found rather lacking as far as NT is concerned is being able to develop strategies, especially portfolio strategies based on fundamental data, short interest, earnings surprises and things like that. As far as I know, some data providers provide current fundamental data values, but this does not help us in strategy development as we require historical data to relate it to subsequent price performance. I'm sure others have built strategies like this where they maintain their own CSVs/databases and have NT read from them.
However, most of this historical data is available in various databases on Quandl which has been discussed in several threads here (disclaimer: most of these databases are premium and require paid subscriptions).
Anyway, I was having a look around and found this ( which is a C# wrapper for the Quandl API (credit to HubertJ), and the original source for my attachments. I made some minor changes to it (added a column index option, changed the v1 calls to v3 except for favourites which do not seem to exist in v3, updated the request strings for v3, and removed the multi/superset download which seems to have been deprecated). I have attached the modified source, and the compiled .dll.
Here are some code snippets which lets you pull some fundamental data from Quandl's database and both saves it as a .csv, and stores it in an array for manipulation. You will need to reference the .dll file or compile your own. You will also need to provide an API key (which you can get for free by creating an account, and this gives you a number of trial requests to various databases). For the StreamWriter part, make sure you enter a valid local path.
using QuandlCS.Connection;
using QuandlCS.Interfaces;
using QuandlCS.Requests;
using QuandlCS.Types;
QuandlDownloadRequest request = new QuandlDownloadRequest();
request.APIKey = "YOUR API KEY HERE"; // Insert your API Key here.
//request.Datacode = new Datacode("GOOG", "NASDAQ_AAPL"); // This is a request to a free database, which you can use for testing/playing around.
request.Datacode = new Datacode("SF1", "AAPL_PE_ART"); // This is a request to a premium database, which will use up your free trial views.
request.Format = FileFormats.CSV;
request.Frequency = Frequencies.Quarterly;
//request.ColumnIndex = 2;
//request.Truncation = 10;
request.Sort = SortOrders.Descending;
request.Headers = false;
IQuandlConnection connection = new QuandlConnection();
string data = connection.Request(request);
using (System.IO.StreamWriter SW = new System.IO.StreamWriter(@"C:\QuandlGrab.csv")) // Insert your local CSV path here.
{
SW.WriteLine(data);
}
// Split and save the data as an array for manipulation from within the strategy.
string[] contents = data.Split('\n');
int count = contents.Length - 1;
DateTime[] dates = new DateTime[count];
double[] prices = new double[count];