Files
monisuo/app/api/trade.uts

40 lines
1005 B
Plaintext
Raw Normal View History

/**
* 交易API
*/
import { get, post } from './request.uts'
/**
* 买入
*/
export func buy (coinCode: string, price: string, quantity: string): Promise<any> {
return post('/api/trade/buy', { coinCode, price, quantity } as UTSJSONObject)
}
/**
* 卖出
*/
export func sell (coinCode: string, price: string, quantity: string): Promise<any> {
return post('/api/trade/sell', { coinCode, price, quantity } as UTSJSONObject)
}
/**
* 获取交易记录
*/
export func getOrders (coinCode: string | null, direction: number | null, pageNum: number, pageSize: number): Promise<any> {
const params: UTSJSONObject = { pageNum: pageNum, pageSize: pageSize }
if (coinCode !== null) {
params['coinCode'] = coinCode
}
if (direction !== null) {
params['direction'] = direction
}
return get('/api/trade/orders', params)
}
/**
* 获取订单详情
*/
export func getOrderDetail (orderNo: string): Promise<any> {
return get('/api/trade/order/detail', { orderNo } as UTSJSONObject)
}