Binance API list all symbols with their names from a public endpoint - binance

I've integrated the Binance API in my project to show a list of all supported symbols and their corresponding icon. However, I'm unable to fetch the symbols name/description.
For instance, I can fetch BTC-EUR, but I can't fetch 'Bitcoin' or similar through a public endpoint. At least, I haven't found the endpoint so far.
For now, I'm using a private endpoint (which is behind authentication) at /sapi/v1/margin/allAssets. This returns me the name/description for each symbol, but as you can imagine I want to prevent usage of private API tokens on fetching public information
{
"assetFullName": "Bitcoin", <----- This is what I'm looking on a public endpoint
"assetName": "BTC",
"isBorrowable": true,
"isMortgageable": true,
"userMinBorrow": "0.00000000",
"userMinRepay": "0.00000000"
}
So, my question is whether there is a public endpoint available to fetch the same information? Right now, I'm using the endpoint /api/v3/exchangeInfo to retrieve the available symbols on the exchange, but this response hasn't got the name/description of the symbol in it...
"symbols": [
{
"symbol": "ETHBTC",
"status": "TRADING",
"baseAsset": "ETH",
"baseAssetPrecision": 8,
"quoteAsset": "BTC",
"quotePrecision": 8,
"quoteAssetPrecision": 8,
"orderTypes": [
"LIMIT",
"LIMIT_MAKER",
"MARKET",
"STOP_LOSS",
"STOP_LOSS_LIMIT",
"TAKE_PROFIT",
"TAKE_PROFIT_LIMIT"
],
"icebergAllowed": true,
"ocoAllowed": true,
"isSpotTradingAllowed": true,
"isMarginTradingAllowed": true,
"filters": [
//These are defined in the Filters section.
//All filters are optional
],
"permissions": [
"SPOT",
"MARGIN"
]
}
]
I've already looked for public endpoints about listing assets, as that's usually the namespace other exchanges return this information for, but I can't find such an endpoint in the documentation of the Binance API

I ran into this same frustrating mess. Binance US doesn't allow the /sapi/v1/margin/allAssets because MARGIN permissions aren't granted for US users (returns an 'Invalid Api-Key ID').
There is nothing else available in their SPOT accounts that gives this data.
What I ended up doing was pulling the data from CoinMarketCap via
https://pro-api.coinmarketcap.com/v1/cryptocurrency/map?CMC_PRO_API_KEY=<your-API-key>
Check their API authentication documentation.
PROS:
It's free w/ the Basic account (you will need an account and an active API key - 5 minutes, tops)
CONS:
It's NOT a standard (there isn't one, that I can tell). It will work fine for BTC, but take a look at the symbol HOT -- there's a few of them. You will have to manually curate those to match Binance (I persisted the CMC Unique ID in addition to the symbol & name). It sucks, but Binance doesn't give basic data like the name of the currency, which is absurd.

You can
Proxy the private enpoint through your app, so that your API key stays hidden from your users
Use another data source such as Coinmarketcap as already mentioned in another answer
Query undocumented public endpoints (list with just name per each symbol, detail with name and description) that they use on the web app and are likely to change
However there is currently no direct way to get a currency name and symbol through an officially documented public Binance API endpoint without authorization.

Related

Azure search for user, groups, or service principle by name or email address via Rest API or python module (MS Graph)?

In azure when adding a user, group, or service principle to a role you can search by name and email address in the same search (screenshot below). When I look at the MS Graph APIs there are separate APIs for users, groups, and service principles (MS Graph API documentation links below). And it looks like the search options cannot be mixed (just display name or just email).
Does anyone know how to achieve a search like this using an Azure REST API. I'm curious if anyone knows what calls Azure is actually doing and if they are part of the published rest API? Or if one search is combining like multiple API calls which would be confusing since are paginated that would be hard to figure out what to display from which....
I'm building an app to add permissions and I'm trying to recreate a feature like this search.
Only way I can think of to achieve this now would be to select an option to search for either 'groups', 'users', or 'service principles'. Then another options to select search by 'email' or search by 'displayName' (but not both as the same search). This seems more clunky but technically ok.... but I'd rather do it like the azure screenshot below.
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/api/serviceprincipal-list?view=graph-rest-1.0&tabs=http
Microsoft Graph API provides batching functionality where you can batch multiple requests together and send them as a single request for processing. In your case, on the server-side (Graph API side) three requests will be processed but from your application you will be sending a single request and get a single response.
Your request would be something like:
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/users?$filter=<your-filter-criteria>"
},
{
"id": "2",
"method": "GET",
"url": "/groups?$filter=<your-filter-criteria>"
},
{
"id": "3",
"method": "GET",
"url": "/servicePrincipals?$filter=<your-filter-criteria>"
}
]
}
You can learn more about the batching capability in Microsoft Graph API here: https://learn.microsoft.com/en-us/graph/json-batching.
So the batching answer was not exactly what I wanted but something really cool that I'll likely end up using in the future!
Since batching could get ugly with the paging results since say I want 30 total results (so i set paging to 10,10,10) then if one gives 10 and has nextlink and the next gives 0 and the last give 5. I now have 15 results to display but paging with the other and the sorting of results after the next could throw results earlier. It might just be weird and I don't have time to think it through.
I just ended up doing a drop down for users, groups, and service principals. And you have to search separate. Not as cool as how MS does it internally but its consistent, predictable, and works.

Listing purchases made from a Chrome extension

I have a chrome extension where the user can make purchases using Chrome webstore.
Numerous Google pages refer to https://developer.chrome.com/webstore/check_for_payment.html . Which is dead and nowhere to be found. Great!
I am trying to find out how to get a list of all purchases of all users from the webstore, preferably using PHP or even by pure REST by using Postman or similar?
Any help appreciated!!
Here is the link learn more about the Payments:List
Lists the in-app products that the user has purchased.
If successful, the structure of the response body will be:
[
{
"kind": "chromewebstore#payment",
"itemId": string,
"sku": string,
"createdTime": long,
"state": string
}
]
Parameters are also supplied in the documentation.
The state will identify if the payment is ACTIVE, PAYMENT_DECLINED, EXPIRED, CANCELLED, REJECTED, PENDING, CANCELLED_BY_DEVELOPER, DISABLED.
From there, you will now be able to filter out what data you needed.
Hope this helps.

Using customer object information in private app

I'm currently trying to build a private app which will allow me to create a form which customers can use to update info like name, email address, etc.
I know that I can access this information in my template through the customer object:
https://help.shopify.com/themes/liquid/objects/customer
I also believe that I can send http requests through the admin api which would allow me to update a given customer object:
https://help.shopify.com/api/reference/customer#update
This is an example PUT request from that page
PUT /admin/customers/#{id}.json
{
"customer": {
"id": 207119551,
"email": "changed#email.address.com",
"note": "Customer is a great guy"
}
}
I think that in order to use this api (or at least use it securely) I need to use a private app. I found the following npm package which I would use to create the private app:
https://www.npmjs.com/package/shopify-node-api
This is an example of a PUT request from that page (I think this can be modified for customers):
var put_data = {
"product": {
"body_html": "<strong>Updated!</strong>"
}
}
Shopify.put('/admin/products/1234567.json', put_data, function(err, data, headers){
console.log(data);
});
Does anyone have any experience doing this as I'm unsure about a few things.
Will this PUT request be called when the url is loaded? So if I have an
<a> tag with href="/admin/products/1234567.json the request would load?
If so, this seems quite useless with the customer ID hardcoded in. Can I pass in the customer ID of whoever is logged in and clicking the link and use that as the last part of the request url somehow? In addition to this would it be possible to grab the form data that the user enters to use as the value for "email" or "note?
You should check out this answer shopify app proxy: send customer data or only customer ID for some pointers, discussion and links.
tl/dr; Don't rely on only the logged in customer id or you'll be opening yourself up to easy hackery.
So bascially you update the customer with the PUT you outlined in your question.
To get the id securely you:
Create a form with the customer id and make sure you have a server generated hash of that customer id to thwart bots (that's the reference post)
You post the customer data to a an app via a proxy url
You update the customer via a PUT to a constructed url.

How to filter SmartCollections via Shopify API?

I need to get only those SmartCollections that are imitating some kind of category of products e.g. Pants, Shirts, Shoes. But there is also collections like "All Products" or "Available on local store". What I need to get via API are only those spesific categories and nothing else.
So is there any way to set some kind of metafield or alternative to SmartCollections so I could filter via API only collections I need?
Of course one(and really bad) way to do this is to hard code list of not wanted collections, but this solution isn't very dynamic :/
I am using this package froatsnook:shopify from atmospherejs.com.
Here is Shopify's API documentation about SmartCollections: SmartCollection
Okay, I managed to do this eventhough API disagrees with me. With this Chrome extension you can use metafields also with SmartCollections: http://shopifyfd.com/
And then you just have to create new function for this new endpoint via build in functionality provided by froatsnook:shopify like this:
Shopify.API.define({
"name": "getSmartCollectionMetafieldsById",
"method": "GET",
"path": "/admin/smart_collections/#{collection_id}/metafields.json",
"returns": "metafields",
"description": "Get a single smart_collection metafields by its ID"
});
And voilá! Now you can include/exclude SmartCollections via API by using metafields!

Youtube API v3, topicId recovery

Youtube API v3 enables developers to retrieve specific information regarding a particular video, among the returned data a part called topicDetails can be requested as per the following example:
Request:
https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&part=snippet,topicDetails
Response:
{
"kind": "youtube#videoListResponse",
"etag": "\"r3ahjFekUqNiL0By9B5wQ2uTZHM/i4Bt9XfY8YZ1ctSlg8BWcLD8HFQ\"",
"items": [
{
"id": "7lCDEYXw3mM",
"kind": "youtube#video",
"etag": "\"r3ahjFekUqNiL0By9B5wQ2uTZHM/hYUGsnkhqATV4OXNG43HIObqlyw\"",
"snippet": {
"title": "Google I/O 101: Q&A On Using Google APIs",
[ some properties have been omitted here ],
"categoryId": "28"
},
"topicDetails": {
"topicIds": [
"/m/045c7b",
"/m/0z5n",
"/m/04136kj"
]
}
}
]
}
The topicIds field comes machine encoded and topic information can be retrieved through the Freebase API (using this identifiers) which is being deprecated. I was unable to locate any update on YouTube documentation regarding the impact of freebase API deprecation and as I manage a large node.js code base that relies heavily on YouTube topicDetails I would like to ask if there is any known programatic alternative to recover topic information from stable sources other than Freebase?
As part of the Freebase retirement announcement, Google said that they would be offering a couple of new Knowledge Graph APIs and that there would be a 3 month overlap between the availability of these new services and the shutdown of Freebase.
Presumably Google services like YouTube which depend on Freebase MIDs will transition to these new services will transition to the new API (perhaps with unchanged identifiers), but not much is known concretely because a) Google is overdue with the new APIs and b) they haven't said anything else about the transition process.
UPDATE: The Google Knowledge Graph Search API became available in December 2015 and provides support for looking things up by KG ID (which is the same as the old Freebase ID used by YouTube).

Resources