2025-08-04 14:02:01 +00:00
|
|
|
|
package usecase
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DataSourceUseCase interface {
|
|
|
|
|
GetSymbols(ctx context.Context) ([]*Symbol, error)
|
2025-08-06 23:41:18 +00:00
|
|
|
|
UpsertKline(ctx context.Context, data QueryKline) error
|
2025-08-04 14:02:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Symbol 代表交易對資訊
|
|
|
|
|
type Symbol struct {
|
|
|
|
|
Symbol string `json:"symbol"` // 交易對名稱 (BTCUSDT)
|
|
|
|
|
Status string `json:"status"` // 狀態(如 "TRADING" 表示可交易)
|
|
|
|
|
BaseAsset string `json:"base_asset"` // 主幣種(如 BTCUSDT 的 BTC)
|
|
|
|
|
BaseAssetPrecision int `json:"base_asset_precision"` // 主幣的小數點精度
|
|
|
|
|
QuoteAsset string `json:"quote_asset"` // 報價幣種(如 BTCUSDT 的 USDT)
|
|
|
|
|
QuoteAssetPrecision int `json:"quote_asset_precision"` // 報價資產顯示的小數位數
|
|
|
|
|
}
|
2025-08-06 23:41:18 +00:00
|
|
|
|
|
|
|
|
|
type QueryKline struct {
|
|
|
|
|
Symbol string
|
|
|
|
|
Interval string
|
|
|
|
|
StartUnixNano int64
|
|
|
|
|
EndUnixNano int64
|
|
|
|
|
}
|