Skip to content

Conversation

@TaprootFreak
Copy link
Collaborator

Summary

  • Add SELL command to ScryptAdapter for automatic trading when fiat balance exceeds threshold
  • Extend ScryptService with trading methods (placeOrder, sell, checkTrade)
  • Add migration to configure Rules 312 (EUR) and 313 (CHF) with maximal=1000

Details

When EUR or CHF balance on Scrypt exceeds 1000, the LiquidityManagement system automatically triggers a market sell order to convert to USDT. This follows the same pattern used by Binance/MEXC adapters.

New ScryptAdapter command:

  • sell with params {"tradeAsset":"USDT"}

WebSocket API additions:

  • NewOrderSingle - Place market/limit orders
  • ExecutionReport - Track order status

Test plan

  • Deploy to DEV environment
  • Verify Scrypt WebSocket connection for trading
  • Test with small EUR/CHF amounts to trigger SELL
  • Verify order completion detection

…rsion

Add SELL command to ScryptAdapter for automatic trading when fiat
balance exceeds threshold (1000 EUR/CHF).

Changes:
- Add NEW_ORDER_SINGLE and EXECUTION_REPORT message types to WebSocket
- Add trading methods to ScryptService: placeOrder(), sell(), checkTrade()
- Add ScryptOrderStatus, ScryptOrderSide, ScryptOrderType enums
- Extend ScryptAdapter with SELL command and completion check
- Add migration to create Actions and update Rules 312/313

When EUR or CHF balance on Scrypt exceeds 1000, the system automatically
places a market sell order to convert to USDT.
@TaprootFreak TaprootFreak marked this pull request as draft January 15, 2026 16:41
@github-actions
Copy link

github-actions bot commented Jan 15, 2026

⚠️ Security: 0 critical, 61 high vulnerabilities

For SELL trades, outputAmount should be the proceeds (USDT received),
not the sold quantity (EUR/CHF). Fixed by multiplying filledQuantity
with avgPrice from the execution report.

Also fixed migration comments to correctly identify rules:
- Rule 312 = Scrypt CHF
- Rule 313 = Scrypt EUR
Scrypt uses British spelling 'Cancelled' (double 'l'), not American
'Canceled'. Without this fix, cancelled orders would never be detected
and orders could hang indefinitely.
FillAndKill (IOC) cancels unfilled portions immediately, causing
partial fills on large orders with limited liquidity.

GoodTillCancel keeps the order active until completely filled,
allowing checkSellCompletion() to poll until FILLED status.
When a Scrypt sell order is CANCELLED (e.g., partial fill with
FillAndKill or exchange-side cancellation):

1. Check remaining quantity
2. If negligible (<0.01): consider order complete
3. Otherwise: place new order with remaining amount
4. Track all correlation IDs via updateCorrelationId()
5. Aggregate output from all orders when finally FILLED

This matches the robust retry behavior of CcxtExchangeAdapter
used by Binance, MEXC, Kraken, etc.
@TaprootFreak
Copy link
Collaborator Author

Änderungen wurden in #2949 gemerged

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