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

FIX: [bybit][kucoin] fix negative volume, price precision #1372

Merged
merged 2 commits into from Oct 28, 2023

Conversation

bailantaotao
Copy link
Collaborator

@bailantaotao bailantaotao commented Oct 27, 2023

The precision should be positive. Bybit is according to Kucoin, so it is also incorrect..

Other exchanges are correct.

bybit document: https://bybit-exchange.github.io/docs/v5/market/instrument

              "basePrecision": "0.000001",
                "quotePrecision": "0.00000001",

kucoin document: https://www.kucoin.com/docs/rest/spot-trading/market-data/get-symbols-list

    "quoteIncrement": "0.000001",
    "priceIncrement": "0.000001",

@bbgokarma-bot
Copy link

Welcome back! @bailantaotao, This pull request may get 216 BBG.

@bailantaotao bailantaotao changed the title FIX: fix negative volume, price precision FIX: [bybit][kucoin] fix negative volume, price precision Oct 27, 2023
@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 223 BBG

@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #1372 (ba7e26c) into main (c4f1af0) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1372   +/-   ##
=======================================
  Coverage   20.99%   20.99%           
=======================================
  Files         568      568           
  Lines       40623    40623           
=======================================
  Hits         8529     8529           
  Misses      31463    31463           
  Partials      631      631           
Files Coverage Δ
pkg/exchange/bybit/convert.go 76.38% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4f1af0...ba7e26c. Read the comment docs.

@bailantaotao
Copy link
Collaborator Author

Since the test with -dnum flag caused a precision problem, for example:

a := -int(math.Log10(fixedpoint.NewFromFloat(0.000001).Float64()))
b := -int(math.Log10(fixedpoint.NewFromFloat(0.00000001).Float64()))
t.Log(a, b)
// 6, 7

But b must be 8.

After discussing with @c9s , we can solve it by using NumFractionalDigits.

@c9s c9s merged commit dcd837f into c9s:main Oct 28, 2023
4 checks passed
@bbgokarma-bot
Copy link

Hi @bailantaotao,

Well done! 238 BBG has been sent to your polygon wallet. Please check the following tx:

https://polygonscan.com/tx/0xc6b239eca101acae8e5cfeb4f4298211bb036879df3dbaf75a2f441e1f949558

Thank you for your contribution!

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.

None yet

4 participants