Update to reflect latest changes in Revolut outputs#30
Update to reflect latest changes in Revolut outputs#30MarvinRucinski wants to merge 3 commits intopbialon:mainfrom
Conversation
| @@ -62,10 +62,12 @@ def _action(cls, row: dict) -> Action: | |||
|
|
|||
| @classmethod | |||
| def _datetime(cls, row: dict) -> pendulum.DateTime: | |||
There was a problem hiding this comment.
IMO, the whole _datetime function can look just like this:
parsed = dateutil_parser.parse(row["Date"])
return pendulum.instance(parsed)
with include from dateutil import parser as dateutil_parser at the top of the file
In that way we won't be dependent on any other future date format changes
There was a problem hiding this comment.
I need to give it a try - if it works it would be awesome! 👍
It's really tedious to work out those Revolut date formats...
@MarvinRucinski could you check it out?
pbialon
left a comment
There was a problem hiding this comment.
I did some refactoring since you created the PR (sorry 🙏 ).
If you need help in rebasing it just let me know - I can do it with Claude Code in couple of minutes :)
And thanks for contributing!
| operation_type = cls.OPERATIONS.get(row['Type']) | ||
| if operation_type: | ||
| return operation_type | ||
| for operation_name, operation_type in cls.OPERATIONS.items(): | ||
| if operation_name in row['Type']: | ||
| return operation_type | ||
| return None |
There was a problem hiding this comment.
I'd rather make this whole function a regex matching, instead of that.
'BUY\w+' is OperationType.BUY etc,
'DIVIDEND' is OperationType.DIVIDEND
| currency = CurrencyBuilder.build(row['Currency']) | ||
| # e.g."-$1,003.01" | ||
| amount_row = row['Total Amount'] | ||
| amount_row = amount_row.strip(str(currency)) |
| @@ -62,10 +62,12 @@ def _action(cls, row: dict) -> Action: | |||
|
|
|||
| @classmethod | |||
| def _datetime(cls, row: dict) -> pendulum.DateTime: | |||
There was a problem hiding this comment.
I need to give it a try - if it works it would be awesome! 👍
It's really tedious to work out those Revolut date formats...
@MarvinRucinski could you check it out?
Improvements
Total Amountrow now includes the currency