How can I get MarketCapRank from CoinGecko's API - coinbase-api

I can use this:
https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true&include_market_cap=true
to get:
{"bitcoin":{"usd":47498,"usd_market_cap":902977262894.0303,"usd_24h_change":1.1530010412374174}}
Which includes the total market cap of the given coin but I'm wanting to get it's rank, as in BTC should give '1', ETH would give '2', ADA '7' etc.
Basically all the data I'm after is available through the "markets" API but I can't workout how the get a "market block" for a specific coin.
An example of the URL to deliver the top 4 coins by market cap is:
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=4
Can anyone tell me how to get that data for a specific coin?

I believe you are looking for this:
https://api.coingecko.com/api/v3/coins/bitcoin
Search in the result for: "market_cap_rank":

Related

Bittrex api market change calculation

Does anyone know how Bittrex calculates the market change (shown in the image) and which values i can use to replicate it
Using the "Last Price" from https://api.bittrex.com/api/v1.1/public/getmarketsummary?market=btc-fsn gives me a different value
It looks that "PrevDay" field in API response reflects the price exactly 24 hours ago. Same for some other exchanges and data providers.
Actually % change on website should be based on same, but this may depend on how often data is refreshed in browser.
This percentage sign shows how much % market has been chnaged in last 24 hours
Like prev btc price=8000 and new btc price =8500
so market change 8500-8000=(500/8000)*100=6.25%

Drupal commerce multicurrency

So I'm trying to change to currency on my local drupal site (with room module) from USD to INR. The unit price gets converted just fine but when is comes to the order total, it's just wrong. For instance:
I booked a single room that costs 1000 INR
I booked a double room that costs 1200 INR
But when it comes to the order total, it sums up to be something like 141200 INR instead of 2200 INR. I can't seem to solve this.
You have provided no information about how you are handling your converting but the problem is pretty clear.
You are converting the price twice, thats the issue. Somehow in the current situation the system thinks the 2200 total price is in USD, and calculates it to IND.

Watson conversation: Detecting entities within a sentence having some intent for untrained cases

Im looking to train my bot to basically extract the weight from a type of sentence and tag the intent as "#enterBMI".
I have also created an entity "#weight". I will show below in images what i have trained the bot with -
The problem i am facing is that weight is detected only for exactly the same weights that i have given training for. So 100 kg will be detected and 101 kg/100 kgs will not be detected.
Just use #sys-number entity instead of a dedicated #weight

Ride Sharing App - finding surrounding origins and destinations

I looked at several other SO questions that seem somewhat related, but not quite what i need (or i'm just not smart enough to connect the dots).
Working on an app for a client. Their database holds the origin and destination of people that are traveling, limited (i believe) to just places in US and Canada, and a date when the trip will take place. The records are updated regularly. Call these "trips."
Users come to the site, and enter an origin and destination city, and a radius for each, indicating how far away from their desired origin/destination cities they are willing to travel in order to make their trip.
The job of the app is to find any/all trips that are already in the database, that are closest to the origin and destination that the user needs to travel.
My original thought was to find all origin cities in the database that are within the radius of the user's desired origin, then use that recordset to search the destination cities in the database for any/all cities within the radius of the user's desired destination.
I also need a decent (preferably free... low budget project here) API that can help look up the city geographic location and perform the actual radius calculation... I think.
Is what I'm looking to do even close to the best options? It looks like the hardest part will be finding all the existing cities in the database that are within the radius of the user's desired cities - which is a bit of a twist on a more simple query of just "find all cities in the radius of X city".
So, this is KINDA like an Uber situation, except the Uber driver is deciding what the trip parameters are, and the user just needs to know which Uber drivers are going from/to the places nearest those of the user (on the specified date, to boot).
Right now, users are just looking things up at a state level - BC to NY, and reading down rows of data looking at rides to find the ones that seem closest to what they need.
Thanks in advance, for any clever insights you smart folks might have!
Declare #DriverLat float = 41.744068
Declare #DriverLng float = -71.315024
Declare #Within int = 20
Select *
From (
Select Distinct
A.ZipCode
,A.CityName
,A.StateCode
,Miles = [dbo].[udf-Geo-Calc-Miles] (#DriverLat,#DriverLng,A.Lat,A.Lng)
From [dbo].[ZipCodes] A
Where CityType = 'D'
and ZipType = 'S'
) A
Where Miles <= #Within
Order By Miles
Returns
The UDF
CREATE Function [dbo].[udf-geo-Calc-Miles] (#Lat1 float,#Lng1 float,#Lat2 Float,#Lng2 float)
Returns Float as
Begin
Declare #Miles Float = (Sin(Radians(#Lat1)) * Sin(Radians(#Lat2))) + (Cos(Radians(#Lat1)) * Cos(Radians(#Lat2)) * Cos(Radians(#Lng2) - Radians(#Lng1)))
Return Case When #Miles is null then 0 else abs((3958.75 * Atan(Sqrt(1 - power(#Miles, 2)) / #Miles))) end
End

User search pricing calculation

I'm building a search engine which provide me a list of cap drivers. We have some requirements:
User is searching cheapest cap driver to bring him from place a to place b. He can go from any place to any place.
Default formula would be distance * price per mile
But there are also special prices like AMSTERDAM to THE HAGUE would be always 100 EUR
The price for each mile is season based winter/summers have different prices.
Faceting search based on attributes. Like is there Champagne/Luxory/Male/Female driver/Etc etc.
User want's to sort on cheapest ride/but also distance.
What would be the best approach to fit all there requirements? I've tried Solr but have not found a good solution for putting the price modal in there. Any ideas?

Resources