feat: init coinank openapi http request framework (#1240)

This commit is contained in:
wqqqqqq
2025-12-17 10:22:02 +08:00
committed by GitHub
parent b169fcd3d2
commit 612e25db66
9 changed files with 344 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package coinank
import (
"context"
"encoding/json"
"nofx/provider/coinank/coinank_enum"
"testing"
)
func TestGetLastPrice(t *testing.T) {
client := NewCoinankClient(coinank_enum.MainUrl, TestApikey)
resp, err := client.GetLastPrice(context.TODO(), "BTCUSDT", "Binance", "SWAP")
if err != nil {
t.Error(err)
}
res, err := json.Marshal(resp)
if err != nil {
t.Error(err)
}
t.Logf("%s", res)
}
func TestGetCoinMarketCap(t *testing.T) {
client := NewCoinankClient(coinank_enum.MainUrl, TestApikey)
resp, err := client.GetCoinMarketCap(context.TODO(), "BTC")
if err != nil {
t.Error(err)
}
res, err := json.Marshal(resp)
if err != nil {
t.Error(err)
}
t.Logf("%s", res)
}