Alpha Vantage error when symbol has digits - alpha-vantage

I'm trying to get quotes for an Australian stock with ticker A200.AX (aka A200.AUS) from Alpha Vantage.
I have no issues getting other symbols from the AX market, e.g.:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=ETHI.AUS&apikey=demo
...returns data as expected
However when a symbol has digit(s) in it, it seems to return an error:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=A200.AUS&apikey=demo
Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_INTRADAY.
Same result for F100.AUS
I checked to make sure the ticker was valid: A200.AUS shows up if I search for it:
https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=A200.AUS&apikey=demo
I'm aware of some questions related to URL encoding, but I can't see any URL special characters in A200.AUS . Besides, using the search endpoint works with the ticker passed on literally.
Does anyone know how to download this stock's information or what I'm doing wrong?

Your use of the search endpoint is great, however A200.AUS is an ETF. Alpha Vantage has some ETFs, but currently, only 100% supports stocks.

Related

Grafana: Overrriding series with metric named `/var(avail_MB)`: "Panel rendering error '/var(avail_MB)' is not a valid regular expression."

An Icinga2 plugin (written by myself) returns performance data with metrics named /var(avail_MB), /var(total_MB) and similar. Data is forwarded to an InfluxDB with Grafana as Frontend.
I'm using "GROUP BY" "tag(metric)" and "ALIAS BY" "$tag_metric" in a dashboard's panel query.
The metric names are displayed correctly below the graph then.
However when I try to override series by specifying "alias or regex" /var(avail_MB) it does not seem to work, and when going back from panel configuration to dashboard, I get an error message saying "Panel rendering error '/var(avail_MB)' is not a valid regular expression.".
I tried to put a backslash in front of ( and ), but that didn't help.
To make matters worse, the whole graph disappeared, and when trying to open the "Query Inspector", the frontend seems to take forever (Query never appears).
What is the problem, and how could I fix it?
I'm new to Icinga2, Grafana and InfluxDB (I'm just a "user" not administrator of those).
The color change is not applied to the graph.
Here is an example of plugin output:
OK: /var: 3114/5632MB (55.30%), slope is NaN|/var(total_MB)=5631.56MB;;;0 /var(avail_pct)=55.30%;25;5;0;100 /var(avail_MB)=3114.12MB;10;5;0;5632 /var(est_avail_MB)=nanMB;10;5;0;5632
(The "nanMB" was a bug in the plugin that has been fixed already, but that data wasn't from the machine in question.)
The problems seems to be the beginning of the string ("/var").
Grafana seems to treat every string starting with / as regular expression, and it expects any regular expression to start with /, too (it seems).
So the fix was to add a trailing /, and escape the literal / as \/.
Unfortunately this only removes the error message, but doesn't make the override work (match).
It is also required to backslash-escape the parentheses and the slash(es):
Instead of /var(total_MB) you need to write /\/var\(total_MB\).
The original problem has two origins:
The monitoring plugin specification at https://www.monitoring-plugins.org/doc/guidelines.html#AEN201 states: "2. label can contain any characters except the equals sign or single quote (')") states that any character except = and ' is allowed as metric name.
Grafana v6.7.3 proposes the incorrect (i.e.: unescaped) values for "alias or regex".
That is how I had created the problem.

how do duckduckgo spice IA secondary API calls get their parameters?

I have been looking through the spice instant answer source code. Yes, I know it is in maintenance mode, but I am still curious.
The documentation makes it fairly clear that the primary spice to API gets its numerical parameters $1, $2, etc. from the handle function.
My question: should there be secondary API calls included with spice alt_to as, say, in the movie spice IA, where do the numerical parameters to that API call come from?
Note, for instance, the $1 in both the movie_image and cast_image secondary API calls in spice alt_to at the preceding link. I am asking which regex capture returns those instances of $1.
I believe I see how this works now. The flow of information is still a bit murky to me, but at least I see how all of the requisite information is there.
I'll take the cryptocurrency instant answer as an example. The alt_to element in the perl package file at that link has a key named cryptonator. The corresponding .js file constructs a matching endpoint:
var endpoint = "/js/spice/cryptonator/" + from + "/" + to;
Note the general shape of the "remainder" past /js/spice/cryptonator: from/to, where from and to will be two strings.
Back in the perl package the hash alt_to->{cryptonator} has a key from which receives, I think, this remainder from/to. The value corresponding to that key is a regex meant to split up that string into its two constituents:
from => '([^/]+)/([^/]*)'
Applied to from/to, that regex will return $1=from and $2=to. These, then, are the $1 and $2 that go into
to => 'https://api.cryptonator.com/api/full/$1-$2'
in alt_to.
In short:
The to field of alt_to->{blah} receives its numerical parameters by having the from regex operate on the remainder past /js/spice/blah/ of the name of the corresponding endpoint constructed in the relevant .js file.

Using "is null" when retrieving prices doesn't work

I am trying to get the price items for performance block storage that are generic (not specific to a certain datacenter). I can see that these have the locationGroupId set to blank or null, but I can't seem to get the objectFilter to work with that, the query returns nothing. If I omit the locationGroupId filter I get a result that contain both location-specific and non-location specific prices.
GET /rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":"is null"}}}
I am guessing there is something wrong with the object filter, any ideas?
If I filter on locationGroupId 509 it works:
/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":509}}}
The reason it the first query didn't work while the second did was that I used the command "curl -sg" to do the request. While that eliminates the need to escape the {}[] characters - it also turns off escaping other characters correctly in the URL - like the space in "is null". Changing that to "is%20null" solves the issue.
I am posting this as the answer as I find it likely for others to encounter this problem.

How to get larger version of Facebook's thumbnail images?

Right now the Facebook API is returning a URL like this with all post/album images 130x130 pixels in size:
https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xfp1/v/t1.0-9/s130x130/10801504_570625556403546_6496651209845129904_n.jpg?oh=dcf8ab3752522532871d2aaab09b6e7e&oe=54E4402F&gda=1424027679_76464aeeaa5d232b8100d01476af4ec7
How do I retrieve a full (or any bigger size) image based on that URL?
For example this one:
https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xfp1/v/t1.0-9/p417x417/10801504_570625556403546_6496651209845129904_n.jpg?oh=cd2b5cb0d74f7306c098de9f56dc6e27&oe=54E1F4C1&gda=1423830001_e700bfac39039952bfee55b200c158bf
or anything like that?
All the other suggestions of removing s130x130 from the URL, or /v/t1.0-9/, or replacing _s with _n or anything like that aren't valid any more - I've tried them all (try them yourself if you don't believe me). Is there a way to make this happen? Not sure what Facebook guys have changed to disable that...
After a couple of hours searching and pulling my hair out, I found a solution that works for me. In my case I'm pulling posts from {page-id}/posts, but I'm pretty sure this will work for you too, seeing that I used to get larger images using the same approach as you mention.
This is works for me:
bigger_image="https://graph.facebook.com/" + picture_url_from_facebook.match(/_\d+/)[0].slice(1) + "/picture?type=normal";
/_\d+/ matches any substring starting with an underscore (_) followed by any digits (\d matches one digit, \d+ does the digit match over and over until it fails)
match(regex) returns an array with all strings it could find matching the specified regex
we grab the first ([0]) element, as this will be an underscore followed by the ID of the picture in Facebook's database
we slice the string from index 1 to the end, as the underscore is not a part of the ID
we then get a working link from facebook using the graph api without the need for any extra calls (you can use this in for example an img tag directly)
You can see this working in action # this fiddle or this page we did for a client
Thanks to Er Adhish for leading the way to the solution # https://stackoverflow.com/a/27075503/2908761
https://graph.facebook.com/{object_id}/picture?type={thumbnail|album|normal}
Example (using a bogus object_id of 122233334444555):
https://graph.facebook.com/122233334444555/picture?picture?type=large
Make sure object_id is not just the id of an item but it's object_id (which is typically the number following the underscore in the full id).
I got those type values from a helpful facebook response message that said:
"message": "(#100) type must be one of the following values: thumbnail, album, normal"
In place of ?type=... you could do height/width as well:
?width=543&height=543

BIRT Chart API setting caption to string with equal sign in it truncates value on left

I'm attempting to use the Chart API directly and am running into a problem with an expression.
If I attempt to do the following
chart.getTitle().getLabel().getCaption().setValue("Day of Week (M=1)");
The resulting label is:
1)
If I remove the '=' from the value it works fine no problems but that '=' appears to be triggering an expression evaluation.
Note this is using the Chart Engine API, and this chart is NOT associated with a BIRT Report.
Anyone have any suggestions?
EDIT It looks like while generating the chart, it attempts to resolve the chart title as a key for an externalized message. RunTimeContext.externalizeMessage(...) because of the fact that my title contains an '=' sign. Is there a way to escape this to prevent it from attempting to render it as this?
I took a deeper look into this and was able to fake it out by implementing an externalizer and just keying it to concatenate the key & default values together with the '=' token constant.
as this is for demo purposes it worked ... granted not the most optimal solution but it got what I needed.