(start_time, end_time)
Generator for all spot prices changes that occurred between the start and end times.

    :param start_time: arrow object.
    :param end_time: arrow object.
Generator for all spot prices changes that occurred between the start and end times.
Generator for all spot prices changes that occurred between the start and end times .
def spot_price_generator(start_time, end_time):
    """
    Generator for all spot prices changes that occurred between the start and end times.

    :param start_time: arrow object.
    :param end_time: arrow object.
    """
    # Convert to UTC since Amazon expects that.
    start_time = start_time.to("utc")
    end_time = end_time.to("utc")

    results = ec2.get_paginator("describe_spot_price_history").paginate(
        StartTime=start_time.datetime,
        EndTime=end_time.datetime,
        ProductDescriptions=["Linux/UNIX (Amazon VPC)"],
        PaginationConfig={"PageSize": MAX_PAGE_SIZE},  # limit the page size to help prevent SSL read timeouts
    )
    for result in results:
        for price in result["SpotPriceHistory"]:
            # The history can include previous times, if the price is still in effect for the query period.
            # We've already recorded it, so ignore.
            if price["Timestamp"] < start_time:
                continue

            yield price
def spot_price_generator ( start_time , end_time ) : # Convert to UTC since Amazon expects that. start_time = start_time . to ( "utc" ) end_time = end_time . to ( "utc" ) results = ec2 . get_paginator ( "describe_spot_price_history" ) . paginate ( StartTime = start_time . datetime , EndTime = end_time . datetime , ProductDescriptions = [ "Linux/UNIX (Amazon VPC)" ] , PaginationConfig = { "PageSize" : MAX_PAGE_SIZE } , # limit the page size to help prevent SSL read timeouts ) for result in results : for price in result [ "SpotPriceHistory" ] : # The history can include previous times, if the price is still in effect for the query period. # We've already recorded it, so ignore. if price [ "Timestamp" ] < start_time : continue yield price