I am very new to Amibroker and AFL language.
I am trying to call a REST GET API from my algo written in AFL, but it ends up opening the endpoint in new browser tabs for every call.
I am trying something like this -
AlertIf( True, "EXEC https://http.cat/100", "Hello World", 2 );
I was trying your suggestion and I am getting syntax errors. Do I need a specific version of Amibroker to be able to use the InternetOpenURL() ?
OR do I need to include/import any package to make this work?
Context - I am from Java background, trying my hands at AFL
@C_M using InternetOpenURL() to query some data from a REST server is entirelye possible as demonstrated by the code samples I posted previously.
The data you'll receive will very probably be in JSON format, so you need to parse it and extract the relevant information for your formula. Then you can do whatever you want with such data!
There is one important caveat: be sure that your REST server will provide headers with "no-cache" otherwise you'll see stale data.
I did some test using a very basic nodejs/express and found that the AmiBroker function will not force a refresh of data for repeated requests of the same resources, but will simply get them from the cache. On the express server, I had to use a middleware function to avoid the issue.
@beppe I'm not 100% sure if this is applicable in this case, but I do a lot of web scraping / web data extraction (using also AmiBroker Internet functions for that) and at the beginning I had similar problems with stale/cached data in case of repetitive queries, but these problems were solved when I changed Temporary Internet Files settings - "Check for newer versions of stored pages" to Every time I visit the webpage
If you haven't done that already, you can check if this helps.
InternetOpenURL() is a WinINet function and WinINet is a part of Operating System also used by IE:
Version( 6.30 ); // required version
INTERNET_FLAG_RELOAD = 0x80000000;
INTERNET_FLAG_NO_COOKIES = 0x00080000;
ih = InternetOpenURL( "http://www.google.com", INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_COOKIES );
InternetClose( ih );
HI, My broker requires checksum(SHA-256 OF api_key + request_token + api_secret) to further POST (REST API) request for issuing session token in the following format:-
-H "X-Kite-Version: 3"
I have value of xxx and yyy. Please suggests how to go about it in AFL. Thank you !