Path: blob/master/bitget-golang-sdk-api/test/apiclient_test.go
732 views
package test12import (3"bitget/internal"4"bitget/pkg/client"5"bitget/pkg/client/v1"6"fmt"7"testing"8)910func Test_PlaceOrder(t *testing.T) {11client := new(v1.MixOrderClient).Init()1213params := internal.NewParams()14params["symbol"] = "BTCUSDT_UMCBL"15params["marginCoin"] = "USDT"16params["side"] = "open_long"17params["orderType"] = "limit"18params["price"] = "27012"19params["size"] = "0.01"20params["timInForceValue"] = "normal"2122resp, err := client.PlaceOrder(params)23if err != nil {24println(err.Error())25}26fmt.Println(resp)27}2829func Test_post(t *testing.T) {30client := new(client.BitgetApiClient).Init()3132params := internal.NewParams()33params["symbol"] = "BTCUSDT_UMCBL"34params["marginCoin"] = "USDT"35params["side"] = "open_long"36params["orderType"] = "limit"37params["price"] = "27012"38params["size"] = "0.01"39params["timInForceValue"] = "normal"4041resp, err := client.Post("/api/mix/v1/order/placeOrder", params)42if err != nil {43println(err.Error())44}45fmt.Println(resp)46}4748func Test_get(t *testing.T) {49client := new(client.BitgetApiClient).Init()5051params := internal.NewParams()52params["productType"] = "umcbl"5354resp, err := client.Get("/api/mix/v1/account/accounts", params)55if err != nil {56println(err.Error())57}58fmt.Println(resp)59}6061func Test_get_with_params(t *testing.T) {62client := new(client.BitgetApiClient).Init()6364params := internal.NewParams()6566resp, err := client.Get("/api/spot/v1/account/getInfo", params)67if err != nil {68println(err.Error())69}70fmt.Println(resp)71}7273func Test_get_with_encode_params(t *testing.T) {74client := new(client.BitgetApiClient).Init()7576params := internal.NewParams()77params["symbol"] = "$AIUSDT"78params["businessType"] = "spot"7980resp, err := client.Get("/api/v2/common/trade-rate", params)81if err != nil {82println(err.Error())83}84fmt.Println(resp)85}868788