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

Convert foreign currencies to ILS #22

Open
asfktz opened this issue Feb 17, 2018 · 5 comments
Open

Convert foreign currencies to ILS #22

asfktz opened this issue Feb 17, 2018 · 5 comments

Comments

@asfktz
Copy link
Contributor

asfktz commented Feb 17, 2018

Hi @eshaham!

A few weeks ago, while working with this lib to import my bank data to YNAB, I noticed that all the transactions that made with currencies other than ILS, are actually imported is if they were in ILS.

For example, this iTunes payment is 19.90$, not ₪19.90

111

I think having something like this will be nicer:
222

Notice how the outflow in ILS changes according to the date the transaction was made on.

I implemented support for currency conversion in my fork, It works like this:

  • It lets you set up your app id for openexchangerates.org in npm run credentials
  • It extracts the dates from all the transactions and fetches the historical rates from openexchangerates.org
  • To keeps things free, it caches each request (we only got 1000 requests per month for free).
  • It converts each foreign transaction to ILS and adds a memo with the original amount.
@asfktz asfktz changed the title Convert foreign txns to ILS Convert foreign Currencies to ILS Feb 17, 2018
@asfktz asfktz changed the title Convert foreign Currencies to ILS Convert foreign currencies to ILS Feb 17, 2018
@eshaham
Copy link
Owner

eshaham commented Feb 18, 2018

@asfktz hmmm, this feels more like a bug in https://github.com/eshaham/israeli-bank-scrapers then a feature in this tool.
The scrapers repo returns 3 relevant fields:

{
  ...
  originalAmount: double,
  originalCurrency: string,
  chargedAmount: double,
  ...
}

originalAmount should hold the original amount of the transaction in the original currency.
originalCurrency should hold the original currency of the transaction.
chargedAmount should hold the actual charged amount in ILS

From what I see in the screenshot above, it seems like chargedAmount for that specific scraper holds in the the amount in the original currency, which is a bug.

@asfktz
Copy link
Contributor Author

asfktz commented Feb 18, 2018

In Isracard, I noticed that transactions under עסקות חו"ל are paid from my מט"ח account in Bank Hapoalim

For example, this 50$ payment to YNAB:

Isracard:
isracard

Bank Hapoalim (מט"ח):
poalim

So I believe it's not converted directly because I have to explicitly buy USD in my מט"ח account.

Edit:
This is the original txn values from isracard:

{
  "specificDate": null,
  "cardIndex": "0",
  "dealsInbound": null,
  "supplierId": null,
  "supplierName": null,
  "dealSumType": null,
  "paymentSumSign": null,
  "purchaseDate": null,
  "fullPurchaseDate": null,
  "moreInfo": null,
  "horaatKeva": null,
  "voucherNumber": "0016171",
  "voucherNumberRatz": null,
  "solek": null,
  "purchaseDateOutbound": "18/01",
  "fullPurchaseDateOutbound": "18/01/2018",
  "currencyId": "USD",
  "currentPaymentCurrency": "USD",
  "city": "LEHI",
  "supplierNameOutbound": "YOU NEED A BUDG",
  "fullSupplierNameOutbound": "YOU NEED A BUDGET",
  "paymentDate": "21/01",
  "fullPaymentDate": "21/01/2018",
  "isShowDealsOutbound": "_",
  "adendum": null,
  "voucherNumberRatzOutbound": "183141595",
  "isShowLinkForSupplierDetails": null,
  "dealSum": null,
  "paymentSum": null,
  "fullSupplierNameHeb": null,
  "dealSumOutbound": "50.00",
  "paymentSumOutbound": "50.00",
  "isHoraatKeva": "false",
  "stage": null,
  "returnCode": null,
  "message": null,
  "returnMessage": null,
  "displayProperties": null,
  "tablePageNum": "0",
  "isError": "false",
  "isCaptcha": "false",
  "isButton": "false",
  "siteName": null,
  "clientIpAddress": null
}

@asfktz
Copy link
Contributor Author

asfktz commented Feb 19, 2018

@eshaham The referenced PR contains only changes that related to currency conversion.

@eshaham
Copy link
Owner

eshaham commented Feb 20, 2018

@asfktz ok, now I get it.
So what actually happens is that chargedAmount holds the dollar amount, and not the amount in shekels. Step one would definitely be to add a chargedCurrency property.
I added an issue in the scrapers repo: eshaham/israeli-bank-scrapers#80

As for your PR for exchanging rates, I'm going to need to think about that one.
While it makes sense to convert transactions with foreign currencies to ILS, since YNAB only allows one currency per budget, I'm not convinced this is the solution. Don't know, maybe you're right.
I'll think about it 😄

@eshaham
Copy link
Owner

eshaham commented Feb 20, 2018

@asfktz you know what, I'm convinced
I have a lot of comments about the PR, will add them there

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

No branches or pull requests

2 participants