Skip to content

fix: uNtl should be int64 to avoid scientific notation#142

Open
zhouziyan wants to merge 1 commit intosonirico:masterfrom
coin-quant:fix
Open

fix: uNtl should be int64 to avoid scientific notation#142
zhouziyan wants to merge 1 commit intosonirico:masterfrom
coin-quant:fix

Conversation

@zhouziyan
Copy link
Copy Markdown

Pull Request

Description

According to the API docs:
"ntli": int representing amount to add or remove with 6 decimals, e.g. 1000000 for 1 usd

  1. *1000000
  2. change to int64 to avoid scientific notation

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • I have run make test and all checks pass

sonirico

This comment was marked as outdated.

sonirico

This comment was marked as outdated.

Copy link
Copy Markdown
Owner

@sonirico sonirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One fix needed before merging: int64(amount * 1000000) truncates toward zero due to IEEE-754 float representation. For example, 100.2 * 1000000 = 100199999.999...int64(...) = 100199999 instead of 100200000.

Change to:

import "math"

Ntli: int64(math.Round(amount * 1000000)),

Everything else is correct — the type change, the scaling, and preserving the sign (docs confirm ntli sign controls add/remove direction; isBuy has no effect until hedge mode).

@sonirico sonirico dismissed their stale review March 14, 2026 10:31

Dismissing — review was premature, pending further analysis.

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.

2 participants