111
This commit is contained in:
@@ -53,4 +53,17 @@ class MarketService {
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '搜索失敗');
|
||||
}
|
||||
|
||||
/// 獲取訂單簿深度
|
||||
Future<ApiResponse<Map<String, dynamic>>> getDepth(String code) async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.marketDepth,
|
||||
queryParameters: {'code': code},
|
||||
);
|
||||
|
||||
if (response.success && response.data != null) {
|
||||
return ApiResponse.success(response.data!, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '獲取深度失敗');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class TradeService {
|
||||
required String coinCode,
|
||||
required String price,
|
||||
required String quantity,
|
||||
int orderType = 1, // 1=市价单, 2=限价单
|
||||
}) async {
|
||||
return _client.post<Map<String, dynamic>>(
|
||||
ApiEndpoints.buy,
|
||||
@@ -21,6 +22,7 @@ class TradeService {
|
||||
'coinCode': coinCode,
|
||||
'price': price,
|
||||
'quantity': quantity,
|
||||
'orderType': orderType,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -30,6 +32,7 @@ class TradeService {
|
||||
required String coinCode,
|
||||
required String price,
|
||||
required String quantity,
|
||||
int orderType = 1, // 1=市价单, 2=限价单
|
||||
}) async {
|
||||
return _client.post<Map<String, dynamic>>(
|
||||
ApiEndpoints.sell,
|
||||
@@ -37,6 +40,7 @@ class TradeService {
|
||||
'coinCode': coinCode,
|
||||
'price': price,
|
||||
'quantity': quantity,
|
||||
'orderType': orderType,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -76,4 +80,12 @@ class TradeService {
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '獲取訂單詳情失敗');
|
||||
}
|
||||
|
||||
/// 撤销限价委托
|
||||
Future<ApiResponse<Map<String, dynamic>>> cancelOrder(String orderNo) async {
|
||||
return _client.post<Map<String, dynamic>>(
|
||||
ApiEndpoints.tradeCancel,
|
||||
data: {'orderNo': orderNo},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user