Why AlphaVantage doesn't provide recent data [duplicate] - alpha-vantage

I am trying to get the latest Intraday prices from Alpha Vantage API. Currently it is Friday, 9:16PM Eastern European Time. I am trying to get Tesla stock. Markets are still open. However, The API call returns me yesterday's data only. What could be the problem?
ts = TimeSeries(key='API_KEY', output_format='pandas')
data, meta_data = ts.get_intraday(symbol='TSLA',interval='1min', outputsize='full')
print(data.head(5))
print(meta_data)
1. open 2. high 3. low 4. close 5. volume
date
2020-04-16 16:00:00 746.06 746.830 745.530 745.6800 83342.0
2020-04-16 15:59:00 746.57 746.715 745.090 746.1958 53268.0
2020-04-16 15:58:00 746.90 747.465 746.490 746.6250 36746.0
2020-04-16 15:57:00 747.52 747.760 746.827 747.2147 25910.0
2020-04-16 15:56:00 747.95 747.990 746.800 747.2800 33869.0
{'1. Information': 'Intraday (1min) open, high, low, close prices and volume', '2. Symbol': 'TSLA', '3. Last Refreshed': '2020-04-16 16:00:00', '4. Interval': '1min', '5. Output Size': 'Full size', '6. Time Zone': 'US/Eastern'}
1. open 2. high 3. low 4. close 5. volume EMA

I had the same problem and wasn't able to solve it yet. But in my case only some stocks are not up to date. For example 'IBM' is up to date but 'TSLA' and 'AAPL' not. I also have written an email to the technical support 2 days ago. If I ever get a response with the explanation I will write you. I have checked this not only with the python module also with the direct API call.
My code:
https://github.com/SebNik/TradingBot

I also noticed this and contacted Alpha Vantage. I got this response:
Thank you for reaching out! For Nasdaq-listed securities such as MSFT, the data is refreshed daily at 4:30pm ET on our API platform.
So looks like real-time data is not provided for Nasdaq-listed items. This could be the issue here.

Related

FleetApi - How to use legal rest times?

I'd like to know the position in which the driver would need to rest with given waypoints.
I am calling GET https://fleet.ls.hereapi.com/2/calculateroute.json with the following params:
{
mode: "fastest;car;traffic:enabled",
waypoint0: "19.286769, -99.652773",
waypoint1: "19.419185, -99.17755430000001",
waypoint2: "19.41530,-99.17844",
waypoint3: "31.29778, -110.93690",
restTimes: "MEX",
maxSpeed: 110,
departure: "2021-07-20T15:00:00.000Z"
}
This returns warnings with the info of rest times like this:
{
"message": "Taking the short driver rest time after 18036 sec for 1800 sec at routeLinkSeqNum 1485",
"code": 14,
"routeLinkSeqNum": 1485
}
I would like to know how to use/read this info. I don't know what routeLinkSeqNum is and how to utilize it.
Governments impose rules on how long a truck driver can drive before he needs to rest. Routing can consider these regulations w.r.t. short rests during a day and long (overnight) rests.
For example, in EU countries drivers have to rest after 4.5 hours of driving for at least 45 minutes, and must not exceed a total of 9 working hours per day before they have to rest for 11 hours.
Activate this feature in the router using the "&restTimes=local", in this case, it is the "MEX" in the request parameter. Routing will then consider each country's local regulations.
In the same parameter, you can specify whether the driver starts the route freshly or how long he is already driving / on duty since his last short or long rest period
routeLinkSeqNum is an index of the link array within a Leg. If you check the response, there will be response>route>[0]>leg[0]>[2]>link[1485].
So one route can have n-legs, 1 leg can have m-links
This will help you to plot the rest times.
Here is an example shown in the tool:
https://tcs.ext.here.com/examples/v3/fleet_telematics_api

extract Date and Time from two 16-bit modbus registers

I'm using an ElNet energy&power meter that communicates with my processor via Modbus RTU protocol.
There are two 16-bit ElNet registers that contain information about the Date and Time (separately) in a Win Format (registers 85-86, page 6 of this document). I'm able to read these two registers. However, I'm unable to extract information about the Date and Time.
For example, Date register contains decimal value of 17841 for today's date (31/07/2015). Is there any person willing to explain me how to convert 17841 into 31/07/2015?
I have the same problem with the time. My time register contains a decimal value of 55296. Can you help me extract the time from this number?
This thread addresses the same problem:
HEX/Decimal to date and time from modbus
However, I'm not sure I understand the extraction algorithm applied there. My point of operation is processor with the code written in C or C++.
Thank you very much for your time and effort to help me.
Sincerely,
Bojan.
The MS-DOS date/time format is described here: https://archive.is/2bVlz (was http://proger.i-forge.net/MS-DOS_date_and_time_format/OFz but is gone)
It makes sense for the 17256 value mentioned in the other question, as it translates to 2013-11-08. See here how to do it:
Register bit description: 0bYYYYYYYMMMMDDDDD
Registervalue: 17256 0b0100001101101000
Yearmask: 0b1111111000000000
Yearpart: 0b0100001000000000
Yearpart rightshifted 9 steps: 0b0000000000100001 = 33 years after 1980
Monthmask: 0b0000000111100000
Monthpart: 0b0000000101100000
Monthpart rightshifted 5 steps: 0b0000000000001011 = 11
Daymask: 0b0000000000011111
Daypart: 0b0000000000001000 = 8
Unfortunately your register value 17841 does not make sense, as it translates to 2014-13-17 (That is month 13).
Are you sure that:
you read the correct register? (change the time setting in the instrument, and see what happens to the register value)
you do not mix up the two bytes in the register?
the time setting is correct?

Is it possible to set up a clock trigger in Google Apps to send spreadsheet hourly?

I have a spreadsheet that logs incoming answered and missed calls in Google Drive.
It is currently set to send an email every hour between 10am and 7pm.
Ideally I would like it to not send the email during the weekend.
Setting up each hour Monday to Friday uses too many triggers.
Is there a way to construct a trigger that will send an email every hour (10am to 7pm) only Monday to Friday?
I've read the documentation at Google and a few (unrelated as it turns out) examples on here and I am stumped!
I tried putting a load of trigger conditions together:
function autoSendHourly() {
ScriptApp.newTrigger("hourlyUpdate()")
.timeBased()
.onWeekDay(ScriptApp.WeekDay.MONDAY)
.onWeekDay(ScriptApp.WeekDay.TUESDAY)
.onWeekDay(ScriptApp.WeekDay.WEDNESDAY)
.onWeekDay(ScriptApp.WeekDay.THURSDAY)
.onWeekDay(ScriptApp.WeekDay.FRIDAY)
.atHour(10)
.atHour(11)
.atHour(12)
.atHour(13)
.atHour(14)
.atHour(15)
.atHour(16)
.atHour(17)
.atHour(18)
.atHour(19)
.create();
}
I wasn't entirely surprised that it didn't work, but I was mildly surprised that it threw up no errors.
Any help (including "you're mad it can't be done") would be greatly appreciated.
The simplest thing to do is use the create trigger like you did but for every hour every day and then in you handler function add a small piece of code that will return if day and time don't meet specific conditions like explained in this (old) post.
the code may look like something like this :
function officeHours(){
var nowH=new Date().getHours();
var nowD=new Date().getDay();
Logger.log('day : '+nowD+' Hours : '+nowH)
if(nowH>17||nowH<8||nowD==6||nowD==0){return}
Browser.msgBox('time to work !');//normally your real function should begin here...
}
I haven't messed around with java in awhile but this article might help.
Android: how to get the current day of the week (Monday, etc...) in the user's language?
If it was me, I would get the day of the week and check it in a switch. Then if it matches a week day call a function to check the time between 10am and 7pm.
Best of luck.

Icalendar dates problem - my date is out by 2 days

I have a calendar file which I will post below. The problem is that when I load this into outlook the date says the 24/02/2011. The date in the file as shown below is the 22/02/2011
(START:201102*22*T100000).
I am in Sydney/Australia if that makes any difference.
Can anyone try adding this to their outlook calendars and see if the date is wrong?
Here is a link to the file: http://www.onlinerego.com/small_business_summit2011/assets/template/ics/sydney.ics
Thanks so much.
BEGIN:VCALENDAR
PRODID:-//http://testing.cdw/thegoldbook///NONSGML kigkonsult.se iCalcreator 2.8//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:20110208T111839EST-4800GDFvWN#http://testing.cdw/thegoldbook/
DTSTAMP:20110208T000239Z
DESCRIPTION;LANGUAGE=en:Thank you for registering to attend the 'Trend Micr
o Affinity Partner Small Business Summit 2011'.\n\nWe look forward to seei
ng you at the event!\n\nDate: 22 February\nVenue: Novotel Darling Harbour\
, Terrace Room\nAddress: 100 Murray St\, Darling Harbour\nArrival time: 10
:00am\n\nAgenda\n10.00am - Pre registration & Networking\n10.30am - Exploi
ting Small Business Trends to increase your profits\, By Toby Lee\, Global
Vice President\, Volume Business Unit\, Trend Micro\n11.00am - Product Ro
admap for Small Business\, By Richard Ku\, Global Vice President\, Small B
usiness Product Management\, Trend Micro\n11.15am - Break\n11.45am - Affin
ity Program and Channel Engagement Update\, By Malcolm Pooley\, ANZ Small
Business Channel Sales Manager\n12.00pm - Q&A Panel\n12.15pm - Close\n\nUR
L - http://www.onlinerego.com/small_business_summit2011/thankyou.php?city=
Sydney
DTSTART:20110222T100000
DTEND:20110222T121500
LOCATION;LANGUAGE=en:Novotel Darling Harbour\, Terrace Room\, 100 Murray St
\, Darling Harbour
SUMMARY;LANGUAGE=en:Trend Micro Affinity Partner Small Business Summit 2011
URL:http://www.onlinerego.com/small_business_summit2011/thankyou.php?city=S
ydney
END:VEVENT
END:VCALENDAR
I'm also in Aus.
Loading into my google (sydney time) gives Tue, 22 February, 21:00 – 23:15 - so wrong times but right date. Google may assume it is UTC time and are we currently +11, that may explain it's time. No idea what outlook is doing.
windows calendar has 22 feb and 10 am
my own app also gives 22 Feb and 10 am
The way dates are specified and whether you have a timezone or not makes a difference.
The file does not have a timezone spec and the dates are specified in "local" format - ie: should translate to 10 am in whatever timezone you load it into ... dangerous as if it were a conference call meeting across timezones for eg, it should have a timezone associated with it.
Either in the DTSTART
DTSTART;TZID=America/New_York:20101031T190000
or using the X-WR-TIMEZONE custom field
X-WR-TIMEZONE:America/New_York
Sorry no idea what outlook is doing though (I do not use it).

iPhone Date Picker rolls over to 2010 on December 27th?

So I implemented a UIDatepicker in one of my applications for scheduling and autodialing teleconferences... everything is pretty much ready to go except, while testing I noticed that when the date rolls over from December 26th to December 27th, the year changes to 2010.
I even rolled it forward to 2011... and it changes when December 25th changes to the 26th.... but wait... in 2012, it correctly rolls over on December 31 - January 1... and then its back to 29th-30th in 2013. Is there some kind of astronomical phenomenon I am not aware of going on or does Apple run on some crazy Heechee calendar I don't know of? The calendar app works correctly...
The most likely explanation is I am missing something so obvious that I will slap myself when I realize it. But hey, I haven't slept in... wow I don't remember if its been two days or three. Take pity and help me out here.
UPDATE: So maybe it wasn't something simple. Still looking for an answer here! Am I really the only person who has experienced this?? I'll bet when the end of December rolls around, more people will hit the same roadblock.
UPDATE2: Anyone? Still looking, still not finding...
UPDATE3: Still haven't found a solution. Come on! This is an interesting puzzle!
UPDATE4: Still no answer found. I have submitted the app and it is now in the appstore. Would still like to see this problem solved so I can update the app.
There may be this problem, that when you are on the last week of the month and the week has fewer than 7 days left in current month, then perhaps the API treated the week as the first week of the next month. Since december of 2012 has already 7 days in its last week there is no problem in that month.
I was getting the same problem here, and I solved it.
- (int) currentWeekOfMonth
{
return CFCalendarGetOrdinalityOfUnit (
CFCalendarCopyCurrent(),
kCFCalendarUnitWeek,
kCFCalendarUnitMonth,
[self absoluteTime]);
}
my requirement is to show week number and for this i calculate the week number of first week of month and the add this to the total number of week in month.
int currentWeekNumberInYear = [_calendarInfo currentWeekOfYear];
int currentWeekNumberInMonth = [_calendarInfo currentWeekOfMonth];
currentWeekNumberInYear = currentWeekNumberInYear-currentWeekNumberInMonth +1;
currentWeekNumberInYear = currentWeekNumberInYear<0 ? (NSInteger)[_calendarInfo weeksInMonth] ==5 ?49:48 : currentWeekNumberInYear;
I hope it will be useful to you.
Turns out its the Date format string used to set up the NSDateFormatter that was causing this for me.
"yyyy" corresponds to the 4-digit year, while YYYY corresponds to the year starting from the Sunday of the 1st week of year. Why anyone would want this is anyone's guess, and it would really help if Apple provided a link to their list of format specifiers, but there you go.
Just make sure your format string has the year component in lowercase and it should be sorted.
This post on TUAW describes a similar problem in PhotoBooth on Mac OS X:
http://www.tuaw.com/2009/12/29/beware-photo-booth-time-stamps-its-a-bug-not-a-feature/
One commenter agrees with vikas that it's an end-of-week issue.