import { get, post } from '../utils/request'

// 获取当前黄金价格
export function getCurrentGoldPrice(goldId = '1053') {
  return get('/gold-price/current', { goldId })
}

// 获取历史黄金价格
export function getGoldPriceHistory(goldId = '1053', days = 30) {
  return get('/gold-price/history', { goldId, days })
}

// 获取指定日期的黄金价格记录
export function getGoldPricesByDate(goldId = '1053', date) {
  return get('/gold-price/by-date', { goldId, date })
}

// 获取最近有数据的日期
export function getLatestGoldPriceDate(goldId = '1053') {
  return get('/gold-price/latest-date', { goldId })
}

// 立即刷新黄金价格
export function refreshGoldPrice(goldId = '1053') {
  return post('/gold-price/refresh?goldId=' + goldId, {})
}