-2

I have recently started out on python and learnt all the basic courses. I don't know how I would download and save price/volume information every 5 minutes during the trading day using python/excel.

I have developed a connection from my excel spreadsheet to the exchange which shows me live price/volumes for the product.

Any suggestions would be great!

1 Answers1

2

You can use threading's Timer class. An example:

import threading

def print_hello_world():
    threading.Timer(1, print_hello_world).start()
    print('Hello World')

print_hello_world()

This prints the hello world every 1 second (for 5 minutes, think what you should be changing; also think what you should be changing the print_hello_world() method to to fit your use case).

This is a very basic snippet. Obviously you can build on it by adding stop methods and so on. But I would suggest using Google to search your query first, as you should have in yourself to find solutions to simple problems on your own. Nonetheless, good luck on your journey with Python.

Ajay Maity
  • 740
  • 2
  • 8
  • 17