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

[v1] Pluggable strategy does not properly calculate precision for Fuji USD #736

Open
djkazic opened this issue Sep 14, 2023 · 2 comments
Open
Assignees

Comments

@djkazic
Copy link

djkazic commented Sep 14, 2023

Scripts I used:

# 10000 sats quote
curl 'https://tdex.eldamar.icu/v2/trade/preview' \
  -H 'authority: tdex.eldamar.icu' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'pragma: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  --data-raw '{"amount":"10000","asset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","feeAsset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7","market":{"provider":{"name":"eldamar","endpoint":"https://tdex.eldamar.icu:443"},"baseAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","quoteAsset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7","percentageFee":{"baseAsset":"40","quoteAsset":"40"},"fixedFee":{"baseAsset":"300","quoteAsset":"1"},"price":{"spotPrice":26349,"minTradableAmount":"1","balance":{"baseAmount":"416661","quoteAmount":"12200"}}},"type":1}' \
  --compressed

# 1 USD quote
curl 'https://tdex.eldamar.icu/v2/trade/preview' \
  -H 'authority: tdex.eldamar.icu' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'pragma: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \
  --data-raw '{"amount":"100","asset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7","feeAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","market":{"provider":{"name":"eldamar","endpoint":"https://tdex.eldamar.icu:443"},"baseAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","quoteAsset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7","percentageFee":{"baseAsset":"40","quoteAsset":"40"},"fixedFee":{"baseAsset":"300","quoteAsset":"1"},"price":{"spotPrice":26349,"minTradableAmount":"1","balance":{"baseAmount":"416661","quoteAmount":"12200"}}},"type":0}' \
  --compressed

When using Pluggable strategy I get:

# 10000 sats quote
{"code":2,"message":"provided amount is too big","details":[]}
(even 1 sat does this!)

# 1 USD quote
{"code":2,"message":"provided amount is too low","details":[]}

# 100000 USD quote (???)
{"previews":[{"price":{"basePrice":0.00003795210444419143,"quotePrice":26349},"fee":{"percentageFee":{"baseAsset":"40","quoteAsset":"40"},"fixedFee":{"baseAsset":"300","quoteAsset":"1"}},"amount":"379","asset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","feeAmount":"301","feeAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d"}]}

When using Balanced strategy I (correctly) get:

# 10000 sats quote
{"previews":[{"price":{"basePrice":0.00003795210444419143,"quotePrice":26349},"fee":{"percentageFee":{"baseAsset":"40","quoteAsset":"40"},"fixedFee":{"baseAsset":"300","quoteAsset":"1"}},"amount":"285","asset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7","feeAmount":"2","feeAsset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7"}]}

# 1 USD quote
{"previews":[{"price":{"basePrice":0.00003795210444419143,"quotePrice":26349},"fee":{"percentageFee":{"baseAsset":"40","quoteAsset":"40"},"fixedFee":{"baseAsset":"300","quoteAsset":"1"}},"amount":"3387","asset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","feeAmount":"313","feeAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d"}]}

Both Pluggable and Balanced work for Tether. I wonder if the precision is related.

@djkazic djkazic changed the title [v1] Pluggable strategy does not properly calculate precision [v1] Pluggable strategy does not properly calculate precision for Fuji USD Sep 14, 2023
@altafan
Copy link
Collaborator

altafan commented Sep 15, 2023

@djkazic something's wrong with the LBTC/FUSD market. I'm not able to retrieve it as for LBTC/USDT:

LBTC / USDT
$ curl -X POST https://tdex.eldamar.icu/v2/market/price -H 'Content-Type: application/json' -d '{"market":{"baseAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","quoteAsset":"ce091c998b83c78bb71a632313ba3760f1763d9cfcffae02258ffa9865a37bd2"}}'
# {"spotPrice":26349,"minTradableAmount":"1","balance":{"baseAmount":"280234","quoteAmount":"9644808237"}}

LBTC / FUSD
$ curl -X POST https://tdex.eldamar.icu/v2/market/price -H 'Content-Type: application/json' -d '{"market":{"baseAsset":"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d","quoteAsset":"0dea022a8a25abb128b42b0f8e98532bc8bd74f8a77dc81251afcc13168acef7"}}'
# {"code":13,"message":"decimal division by 0","details":[]}

@altafan
Copy link
Collaborator

altafan commented Sep 15, 2023

From offline discussion, it came out the precisions for the asset pair were wrong due to an alleged bug in the dashboard.

@djkazic would you be so kind to open an issue on the dashboard repo with all the steps to reproduce the problem you experienced with assets precision?

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