28 lines
735 B
Go
28 lines
735 B
Go
package usecase
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
"cryptoHermes/internal/entity"
|
|
)
|
|
|
|
const defaultCGLiqHeatMapLimit = 288
|
|
|
|
type CoinglassQueryUsecase struct {
|
|
liqHeatMapRepo CoinglassLiqHeatMapRepository
|
|
}
|
|
|
|
func NewCoinglassQueryUsecase(liqHeatMapRepo CoinglassLiqHeatMapRepository) *CoinglassQueryUsecase {
|
|
return &CoinglassQueryUsecase{liqHeatMapRepo: liqHeatMapRepo}
|
|
}
|
|
|
|
func (u *CoinglassQueryUsecase) GetLiqHeatMap(ctx context.Context, symbol, interval string, limit int) ([]entity.CGLiqHeatMap, error) {
|
|
symbol = strings.ToUpper(strings.TrimSpace(symbol))
|
|
symbol = strings.TrimPrefix(symbol, "BINANCE_")
|
|
if limit <= 0 {
|
|
limit = defaultCGLiqHeatMapLimit
|
|
}
|
|
return u.liqHeatMapRepo.FindRecent(ctx, symbol, interval, limit)
|
|
}
|