Is it possible to get the price of bitcoin in USD from the coinbase API for a specific time in the past? - coinbase-api

GET https://api.coinbase.com/v2/prices/:currency_pair/spot
This price seems to be the current price

This question already has answers. Copy and pasted from here: Coinbase API v2 Getting Historic Price for Multiple Days
Any reason you aren't using coinbase pro?
The new api is very easy to use. Simply add the get command you want followed by the parameters separated with a question mark. Here is the new historic rates api documentation: https://docs.pro.coinbase.com/#get-historic-rates
The get command with the new api most similar to prices is "candles". It requires three parameters to be identified, start and stop time in iso format and granularity which is in seconds. Here is an example:
https://api.pro.coinbase.com/products/BTC-USD/candles?start=2018-07-10T12:00:00&stop=2018-07-15T12:00:00&granularity=900
EDIT: also, note the time zone is not for your time zone, I believe its GMT.

Related

How to specify time in Azure AD Sign In REST API request

I need to retrieve the data after a specific period of time in order to avoid duplication. I can filter out based on the date. On filtering based on today's date, there is repetition in signIn data for the date for consequent requests
I have tried the filtering criteria for the following API
Ref link: https://learn.microsoft.com/en-us/graph/api/signin-list?view=graph-rest-1.0&tabs=http
Sample Request I have tried : https://graph.microsoft.com/beta/auditLogs/signIns?&$filter=createdDateTime gt 2020-09-29
I need to specify the time in this request...Any ideas ..?
Thanks in Advance
You're on the right track! The filter you're using also accepts a time.
If you check the List sign-in response you'll see the format Microsoft uses to specify the date and the time in out field.
Try this URI (for all items after 2020-09-29 19:00:00 (UTC as noted by the z at the end)):
https://graph.microsoft.com/beta/auditLogs/signIns?&$filter=createdDateTime gt 2020-09-29T19:00:00z

coinbase pro api - historic prices - invalid interval

I am trying to make an API call to retrieve historic BTC-USD prices with the coinbase pro API.
I am defining the specified parameters available:
start(Start time in ISO 8601), end(End time in ISO 8601) and granularity(Desired timeslice in seconds).
I get however the message: "Invalid interval" for the below request:
https://api.pro.coinbase.com/products/BTC-USD/candles?start=2016-01-30T19:06:05+00:00&end=2016-02-06T19:06:05+00:00&granularity=86400
The dates are in ISO 8601 and I can not figure out why coinbase would not accept this interval.
Does anybody know why this is not accepted as a valid interval?
Thanks
Thank you JJJ for the link.
I forgot to url encode the dates for the REST Api request.
Encoded, this works now:
https://api.pro.coinbase.com/products/BTC-USD/candles?start=2016-01-30T19%3A06%3A05%2B00%3A00&end=2016-02-06T19%3A06%3A05%2B00%3A00&granularity=86400

pyvmomi perfManager - Get all stats

While a am a noob in python and pyvmomi, thru the help of stackoverflow and the pyvmomi sample I have been able to get most of the information I need from ESXi servers. I want to get all the stats at the lowest level they are keeped from perfManager. All the examples I seen deal with aggregating them over a time frame.
What I think I want to do is call query = vim.PerformanceManager.QuerySpec(maxSample=1,entity=host,metricId=[metricId],startTime=startTime,endTime=endTime)
with startTime and endTime as NULL or is python None?
and then iterate thru what comes back
I want to save the vm, datetime of the stat, the metricId and the value.
Also is there a wild card for metricId that would give me all the meticId's or do I need to call once for each metric?
I also beleve if I was to call it again later with the last datetime as the startTime and endTime as null I should get all the new stats since the last set I save? Is this correct?
After much much searching I found this which had the few missing details.
https://github.com/dograga/ESXPerfData/blob/master/vmperfcollection_threaded.py

Correct Way to Pass Dates from Angular to Web API 2

I have an Angular application that takes dates (date only not time) and posts them to a Web API 2 REST service. We are running into an issue when someone from India uses the application due to timezone issues.
Currently the Angular app is converting the date into ISO8601 format in UTC timezone and sending them to Web API. When the data is received on the Web API side, the date ends up being incorrect. If 6/21/2016 was put into the form, the date ends up coming over as 6/20/2016. The desired solution is to have the actual date value entered in the form be the date value received by the API.
One proposed solution is to treat the dates as strings instead of Dates and then just pass the date portion. This just seems like a hack to me and doesn't seem like the "correct" way of doing it.
What is the correct way of handling this situation?
Given the fact that the application has a lot of date field inputs is there an easy way to implement the solution across all Date input values?
The date format yyyy-MM-dd will be accepted in US / India so you can pass it so to your WebAPI. In JavaScript before posting you can alter the date like this.
$scope.MyDate = $filter('date')($scope.MyDate, 'yyyy-MM-dd', timezone);
If you want time too, the format will be yyyy-MM-ddTHH:mmZ

Piwik: Get graph of unique visitors in custom date range using ImageGraph API

I only just started using piwik but am already stuck.
I want to get a graph showing the unique visitors of a custom date range (from February to April), so a count for each day. Just as it's displayed in Piwik under "Visitors => Overview". But somehow that doesn't seem possible with the ImageGraph API.
What I'm trying to do (using the ImageGraph API):
I want to display a graph showing the number of unique visitors per day in a certain date range.
Below I want to display a graph showing all goal conversions per day for the same date range.
It's supposed to show the relation between the two values since it's highly relevant if an increase in conversion is accompanied by an increase in unique visitors.
It would be great if both sparklines were in the same graph but I don't think that's possible.
Does anyone have an idea of how to achieve this? Any help would be appreciated.
Thomas
For daily visits you can generate the graphic by calling the next URL :
$this->baseSite.
'index.php?module=API&graphType=evolution&width=800&height=200&method=ImageGraph.get&idSite=' .
$this->siteId . '**&period=day**'. **'&date=' .
$this->startDate->format('Y-m-d') . ',' .
$this->endDate->format('Y-m-d')** .
'&apiModule=VisitsSummary&apiAction=get&token_auth='.
$this->apiKey

Resources