from moose_lib import Key, moose_data_model from dataclasses import dataclass from datetime import datetime from typing import Optional @moose_data_model @dataclass class USDBRLExchangeRate: # The timestamp of the exchange rate data, used as a time-based key for each record timestamp: Key[int] # The currency code for the base currency (USD) code: str # The currency code for the quote currency (BRL) codein: str # The full name of the currency exchange rate name: str # The highest exchange rate for the given period high: float # The lowest exchange rate for the given period low: float # The exchange rate at which USD is bought (BRL is sold) bid: float # The exchange rate at which USD is sold (BRL is bought) ask: float # The percentage change in the exchange rate relative to the previous period pctChange: float # The absolute change in the bid price from the previous period varBid: float # The creation date of the data, stored as a string in the format 'YYYY-MM-DD HH:MM:SS' create_date: datetime # Explanation: # - `timestamp` is used as the primary key to uniquely identify each record by its time. # - `float` is used for rates and changes as it represents decimal numbers accurately. # - `str` is used for textual data, such as currency code and name. # - The `datetime` module is used for handling date and time information comprehensively.