hyperliquid-sdk icon indicating copy to clipboard operation
hyperliquid-sdk copied to clipboard

fetching candles from 10 days ago returns empty

Open catplanet007 opened this issue 9 months ago • 2 comments

package main

import (
	"fmt"
	"os"
	"time"

	"github.com/quiknode-labs/hyperliquid-sdk/go/hyperliquid"
)

func main() {

	endpoint := "https://x.quiknode.pro/TOKEN"

	sdk, err := hyperliquid.New(endpoint, hyperliquid.WithPrivateKey(os.Getenv("PRIVATE_KEY")))
	if err != nil {
		panic(err)
	}

	info := sdk.Info()
	start := time.Now().Truncate(time.Hour).UnixMilli() - 10*24*3600*1000
	end := start + 3600*1000
	res, err := info.Candles("BTC", "1m", int64(start), int64(end))
	if err != nil {
		panic(err)
	}
	fmt.Printf("res: %v\n", res) // output: res: []
}

catplanet007 avatar Mar 04 '26 06:03 catplanet007

Hey! Thanks for reaching out:

Only the most recent 5000 candles are available

Supported intervals: "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "8h", "12h", "1d", "3d", "1w", "1M"

I will improve the UX so its an easier experience, I tried our API on our side and we were able to return all the supported intervals, same as the public endpoint docs

Let me know if any additional questions, I am happy to support 🫡

yaanakbr avatar Mar 04 '26 16:03 yaanakbr

Maybe this unofficial SDK can provide more features beyond the official API, like in the form of a plugin? Or some enhanced features? @yaanakbr

catplanet007 avatar Mar 05 '26 02:03 catplanet007