Skip to content

Conversation

@TaprootFreak
Copy link
Collaborator

Summary

  • Implement full trading support for Scrypt exchange with LIMIT orders (not MARKET)
  • Add price tracking that updates orders when market price changes (like Binance/Kraken)
  • Auto-restart cancelled orders with remaining amount if >= minAmount
  • Fetch minAmount dynamically from Security stream instead of hardcoded values

Changes

ScryptWebSocketConnection:

  • Add MessageTypes: NEW_ORDER_SINGLE, EXECUTION_REPORT, MARKET_DATA_SNAPSHOT, SECURITY, ORDER_CANCEL_REQUEST, ORDER_CANCEL_REPLACE_REQUEST

ScryptService:

  • fetchOrderBook() / getCurrentPrice() - Get best bid/ask
  • getSecurityInfo() / getMinTradeAmount() - Dynamic min amounts
  • placeOrder() with price parameter, default to LIMIT
  • sell() - Places LIMIT order at current market price
  • cancelOrder() / editOrder() - Order management

ScryptAdapter:

  • Add SELL command with tradeAsset parameter
  • checkSellCompletion() with Binance-like price tracking:
    • NEW/PARTIALLY_FILLED: Compare price, call editOrder() if changed
    • CANCELLED: Auto-restart with remaining if >= minAmount
    • FILLED: Aggregate output from all correlation IDs
  • Parallel order fetching with Promise.allSettled()

Test plan

  • Test SELL command places LIMIT order with current price
  • Test price tracking updates order when market moves
  • Test cancelled orders auto-restart with remaining amount
  • Test output aggregation for multi-part fills

Implement full trading support for Scrypt exchange with the same
rules as Binance/Kraken - using LIMIT orders with dynamic price tracking.

ScryptWebSocketConnection:
- Add MessageTypes: NEW_ORDER_SINGLE, EXECUTION_REPORT
- Add MessageTypes: MARKET_DATA_SNAPSHOT, SECURITY
- Add MessageTypes: ORDER_CANCEL_REQUEST, ORDER_CANCEL_REPLACE_REQUEST

ScryptService:
- Add trading enums: ScryptOrderStatus, ScryptOrderSide, ScryptOrderType
- Add fetchOrderBook() - get orderbook with bids/offers
- Add getCurrentPrice() - get best bid/ask price
- Add getSecurityInfo() / getMinTradeAmount() - dynamic min amounts
- Add placeOrder() with price parameter, default to LIMIT
- Add sell() - places LIMIT order at current market price
- Add cancelOrder() - cancel existing order
- Add editOrder() - update order price (OrderCancelReplaceRequest)
- Add getOrderStatus() with price field

ScryptAdapter:
- Add SELL command with tradeAsset parameter
- Add checkSellCompletion() with Binance-like price tracking:
  - NEW/PARTIALLY_FILLED: compare price, editOrder() if changed
  - CANCELLED: auto-restart with remaining if >= minAmount
  - FILLED: aggregate output from all correlation IDs
- Add aggregateSellOutput() for multi-order fills
- Add verbose log when order price is unchanged (like Binance)
- Parallelize aggregateSellOutput() with Promise.allSettled()
- Add failure logging and error handling for partial fetch failures
- Throw OrderFailedException if no orders can be fetched
@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