Download MetaTrader 5
To add comments, please log in or register
Sell products right in MetaTrader. Millions of traders are waiting for this!
rtf72
11
rtf72 2016.08.30 19:27 

 Is it possible to fetch the value from the following CSV format API call so that it can be compared against another number within a script?

<Removed>


Only one value will be fetched from the API call (due to the rows=1 parameter), which will then be compared against another manually entered number. 

double x = 20,    
       y = ...;     // THE VALUE I WANT TO FETCH FROM THE API CALL 

void OnStart () {

       if (x>y) {
                   // EXECUTES FUNCTION
                }
       
       if (x<y) (
                   // EXECUTES OTHER FUNCTION
                }
}

 

If anyone could help me with this I'd be really appreciative- I've been struggling to find any support on calling a single value from a CSV source. 

Thank you. 

Fernando Carreiro
1468
Fernando Carreiro 2016.08.30 20:36  
rtf72: Is it possible to fetch the value from the following CSV format API call so that it can be compared against another number within a script?

Only one value will be fetched from the API call (due to the rows=1 parameter), which will then be compared against another manually entered number.

If anyone could help me with this I'd be really appreciative- I've been struggling to find any support on calling a single value from a CSV source.

When in doubt, search and read the documentation, be it online or via the built-in Help (F1).

You can use the function WebRequest() to obtain data from the web, but you will have to learn about HTTP, and depending on the API that website provides, you may also need to learn REST and data formats like JSON.

These however, are beyond the scope of this forum, so for more information on HTTP, REST or JSON, you will have to search the Internet to learn more about those.

rtf72
11
rtf72 2016.08.30 21:48  

Thank you for your fast response. 

 I have read through much of the documentation- it was helpful enough to enable me to write my script, however, the difficulty level to call CSV was great enough to require some assistance.

The website I'm using also provides APIs for JSON and XML formats- do you know if these be more suitable for my task? 

Fernando Carreiro
1468
Fernando Carreiro 2016.08.30 22:56  
rtf72:

Thank you for your fast response. 

 I have read through much of the documentation- it was helpful enough to enable me to write my script, however, the difficulty level to call CSV was great enough to require some assistance.

The website I'm using also provides APIs for JSON and XML formats- do you know if these be more suitable for my task? 

That will be difficult to answer, as don't know what your objective is nor have I ever used Quandl's services, so cannot provide an informed answer. In general aspects, CSV will be most likely easier to parse instead of JSON, and JSON will be easier to parse instead of XML, but that all depends on what type of data you are collecting and how it is structured.

Please note, that collecting and parsing Web data via an API, be it CSV, JSON or XML, is not something for a beginner or newbie coder. It requires at least an intermediate level of coding knowledge and good understanding about protocols such as HTTP, REST, JSON and/or XML.

I also, have to call to your attention again, that this is a MQL forum and not about web protocols, and you should really seek out other sites or forums that deal with these topics. Here are a few links that could help out:

PS! I also suggest reading the following thread on here: https://www.mql5.com/en/forum/155847

/
To add comments, please log in or register