title: A loop runs once every 10 mins in forever loop Python
body: <p>I have a forever loop that rebalance my portfolio. I call an exchange API which basically does not cost anything as long as I stay within their rate limit (1-2 call per sec), so I loop them forever with minimal sleep time (10 sec).</p>
  <p>Then I want to add an API call from Coinmarketcap as a small loop that run once every 10 mins. This is done to avoid their 'free' API limit (333 call/day, and I use 2 calls per loop).</p>
  <p>so My forever loop is simply:</p>
  <pre><code>while True:
      try:
         countCMC = 0
  
         for loop
            
            if countCMC == 0 or countCMC % 60 == 0:
               get Coinmarketcap api......
            
            countCMC = countCMC + 1
  
            run bunches of rebalance algo......
            time.sleep(10)
      except:
         ....
  </code></pre>
  <p>I want to call Coinmarketcap and parse their data to variables, and then use them in my rebalance algo. May be a small loop inside &quot;try&quot; with sleep time?</p>
  <p><strong>Update:</strong> I have tried to add count and then use modulo, so it runs at the beginning and every 60x10 = 600 sec thereafter. Wonder if there is a better way?</p>