Related
I am very very happy with Alphavantage.
BUT I can't find the german stocks (Xetra)
I have tried:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=xtr:lin&apikey=MYKEY
(But this works https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=NYSE:DIN&apikey=MYKEY)
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=Lin.be&apikey=MYKEY
(But this works: https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=Novo-b.CO&apikey=MYKEY)
So my question is - has anyone had any luck getting german stocks on Alphavanta (or another free service. Realtime is not crucial, but obviously a plus).
I use the "Search Endpoint" function to find german stocks on alphavantage.
Let's say you look for "BASF" you could query:
https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=BASF&apikey=[your API key]&datatype=csv
You get a list with possible matches:
symbol,name,type,region,marketOpen,marketClose,timezone,currency,matchScore
BASFY,BASF SE,Equity,United States,09:30,16:00,UTC-05,USD,0.8889
BFFAF,BASF SE,Equity,United States,09:30,16:00,UTC-05,USD,0.8889
BASFX,BMO Short Tax-Free Fund Class A,Mutual Fund,United States,09:30,16:00,UTC- 05,USD,0.8889
BAS.DEX,BASF SE,Equity,XETRA,08:00,20:00,UTC+02,EUR,0.7273
BAS.FRK,BASF SE,Equity,Frankfurt,08:00,20:00,UTC+02,EUR,0.7273
BASA.DEX,BASF SE,Equity,XETRA,08:00,20:00,UTC+02,EUR,0.7273
BAS.BER,BASF SE NA O.N.,Equity,Berlin,08:00,20:00,UTC+02,EUR,0.7273
BASF.NSE,BASF India Limited,Equity,India/NSE,09:15,15:30,UTC+5.5,INR,0.6000
See documentation: https://www.alphavantage.co/documentation/
It seems to work with the yahoo symbols on alphavantage, at least for a few stocks (I did not check all). BASF for example works with:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=BASF.TI&apikey=MYKEY
The alphavantage symbols for German securities consist of the Xetra symbol + .DE. For example EUNL.DE (for iShares MSCI World Core ETF). You can find a list of all Xetra stocks here.
I have a set of queries and I am trying to get web_urls using the NYT article search API. But I am seeing that it works for q2 below but not for q1.
q1: Seattle+Jacob Vigdor+the University of Washington
q2: Seattle+Jacob Vigdor+University of Washington
If you paste the url below with your API key in the web browser, you get an empty result.
Search request for q1
api.nytimes.com/svc/search/v2/articlesearch.json?q=Seattle+Jacob%20Vigdor+the%20University%20of%20Washington&begin_date=20170626&api-key=XXXX
Empty results for q1
{"response":{"meta":{"hits":0,"time":27,"offset":0},"docs":[]},"status":"OK","copyright":"Copyright (c) 2013 The New York Times Company. All Rights Reserved."}
Instead if you paste the following in your web browser (without the article 'the' in the query) you get non-empty results
Search request for q2
api.nytimes.com/svc/search/v2/articlesearch.json?q=Seattle+Jacob%20Vigdor+University%20of%20Washington&begin_date=20170626&api-key=XXXX
Non-empty results for q2
{"response":{"meta":{"hits":1,"time":22,"offset":0},"docs":[{"web_url":"https://www.nytimes.com/aponline/2017/06/26/us/ap-us-seattle-minimum-wage.html","snippet":"Seattle's $15-an-hour minimum wage law has cost the city jobs, according to a study released Monday that contradicted another new study published last week....","lead_paragraph":"Seattle's $15-an-hour minimum wage law has cost the city jobs, according to a study released Monday that contradicted another new study published last week.","abstract":null,"print_page":null,"blog":[],"source":"AP","multimedia":[],"headline":{"main":"New Study of Seattle's $15 Minimum Wage Says It Costs Jobs","print_headline":"New Study of Seattle's $15 Minimum Wage Says It Costs Jobs"},"keywords":[],"pub_date":"2017-06-26T15:16:28+0000","document_type":"article","news_desk":"None","section_name":"U.S.","subsection_name":null,"byline":{"person":[],"original":"By THE ASSOCIATED PRESS","organization":"THE ASSOCIATED PRESS"},"type_of_material":"News","_id":"5951255195d0e02550996fb3","word_count":643,"slideshow_credits":null}]},"status":"OK","copyright":"Copyright (c) 2013 The New York Times Company. All Rights Reserved."}
Interestingly, both queries work fine on the api test page
http://developer.nytimes.com/article_search_v2.json#/Console/
Also, if you look at the article below returned by q2, you see that the query term in q1, 'the University of Washington' does occur in it and it should have returned this article.
https://www.nytimes.com//aponline//2017//06//26//us//ap-us-seattle-minimum-wage.html
I am confused about this behaviour of the API. Any ideas what's going on? Am I missing something?
Thank you for all the answers. Below I am pasting the answer I received from NYT developers.
NYT's Article Search API uses Elasticsearch. There are lots of docs online about the query syntax of Elasticsearch (it is based on Lucene).
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax
If you want articles that contain "Seattle", "Jacob Vigdor" and "University of Washington", do
"Seattle" AND "Jacob Vigdor" AND "University of Washington"
or
+"Seattle" +"Jacob Vigdor" +"University of Washington"
I think you need to change encoding of spaces (%20) to + (%2B):
In your example,
q=Seattle+Jacob%20Vigdor+the%20University%20of%20Washington
When I submit from the page on the site, it uses %2B:
q=Seattle%2BJacob+Vigdor%2Bthe+University+of+Washington
How are you URL encoding? One way to fix it would be to replace your spaces with + before URL encoding.
Also, you may need to replace %20 with +. There are various schemes for URL encoding, so the best way would depend on how you are doing it.
I use the following API to get item price for item id=4281, 4.00 TB SATA disk
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package
/200/getItemPrices?objectMask=mask[item,id,
locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={itemPrices:
{item:{id:{operation:*=4281}}}}
It gives two priceIds for the each same location group including invalid priceIds.
itemId=4281, locationGrouID=545, priceId=57241,68071
itemId=4281, locationGrouID=503, priceId=66971, 68063
itemId=4281, locationGrouID=505, priceId=68065, 68605
itemId=4281, locationGrouID=507, priceId=68067, 57009
itemId=4281, locationGrouID=583, priceId=153059,153159
itemId=4281, locationGrouID=509, priceId=68069,57131
itemId=4281, locationGrouID="", priceId=21209,21211
Can somebody please fix this API to make it return only single valid priceId for different locationGrouID ?
Thanks.
There is no issue the prices are different from each other, for example:
priceId=57241,68071
the priceId "57241" is valid for all disk (disk1,disk2,etc) except for the disk0, which means that you cannot use this price for the disk0 of your server. The priceId "68071" is valid only for the disk0.
The same behavior is for all the prices that you listed. In order to know which price is valid for what kind of disk you need to see the categories of the price. Try this request and you will see the categories:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/200/getItemPrices?objectMask=mask[categories,item,id, locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={"itemPrices": {"item":{"id":{"operation":"*=4281"}}}}
Regards
Can BigCommerce change their API response to be more clear when a program tries to post a shipment that already exists?
When posting shipments to BigCommerce, if the shipment already exists, then you receive the following error message.
<?xml version="1.0"?>
<errors>
<error>
<status>400</status>
<message>The field 'quantity' is invalid.</message>
<details>
<invalid_reason>The quantity specified is greater than the quantity of the product that is available to ship.</invalid_reason>
<available_quantity>0</available_quantity>
<order_product_id>628</order_product_id>
</details>
</error>
</errors>
I agree that it is a bad request, but it has nothing to do with the quantity of the item. Can we do something like the following for the message or invalid_reason instead?
The shipment [insert ID here] already exists and cannot be added.
This would make for a much more usable API.
When querying the order products resource there is an available quantity to ship, and as you create a shipment(s) the available quantity is reduced to 0.
Initially a shipment POST is successful as the quantity specified in the payload matches that of the order. If you were to POST a shipment to an order that has already been shipped then the available quantity is actually 0, and when you specify a positive integer for quantity in the payload it is invalid and greater than the available quantity, so the error is accurate.
I am receiving an order from the Shopify web-hook orders/create and
need to store the price and tax applicable for that order. I see some
settings in the Shopify preferences that allow me to set a sales tax
per delivery destination. Also Shopify allows me to optionally charge
taxes for shipping. I see the "taxes_included" property on the order
(which I take to mean that the price listed is either net or gross).
But it doesn't seem to specify if the shipping includes taxes. Is
there a way I can get this information from the API?
Here is the data that I'm passed in the web-hook call. I can do
further API calls to get the information if it is available, but can't
find it all in the documentation.
I have found the countries API, documented here:
http://api.shopify.com/country.html
So I should be able to look up the correct tax percent for the
line_items from the billing address province_code & country_code.
But I can't find anything telling me what tax should or shouldn't be
charged on shipping lines.
It would be more convenient if the tax was actually provided in the
data. It should also be more correct, since there is a chance (however
small) that the tax rates are changed in between me getting the
callback and making further requests for tax info. Is there a way to
get Shopify to provide that information in the web-hook?
Also, I have so far failed to get an data in the tax_lines property in
the data. Is there any hoop I need to jump through to get this?
An example of the data provided in the callback:
{"note":"",
"total_discounts":"0.00",
"cancel_reason":null,
"shipping_lines":
[{"code":"International Shipping",
"price":"25.00",
"source":"shopify",
"title":"International Shipping"}],
"landing_site_ref":null,
"discount_codes":[],
"currency":"CAD",
"buyer_accepts_marketing":true,
"customer":
{"last_order_name":null,
"note":null,
"last_name":"Test",
"state":"disabled",
"updated_at":"2012-11-20T08:05:07-05:00",
"last_order_id":null,
"orders_count":0,
"total_spent":"0.00",
"created_at":"2012-11-05T10:50:23-05:00",
"email":"test#example.com",
"first_name":"Test",
"accepts_marketing":true,
"id":101986160,
"tags":""},
"token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"note_attributes":[],
"gateway":"bogus",
"cancelled_at":null,
"name":"#1025",
"processing_method":"direct",
"updated_at":"2012-11-20T08:05:07-05:00",
"payment_details":
{"avs_result_code":null,
"credit_card_bin":"1",
"cvv_result_code":null,
"credit_card_number":"XXXX-XXXX-XXXX-1",
"credit_card_company":"Bogus"},
"total_price":"44.00",
"shipping_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"line_items":
[{"variant_id":240781369,
"quantity":1,
"name":"product with stock code and shopify stock value",
"properties":[],
"title":"product with stock code and shopify stock value",
"product_id":104741307,
"variant_inventory_management":"shopify",
"fulfillment_service":"manual",
"sku":"some-stock-code",
"variant_title":null,
"requires_shipping":true,
"price":"19.00",
"vendor":"Shopify",
"id":243081982,
"grams":0,
"fulfillment_status":null}],
"closed_at":null,
"billing_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"order_number":1025,
"total_line_items_price":"19.00",
"total_tax":"0.00",
"tax_lines":[],
"created_at":"2012-11-20T08:05:07-05:00",
"landing_site":"\/",
"fulfillments":[],
"total_price_usd":"44.14",
"financial_status":"authorized",
"email":"test#example.com",
"browser_ip":"1.2.3.4",
"total_weight":0,
"referring_site":"",
"client_details":
{"accept_language":"en-US,en;q=0.8",
"browser_ip":"1.2.3.4",
"session_hash":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"user_agent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.1 (KHTML, like Gecko) Chrome\/21.0.1180.89 Safari\/537.1"},
"subtotal_price":"19.00",
"number":25,
"taxes_included":false,
"id":148179898,
"cart_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"fulfillment_status":null}
Assuming tax is charged on an order, all tax will appear in the tax lines array. You might have better luck using a real address in your tests. Try a famous US landmark or something.
If the shop is set up to charge tax on shipping, the amount will be included in the tax lines for the order. You can find out if the shop charges tax on shipping by looking at the Shop object.