Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Freetrade parser #564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

podtserkovskiy
Copy link

Supported events

  • Sell
  • Buy
  • Top up
  • Withdrawal
  • Interest on cash
  • Dividends
  • Free share

Freetrade doesn't provide stock splits events, I added a hacky support for few stocks borrowing code from another parser

@podtserkovskiy
Copy link
Author

podtserkovskiy commented Sep 29, 2024

The datetime.fromisoformat do not support dates like 2021-12-13T16:16:49.475Z in Python version before 3.11
Freetrade using this version of ISO 8601 format for transaction dates.
CI uses Python 3.9 at the moment its EOL is planned in 2025

@KapJI Would you mind if I make a PR with Python version update?
UPD: #565

@vmartinv
Copy link
Collaborator

Looks great! Can you also update the README.md with instructions for it?

@vmartinv
Copy link
Collaborator

Instead of using 3.12 you can do something like this maybe?

from datetime import datetime

iso_date = "2021-12-13T16:16:49.475Z"
# Replace 'Z' with '+00:00' to make it compatible
iso_date = iso_date.replace("Z", "+00:00")

# Parse the string with the adjusted format
parsed_date = datetime.strptime(iso_date, "%Y-%m-%dT%H:%M:%S.%f%z")

print(parsed_date)  # Output: 2021-12-13 16:16:49.475000+00:00

@podtserkovskiy
Copy link
Author

Thanks for the advice, I added a date parsing function based on your example and augmented README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants