-1

I'm looking for a way to make an automatic API call request every hour, do you know if it is possible?

For example, I would like to make call for this API: https://api.binance.com/api/v3/ticker/24hr every hours but there is an automatic way to do this?

Thx a lot to everyone!

Kevin Meyer
  • 2,816
  • 4
  • 21
  • 33
vero
  • 1
  • When you say "every hours", do you mean "every hour" or do you mean "Every N hours" as in "I would like to call binance every 3 hours?" Please edit your post to reflect which of these alternatives is the case. – Kevin Meyer Feb 24 '21 at 04:27
  • Thx to everyone, and I m sorry, my english it is not so good. I mean every hour, every 1 hour. I resolve anyway, thx for help!! – vero Mar 06 '21 at 20:03
  • And re-edited accordingly. If my answer below helped, could you upvote and/or accept the answer? – Kevin Meyer Mar 07 '21 at 01:53

1 Answers1

0

So the answer to this is going to depend on exactly how you're making the request and how you're processing the data as follow-up, but Cron is going to be the default place to start.

So if you have binance_reader.py

  1. sudo apt-get install cron on Ubuntu, adjust for your local package manager elsewhere
  2. crontab -e
  3. To run this every hour, insert 0 * * * * absolute_path_to_my_binary/binance_reader.py

Most cloud implementations will let you do something like this as well without needing a machine running 24/7/365. For example, AWS Lambda lets you use both cron syntax in the lambda as well as Cloudwatch triggers on a timer.

Kevin Meyer
  • 2,816
  • 4
  • 21
  • 33