23 lines
610 B
Go
23 lines
610 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
bybit "github.com/wuhewuhe/bybit.go.api"
|
|
)
|
|
|
|
func main() {
|
|
PlaceTrade()
|
|
}
|
|
|
|
func PlaceTrade() {
|
|
client := bybit.NewBybitHttpClient("YOUR_API_KEY", "YOUR_API_SECRET", bybit.WithBaseURL(bybit.TESTNET))
|
|
params := map[string]interface{}{"category": "linear", "symbol": "BTCUSDT", "side": "Buy", "positionIdx": 0, "orderType": "Limit", "qty": "0.001", "price": "10000", "timeInForce": "GTC"}
|
|
orderResult, err := client.NewTradeService(params).PlaceOrder(context.Background())
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
fmt.Println(bybit.PrettyPrint(orderResult))
|
|
}
|