def interactive_roll_info(instrument_code: str = "ALL"):
    """

    Print information about whether futures contracts should be rolled

    :param instrument_code: The instrument code, for example 'AUD', 'CRUDE_W'. Specify ALL for everything
    :return: None, but print results
    """

    config = roll_report_config.new_config_with_modified_output("console")
    config.modify_kwargs(instrument_code=instrument_code)
    run_report(roll_report_config)
def interactive_update_roll_status():
    """
    Update the roll state for a particular instrument
    This includes the option, where possible, to switch the adjusted price series on to a new contract

    :param instrument_code: str
    :return: None
    """

    with dataBlob(log_name="Interactive_Update-Roll-Status") as data:
        instrument_code = get_valid_instrument_code_from_user(data=data)
        # First get the roll info
        # This will also update to console
        config = roll_report_config.new_config_with_modified_output("console")
        config.modify_kwargs(instrument_code=instrument_code)
        report_results = run_report_with_data_blob(config, data)
        if report_results is failure:
            print("Can't run roll report, so can't change status")
            return failure

        current_roll_status, roll_state_required = get_required_roll_state(
            data, instrument_code)
        if roll_state_required is no_state_available:
            return failure

        update_positions = updatePositions(data)
        update_positions.set_roll_state(instrument_code, roll_state_required)

        if roll_state_required is roll_adj_state:
            # Going to roll adjusted prices
            roll_result = _roll_adjusted_and_multiple_prices(
                data, instrument_code)
            if roll_result is success:
                # Return the state back to default (no roll) state
                data.log.msg(
                    "Successful roll! Returning roll state of %s to %s" %
                    (instrument_code, default_state))
                update_positions.set_roll_state(instrument_code, default_state)
            else:
                data.log.msg(
                    "Something has gone wrong with rolling adjusted of %s! Returning roll state to previous state of %s"
                    % (instrument_code, current_roll_status))
                update_positions.set_roll_state(instrument_code,
                                                current_roll_status)

        return success
def run_roll_report(data: dataBlob, instrument_code: str):
    config = roll_report_config.new_config_with_modified_output("console")
    config.modify_kwargs(instrument_code=instrument_code)
    report_results = run_report_with_data_blob(config, data)
    if report_results is failure:
        raise Exception("Can't run roll report, so can't change status")