import csv
from datetime import datetime


def create_tuple_csv(csv_file, timestamp_type):
    """
    Creates list of tuples of data from CSV file
    :param csv_file: CSV file of API call data
    :param timestamp_type: date or datetime
    :return: List of tuples of data
    """

    tuple_data_list = []

    for i, line in enumerate(csv.reader(csv_file)):
        row = []

        for j, elem in enumerate(line):

            if i == 0:
                row.append(elem)
            elif j == 0:
                if timestamp_type == 'date':
                    row.append(datetime.strptime(elem, '%Y-%m-%d').date())
                elif timestamp_type == 'datetime':
                    row.append(datetime.strptime(elem, '%Y-%m-%d %H:%M:%S'))
            else:
                row.append(float(elem))

        tuple_data_list.append(tuple(row))

    return tuple_data_list