Skip to content

SteveAmor/BondChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UK Premium Bond Checker

Introduction

NS&I update their online prize checker the day after the first working day of each month - although, it's not clear by exactly what time of day (but it is early in the morning).

NS&I send out an email if you have won a few days afterwards (4th day after the first working day?) but they don't tell you how much you have won. You don't get an email if you have not won anything.

The API is not published but is pretty simple and appears established.

Program strategy

We only want to notify a monthly win once. The current months JSON is saved when you are notified of a win that month.

We want to check and notify as quickly as possible (i.e. in the early hours after the first working day). This is managed by cron.

We don't want to have to work out what the day after the first working day of each month is. Or query an API to find out. Or have a list. Again, managed by cron.

No wins are a problem as the JSON doesn't contain the month of the no win so we don't send no win emails. You could send a no win email if you had a win the previous month (as last month's win would be saved in the JSON file)

Saving the JSON saves future calls to the website if you have won this month and therefore stops another notification being sent.

We also save the JSON for debug purposes if the API changes.

crontab for checking bonds

10 2-7 2-6 * * python3 /home/pi/checkbonds.py >/dev/null 2>&1

Every hour at 10 minutes past 2am to 7am on the 2nd to 6th day of the month. This checks in the early hours of the morning and checks for 5 days after the 1st of the month to ensure it checks the day after the first working day of the month.

About

UK Premium Bond Checker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages