Skip to content

fix: Opinion BUY cap units + ungated fallback + double breaker record - #135

Open
Frank-zhu0404 wants to merge 1 commit into
alsk1992:mainfrom
Frank-zhu0404:fix/issue-127-opinion-buy-cap
Open

Frank-zhu0404 wants to merge 1 commit into
alsk1992:mainfrom
Frank-zhu0404:fix/issue-127-opinion-buy-cap

Conversation

@Frank-zhu0404

Copy link
Copy Markdown

Closes #127

Summary

Follow-up to #115 / #120. Fixes three remaining safety issues around Opinion / batch execution:

  1. Opinion BUY maxOrderSize uses wrong units — Opinion BUY size/amount is quote-token spend (USDC), not shares. Validation and breaker accounting now use size for Opinion BUY (still price * size for SELL / other venues).
  2. Ungated Opinion place fallbackopinion_place_order / opinion_place_orders_batch no longer call the venue directly when executionService is absent; they require the execution service so breaker, maxOrderSize, and dry-run apply.
  3. Fallback batch orders double-recorded to the circuit breaker — the per-order fallback path now uses executeOrder instead of buyLimit/sellLimit, so the final batch loop records each result once.

Test plan

  • tsc --noEmit clean
  • Extended tests/execution/batch-order-safety.test.ts:
    • Opinion BUY cap treats size as quote spend (price 0.10 / size 1000 rejected at $100 cap; size 100 allowed; SELL still uses price×size)
    • Unknown-venue fallback records exactly one breaker trade
  • Existing batch dry-run / size / breaker cases still pass

…ord (alsk1992#127)

Opinion BUY size is quote-token spend, so validate/record notional as size
rather than price*size. Refuse direct Opinion place fallbacks without
executionService. Batch fallback uses executeOrder so the breaker is not
double-counted.

Closes alsk1992#127
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.

Follow-up to #115/#120: Opinion BUY cap uses wrong units, direct fallback ungated, fallback orders double-recorded to breaker

1 participant