Site wont stop rerunning

So i am trying to run the following code that lets me add data every day to my csv file . it does just that but i can’t seem to make my app stop running when i view it . how can i fix that ?

date = datetime.date.today().strftime("%d/%m/%Y")

url = “https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR

response = requests.get(url).json()

price = response[“USD”]

fieldnames = [“date”, “price”]

with open(‘data.csv’, ‘r+’) as csv_file:

csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

csv_writer.writeheader()

while True:

with open('data.csv', 'a') as csv_file:

    csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

    info = {

        "date": date,

        "price": price

    }

    csv_writer.writerow(info)

    print(date, price)

    

    #date = datetime.date.today()

    date = datetime.date.today().strftime("%d/%m/%Y")

    url = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR"

    response = requests.get(url).json()

    price = response["USD"]

    

time.sleep(86400)

Please post your code in proper markdown format here, otherwise it is not readable:

```python
put your python code here
```

I hope this is right

date = datetime.date.today().strftime("%d/%m/%Y")
url = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR"
response = requests.get(url).json()
price = response["USD"]


fieldnames = ["date", "price"]


with open('data.csv', 'r+') as csv_file:
    csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
    csv_writer.writeheader()
    

while True:

    with open('data.csv', 'a') as csv_file:
        csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

        info = {
            "date": date,
            "price": price
        }

        csv_writer.writerow(info)
        print(date, price)
    
    
        #date = datetime.date.today()
        date = datetime.date.today().strftime("%d/%m/%Y")
        url = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR"
        response = requests.get(url).json()
        price = response["USD"]
        


    time.sleep(86400)

How do you run this code?
I don’t see any streamlit stuff here.

here’s the thing . i don’t know . this script is only made for collecting data from the internet and adding it to the csv file on a daily basis. that file is then used to show graphs and calculate a change rate.
i believe my problem is i dont know where this script should be ? can u help me with that?

Without context, I can’t do anything with the code snippet either.
Link to a public github repo?

But apart from that I would avoid something like this and solve it differently:

time.sleep(86400)