Automatically updating GET request python
Question: I have a exchange rate request that I would like to update every second. As of
now I have to re-load the program to refresh the rate. How would I go about
doing this in Python?

Any help would be appreciated, thanks in advance..

script:

    
    
    import oandapy
    
    oanda = oandapy.API(environment="practice", access_token="xxxxxxxxxxxx")
    
    response = oanda.get_prices(instruments="EUR_USD")
    prices = response.get("prices")
    asking_price = prices[0].get("ask")
    
    stop = asking_price - .001
    

Per answer:

    
    
    while True:
        response = oanda.get_prices(instruments="EUR_USD")
        prices = response.get("prices")
        asking_price = prices[0].get("ask")
    
        stop = asking_price - .001
    
    time.sleep(1)
    


Answer: The general method is to wrap the entire thing in an infinite loop, and wait
between requests:

    
    
    while True:
        # ... do and print request
        time.sleep(1) # then wait one second
    

Make sure that your API access token allows sending a request every second.

* * *

However, after a quick Google I found that the API you're using supports
streaming rates: <https://github.com/oanda/oandapy#rates-streaming>

