Back

Importing the LBMA/Gold from Quandl in Research Environment

Hi just wondering if there's a way to import gold spot price from the quandl onto the research environment.

 

When I try to splice out data that I've added, it says that the key does not exist.

Just wondering if all of the Quandl data is available in Quant Connect or not.

 

Thanks alot.

 

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.


84917_1586513421.jpg

84917_1586513461.jpg

 

Here is my code.

0

Hi Pun Lee,

Here's an example of import and accessing "LBMA/GOLD" data from Quandl in the research environment.

class QuandlCustomColumns(PythonQuandl):
'''Custom quandl data type for setting customized value column name. Value column is used for the primary trading calculations and charting.'''
def __init__(self):
self.ValueColumnName = "USD (PM)"


qb = QuantBook()
quandlCode = "LBMA/GOLD"
gold = qb.AddData(QuandlCustomColumns, quandlCode, Resolution.Daily)

history = qb.History(qb.Securities.Keys, 360, Resolution.Daily)
print(history.loc["LBMA/GOLD"])

It's difficult to debug your code from the pictures provided. Please attach your project to your post. It will be easier to debug why your code is throwing an error.

I've attached an example of retrieving Quandl LBMA/GOLD data in both backtesting and in research.

Best
Rahul

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.


%matplotlib inline
# Imports
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Common")
AddReference("QuantConnect.Jupyter")
AddReference("QuantConnect.Indicators")
from System import *
from QuantConnect import *
from QuantConnect.Data.Custom import *
from QuantConnect.Data.Market import TradeBar, QuoteBar
from QuantConnect.Securities import Futures
from QuantConnect.Jupyter import *
from QuantConnect.Indicators import *
from QuantConnect.Python import PythonQuandl
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

# QuantBook Analysis Tool
# For more information see [https://www.quantconnect.com/docs/research/overview]
qb = QuantBook()

#gold spot
class QuandlGold(PythonQuandl):
def __init__(self):
self.ValueColumnName = "USD (PM)"


qcGold = "LBMA/GOLD" #gold spot/daily

adGold = qb.AddData(QuandlGold, qcGold, Resolution.Daily)

history = qb.History(qb.Securities.Keys, 360, Resolution.Daily)

print(history.loc['LBMA/GOLD'])

Hi Rahul Chowdhury, thanks so much for your help. I think the solution you provided worked for a while and now when we do history.loc['LBMA/GOLD'], it seems that it could not find the symbol anymore. It seems like Quandl is down some how. Do you know of this issue?

0

Hi Pun Lee,

Sorry for the late response. The issue seems to have resolved itself since I can't reproduce it. If you have any other questions or concerns, please don't hesitate to ask!

Best
Rahul

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.


So you meant that you have no problem fetching Quandl data right?

0

Do you think it's because I've reached 'research limits' since I have a free account?

0

Hi Pun Lee,

I didn't have any issue fetching the Quandl data. Are you still experiencing this issue? It may be possible that you're having issues with your access tokens; Quandl rate limits specific tokens. Can you try making a smaller history call? For example, 2 days instead of 360.

history = qb.History(qb.Securities.Keys, 2, Resolution.Daily)

Best
Rahul

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