gcx/frontend/genex-mobile/lib/features/trading/presentation/providers/trading_provider.dart

27 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ============================================================
// TradingProvider — 交易 Riverpod Providers
// ============================================================
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../core/network/api_client.dart';
// ── 市场列表(暂无专属接口,复用券列表代替)──────────────────────
// 后端无 /trading/markets由上层页面使用 coupon 列表替代
// ── 订单簿 ────────────────────────────────────────────────────
final orderBookProvider =
FutureProvider.autoDispose.family<dynamic, String>((ref, couponId) async {
final api = ApiClient.instance;
final resp = await api.get('/api/v1/trades/orderbook/$couponId');
return resp.data['data'];
});
// ── 我的挂单 ──────────────────────────────────────────────────
final myOpenOrdersProvider = FutureProvider.autoDispose((ref) async {
final api = ApiClient.instance;
final resp = await api.get('/api/v1/trades/my/orders');
return resp.data['data'];
});