package yu_okx

import (
	"fmt"
	"testing"
	"time"
)

func TestV5Priapi(t *testing.T) {
	// for i := 0; i < 3; i++ {
	// 	go aaaaaaaa()
	// 	go bbbbbbbbb()
	// }
	aaa()
	// time.Sleep(time.Hour)
}

func aaa() {

	j_v5 := NewV5Priapi()
	defer j_v5.Close()
	j_v5.SetProxy("http://11597193:49e79ewq16we@47.242.149.180:10657")
	// j_v5.SetProxy("socks5://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	// j_v5.SetProxy("http://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	// fmt.Println(j_v5.EcotradePublicTrade_expert_rate("5", "1"))
	// fmt.Println(j_v5.EcotradePublicTrade_records("563E3A78CDBAFB4E", 0, 0, 0))

	// fmt.Println(j_v5.EcotradePublicAsset("563E3A78CDBAFB4E"))
	fmt.Println(j_v5.EcotradePublicAsset("D5E7A8430A35CA84"))
	fmt.Println(j_v5.EcotradePublicAsset("316EB79577E71F64"))

	// fmt.Println(j_v5.EcotradePublicPositions("563E3A78CDBAFB4E", 10, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicTrade_records("563E3A78CDBAFB4E", 10, 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("7C27B64E785275BA", 10, 0))

	// fmt.Println(j_v5.EcotradePublicHistory_positions("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("563E3A78CDBAFB4E", 0, 0))

	// fmt.Println(j_v5.EcotradePublicPosition_summary(InstType_SWAP, "032805718789399F"))
}

func aaaaaaaa() {

	j_v5 := NewV5Priapi()
	defer j_v5.Close()
	j_v5.SetProxy("http://11597193:49e79ewq16we@47.242.149.180:10657")
	// j_v5.SetProxy("socks5://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	j_v5.SetProxy("http://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	// fmt.Println(j_v5.EcotradePublicTrade_expert_rate("5", "1"))
	// fmt.Println(j_v5.EcotradePublicTrade_records("563E3A78CDBAFB4E", 0, 0, 0))

	// fmt.Println(j_v5.EcotradePublicAsset("563E3A78CDBAFB4E"))
	// fmt.Println(j_v5.EcotradePublicAsset("D5E7A8430A35CA84"))
	// fmt.Println(j_v5.EcotradePublicAsset("316EB79577E71F64"))

	// fmt.Println(j_v5.EcotradePublicPositions_v2("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("7C27B64E785275BA", 10, time.Now().UnixMilli())[0])
	for {
		j_data := j_v5.EcotradePublicPositions_v2("7C27B64E785275BA", 10, time.Now().UnixMilli())
		if len(j_data) == 0 {
			fmt.Println("aaaaaaaanil")
			continue
		}
		fmt.Println("aaaaaaaa", j_data[0])
		break
	}

	// fmt.Println(j_v5.EcotradePublicHistory_positions("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("316EB79577E71F64", 0, 0))

	// fmt.Println(j_v5.EcotradePublicPosition_summary(InstType_SWAP, "032805718789399F"))
}

func bbbbbbbbb() {

	j_v5 := NewV5Priapi()
	defer j_v5.Close()
	j_v5.SetProxy("http://11597193:49e79ewq16we@47.242.149.180:10657")
	// j_v5.SetProxy("socks5://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	j_v5.SetProxy("http://sub.dwdwdw-country-us:RNW78Fm5@proxy.haiwaiip.cn:1462")
	// fmt.Println(j_v5.EcotradePublicTrade_expert_rate("5", "1"))
	// fmt.Println(j_v5.EcotradePublicTrade_records("563E3A78CDBAFB4E", 0, 0, 0))

	// fmt.Println(j_v5.EcotradePublicAsset("563E3A78CDBAFB4E"))
	// fmt.Println(j_v5.EcotradePublicAsset("D5E7A8430A35CA84"))
	// fmt.Println(j_v5.EcotradePublicAsset("316EB79577E71F64"))

	// fmt.Println(j_v5.EcotradePublicPositions_v2("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicPositions_v2("7C27B64E785275BA", 10, time.Now().UnixMilli())[0])
	for {
		j_data := j_v5.EcotradePublicPositions("7C27B64E785275BA", 10, time.Now().UnixMilli())
		if len(j_data) == 0 {
			fmt.Println("bbbbbbbnil")
			continue
		}
		fmt.Println("bbbbbbbbbbbb", j_data[0])
		break
	}

	// fmt.Println(j_v5.EcotradePublicHistory_positions("563E3A78CDBAFB4E", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("D5E7A8430A35CA84", 0, 0))
	// fmt.Println(j_v5.EcotradePublicHistory_positions("316EB79577E71F64", 0, 0))

	// fmt.Println(j_v5.EcotradePublicPosition_summary(InstType_SWAP, "032805718789399F"))
}
