swap Money for MoneyAmount, fix a couple of things along the way
This commit is contained in:
parent
ab2ac1ec6a
commit
0947b34ebf
6 changed files with 26 additions and 27 deletions
|
|
@ -1,13 +1,12 @@
|
|||
import datetime
|
||||
import os
|
||||
from abc import ABC, abstractmethod
|
||||
from decimal import Decimal
|
||||
|
||||
from money.currency import Currency, CurrencyHelper
|
||||
from money.money import Money
|
||||
from money.currency import Currency
|
||||
from xecd_rates_client import XecdClient
|
||||
|
||||
from xexe.exchange_rates import ExchangeRate
|
||||
from xexe.money_amount import DEFAULT_MONEY_PRECISION_POSITIONS, MoneyAmount
|
||||
|
||||
|
||||
class RateFetcher(ABC):
|
||||
|
|
@ -35,7 +34,7 @@ class MockRateFetcher(RateFetcher):
|
|||
return ExchangeRate(
|
||||
from_currency=from_currency,
|
||||
to_currency=to_currency,
|
||||
rate=Money(42, to_currency),
|
||||
rate=MoneyAmount(42, to_currency),
|
||||
rate_date=rate_date,
|
||||
)
|
||||
|
||||
|
|
@ -71,7 +70,7 @@ class XERateFetcher(RateFetcher):
|
|||
"Z", "+00:00"
|
||||
) # Funny replace is necessary because of API response format
|
||||
).date()
|
||||
rate = f"""{response["to"][0]["mid"]:.{CurrencyHelper.decimal_precision_for_currency(to_currency)}f}"""
|
||||
rate = f"""{response["to"][0]["mid"]:.{DEFAULT_MONEY_PRECISION_POSITIONS}f}"""
|
||||
|
||||
return ExchangeRate(
|
||||
from_currency=from_currency,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue