Back

AddData question

I'm attempting to access Sharadar's premium Core US Fundamentals Data from Quandl with AddData. They want an url like this:

https://www.quandl.com/api/v3/datatables/SHARADAR/SF1.csv?ticker=AAPL&api_key=1xaA2KgN-ESm-fzR3Kmy

I can indicate 'SHARADAR/SF1', but how do I include the ticker when AddData has no way of indicating what ticker to use?

Update Backtest







Hmmm. Looks like I might be able to inherit from Quandl and override the GetSource function to hack in a change to the url. If anyone knows a proven way I'm all ears.

0

namespace QuantConnect
{
public class BasicTemplateAlgorithm : QCAlgorithm
{
public string[] Symbols = {"FLOT","PFTPX","OOSYX","LSFYX","LFRFX"};

public override void Initialize()
{
SetStartDate(2010, 01, 01);
SetEndDate(DateTime.Now);
SetCash(10000000);
foreach (var symbol in Symbols)
{
AddData<Custom>(symbol, Resolution.Daily);
Securities[symbol].FeeModel = new ConstantFeeTransactionModel(25);
}
}
public void OnData(Custom data)
{
foreach (var symbol in Symbols)
{
if (!Portfolio[symbol].IsLong)
{
Order(symbol, 1);
}
}
}
}
public class Custom : BaseData
{
public decimal Open;
public decimal High;
public decimal Low;
public decimal Close;
public Custom()
{

}

public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
{
return new SubscriptionDataSource("https://api.tiingo.com/tiingo/daily/"+config.Symbol+"/prices?startDate=2000-1-1&endDate=2018-6-15&format=csv&token=myapikey", SubscriptionTransportMedium.RemoteFile);
}

public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLive)
{
var index = new Custom();

try
{
string[] data = line.Split(',');
index.Time = DateTime.Parse(data[0]);
index.Open = Convert.ToDecimal(data[1]);
index.High = Convert.ToDecimal(data[2]);
index.Low = Convert.ToDecimal(data[3]);
index.Close = Convert.ToDecimal(data[6]);
index.Symbol = config.Symbol;
index.Value = index.Close;
}
catch { }

return index;
}
}
}

Here is what I've been using to access different mutual funds data from an API, this might work for you?

0

Ya, that looks similar to what I'm going to attempt. Thanks!

1

Will // Warren -- you should also set the period for custom data so you get it at the right time. 

In this case Period = TimeSpan.FromDays(1)

Otherwise its point data and Time = EndTime

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed