From 06e0a325142b4ec04dc331591523e15d1dc95754 Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Tue, 25 May 2021 17:42:42 +0200 Subject: [PATCH] Switch from namedtuple to dataclass. --- src/pricehist/price.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pricehist/price.py b/src/pricehist/price.py index 9b9027a..dafc2bc 100644 --- a/src/pricehist/price.py +++ b/src/pricehist/price.py @@ -1,3 +1,10 @@ -from collections import namedtuple +from dataclasses import dataclass +from decimal import Decimal -Price = namedtuple("Price", ["base", "quote", "date", "amount"]) + +@dataclass(frozen=True) +class Price: + base: str + quote: str + date: str + amount: Decimal