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

Questions about forex currencies #118

Open
ph4z opened this issue Jul 19, 2020 · 5 comments
Open

Questions about forex currencies #118

ph4z opened this issue Jul 19, 2020 · 5 comments

Comments

@ph4z
Copy link

ph4z commented Jul 19, 2020

First of all, I would like to thank you for developping this great tool.
In the readme it says "All ledgers and wallet values expressed in USD or other Forex currency"
But I only have USD values and I can't find where to configure this feature.
So how can I have ledger entries in EUR for exemple ?
By the way it would be great to have other forex currencies in the "Account balance" and "Average Win/Loss".

@ph4z ph4z changed the title Questions about forex Questions about forex currencies Jul 19, 2020
@ezewer
Copy link
Contributor

ezewer commented Jul 20, 2020

Hi @ph4z thanks for the commet! :)
Actually we just have integrated USD, however we have the system open as to add support for other currencies.
I think we would add this on a future, we are also open to receive PRs from the community as to add this ability.

@ph4z
Copy link
Author

ph4z commented Sep 4, 2020

Hi @ezewer I would be glad to post a PR but I do not understand how this could be implemented.
For converting USD amouts to EUR amounts the only reasonable way seems to use the "forex" endpoint https://docs.bitfinex.com/reference#rest-public-calc-foreign-exchange-rate
But there is now way to request historical data from this endpoint.

we have the system open as to add support for other currencies.
I could not find it in the code.

Can you give more explanations on how it is possible to implement other currencies ? Thanks.

@ezewer
Copy link
Contributor

ezewer commented Sep 7, 2020

So i think that simplest way to do it, is to do a triangulation between pairs.
Example: tBTCUSD and tBTCUER .
IF

  • tBTCUSD: 10279
  • tBTCEUR: 8678.7
    Can conclude that EUR = 1.18439 USD (is a similar exchange rate to the one show by google)
    On that way can get a reliable exchange rate without need to add a new endpoint. More over can use the triangulation logic that is already set in place.

@ph4z
Copy link
Author

ph4z commented Sep 8, 2020

Thanks a bunch for helping me!

More over can use the triangulation logic that is already set in place.

Could you just show me where the triangulation functions are implemented ? I could not find it.

@ezewer
Copy link
Contributor

ezewer commented Sep 9, 2020

Here you have the forex currency converter

const isRequiredConvFromForex = this._isRequiredConvFromForex(

Check that on line 400 you have btcPriseIn and btc btcPriseOut
However being said that, should use same function as to convert the price.
If planning on converting and saving directly to DB check https://github.com/bitfinexcom/bfx-reports-framework/blob/f6a269aa08de942eba09b698f5e15970b57c0594/workers/loc.api/sync/data.inserter/hooks/convert.currency.hook.js
Pd: Just spotted the Typo would change to price.

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

No branches or pull requests

2 participants