mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
35 lines
698 B
Go
35 lines
698 B
Go
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)
|
|
}
|