2023-11-06 00:42:17 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
bybit "github.com/wuhewuhe/bybit.go.api"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
SwitchPositionMode()
|
|
|
|
}
|
|
|
|
|
|
|
|
func SwitchPositionMode() {
|
2023-11-06 18:29:28 +02:00
|
|
|
client := bybit.NewBybitHttpClient("YOUR_API_KEY", "YOUR_API_SECRET", bybit.WithBaseURL(bybit.TESTNET))
|
2023-11-06 00:42:17 +02:00
|
|
|
params := map[string]interface{}{"category": "linear", "coin": "USDT", "mode": 3}
|
|
|
|
orderResult, err := client.NewPositionService(params).SwitchPositionMode(context.Background())
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.Println(bybit.PrettyPrint(orderResult))
|
|
|
|
}
|