Repository navigation
Conversation
A market BUY signed the requested spend and floored the share count, so spend / shares was a hair above the order price and almost never an exact price. Market BUYs now sign the largest whole-cent spend within the requested amount whose share count, at the market's share precision, encodes the order price exactly. The amounts move in fixed steps from the gcd of the price and the two precisions. When no step fits, or the steps fall below the 1 USDC marketable BUY minimum, the SDK raises UserInputError with the smallest amount that works. Protected BUYs now sign exactly max_price, so the guard against crossing a higher ask after a tick refinement is no longer needed. Market SELLs and limit orders are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KngHU7sipb4T9BmJb35tV8
… for market BUYs The exchange now accepts a market BUY's cash at the same precision as a limit BUY's cash (4 decimals at tick 0.01, 5 at 0.001, 6 at 0.0001), not whole cents, and lowers the marketable BUY minimum to 0.99 USDC. Market BUYs now sign the largest spend at that precision whose share count encodes the order price exactly. The steps are much finer: 10 USDC at 0.65 now signs 9.9996 USDC for 15.384 shares, not 9.88 USDC for 15.2. A 1 USDC market BUY at any on-tick price now lands at or above 0.99 USDC. The SDK still raises UserInputError when no step fits, or when the steps fall below the minimum, and names the smallest amount that works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UeLKj8qqMa5RMRnhNFFWZX
….99 USDC minimum A requested amount below the minimum used to sign and leave the rejection to the exchange. Now that cash uses the finer limit BUY precision, such an amount often has a non-zero exact spend, so the SDK raises UserInputError for any exact spend below the minimum, as the TypeScript SDK does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UeLKj8qqMa5RMRnhNFFWZX
Contributor
Author
|
Fixes DEFIQA-2233. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A market BUY now signs the largest whole-cent spend within
amountwhose share count gives the order price exactly. Part ofamountcan stay unspent: $10 at 0.65 signs $9.88 for 15.2 shares. If no spend reaches the $1 marketable minimum, the SDK raisesUserInputErrorbefore it signs.