question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multi currency account

See original GitHub issue

If you were to implement a multi-currency version of Medici, how would you do it?

I guess

.debit('Assets:Cash', 1000, {meta}) would need another parameters, ie: .debit('Assets:Cash', 1000, {meta}, "USD")

A transaction would still equal out with multiple currencies. ie Alice sending 10 USD for 12 EUR to Bob:

.credit('Alice', 10,  {}, 'USD')
.debit('Bob", 10, {}, USD')
.debit('Alice', 12,  {}, 'EUR')
.credit('Alice, 12, {}, 'EUR')

Now the issue would be that, if we try to fetch a balance like this, we will have currency co-mingled.

ie:

const balance = await myBook.balance({
  account: "Assets:Accounts Receivable",
  client: "Joe Blow"
});

So we would need to have a mandatory currency field here. And filter that out.

I’m wondering what the most efficient way to do it would be?

Simply adding a currency field in transaction, and modifying the balance function? Any other idea?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
nicolasburteycommented, May 5, 2020

I have currently being using

.credit('Alice', 10,  {currency: 'USD'})
.debit('Alice', 9, {currency: 'EUR'})
.credit('Bob', 9,  {currency: 'EUR'})
.debit('Bob', 10, {currency: 'USD'})

with no issue so far. as long as every balance() call includes currency the balance seems correctly fetch with the currency flag.

closing this for now.

1reaction
nicolasburteycommented, Apr 18, 2020

Just proposed a PR to remove what I believe is not correct in the README

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multicurrency Account: What Is It And How Does It Work?
A multicurrency account is a type of demand deposit account that allows you to send, hold and receive various currencies in one place....
Read more >
Multicurrency Account: What Is It and How Does It Work?
A multicurrency account is typically an account at a bank or financial tech firm that lets you spend, receive and hold multiple currencies....
Read more >
Multi Currency Account - Wise
Meet the Wise multi-currency account. ... Holding multiple currencies is completely free, and we use the real exchange rate to convert. See all...
Read more >
What Is A Multicurrency Account? - Bankrate
A multicurrency account, sometimes called a foreign currency account, allows consumers and businesses to hold different currencies in one ...
Read more >
Multicurrency Bank Accounts | Foreign Currency - HSBC Expat
Bank multiple currencies around the world with a HSBC Expat offshore account. Save in 19 currencies and manage your foreign exchange needs with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found