Back

Importing Custom Data using REST API that returns XML

Hi there,

I'm trying to import custom data from an external data source using a REST API. The issue I am facing is that the URL that I use to retrieve the data, returns data formatted in XML as opposed to JSON and I am unsure how to convert this data into the format needed using the "Reader" function. The Bitcoin example that is provided by Quantconnect only shows how to deal with JSON. I have provided below the output that I receive when the URL is executed. Any help on how to convert this output into something that can actually be used in Quantconnect would be very much appreciated!

<result>
<ratings is_array="true">
<item>
<id>59f70217efacff0001835764</id>
<date>2017-10-30</date>
<time>06:42:31</time>
<ticker>ACHC</ticker>
<exchange>NASDAQ</exchange>
<name>Acadia Healthcare Co</name>
<action_pt/>
<action_company>Downgrades</action_company>
<analyst_name>Ann Hynes</analyst_name>
<rating_current>Neutral</rating_current>
<rating_prior>Buy</rating_prior>
<importance/>
<updated>1509367107</updated>
<analyst>Mizuho</analyst>
</item>
<item>
<id>59f70171efacff000183575c</id>
<date>2017-10-30</date>
<time>06:39:45</time>
<ticker>AMD</ticker>
<exchange>NASDAQ</exchange>
<name>Advanced Micro Devices</name>
<action_pt/>
<action_company>Downgrades</action_company>
<analyst_name>Joseph Moore</analyst_name>
<rating_current>Underweight</rating_current>
<rating_prior>Equal-Weight</rating_prior>
<importance/>
<updated>1509367001</updated>
<analyst>Morgan Stanley</analyst>
</item>
</ratings>
</result>
Update Backtest








The data came out in a strange format when I pasted it in before, so have copied again below!

 

<result>

<ratings is_array="true">

<item>

<id>59f70217efacff0001835764</id>

<time>06:42:31</time>

<ticker>ACHC</ticker>

<exchange>NASDAQ</exchange>

<name>Acadia Healthcare Co</name>

<action_pt/>

<action_company>Downgrades</action_company>

<analyst_name>Ann Hynes</analyst_name>

<rating_current>Neutral</rating_current>

<rating_prior>Buy</rating_prior>

<importance/>

<updated>1509367107</updated>

<analyst>Mizuho</analyst>

</item>

<item>

<id>59f70171efacff000183575c</id>

<date>2017-10-30</date>

<time>06:39:45</time>

<ticker>AMD</ticker>

<exchange>NASDAQ</exchange>

<name>Advanced Micro Devices</name>

<action_pt/>

<action_company>Downgrades</action_company>

<analyst_name>Joseph Moore</analyst_name>

<rating_current>Underweight</rating_current>

<rating_prior>Equal-Weight</rating_prior>

<importance/>

<updated>1509367001</updated>

<analyst>Morgan Stanley</analyst>

</item>

</result>

0

I haven't tried, but this might help: 

https://stackoverflow.com/questions/14429513/parsing-xml-returned-by-web-service-response
0

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