github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/examples/v1/orders/main.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/bitfinexcom/bitfinex-api-go/v1" 8 ) 9 10 // Set BFX_APIKEY and BFX_SECRET as : 11 // 12 // export BFX_API_KEY=YOUR_API_KEY 13 // export BFX_API_SECRET=YOUR_API_SECRET 14 // 15 // you can obtain it from https://www.bitfinex.com/api 16 17 // WARNING: IF YOU RUN THIS EXAMPLE WITH A VALID KEY ON PRODUCTION 18 // IT WILL SUBMIT AN ORDER ! 19 20 func main() { 21 key := os.Getenv("BFX_API_KEY") 22 secret := os.Getenv("BFX_API_SECRET") 23 client := bitfinex.NewClient().Auth(key, secret) 24 25 // Sell 0.01BTC at $12.000 26 data, err := client.Orders.Create(bitfinex.BTCUSD, -0.01, 12000, bitfinex.OrderTypeExchangeLimit) 27 28 if err != nil { 29 fmt.Println("Error:", err) 30 } else { 31 fmt.Println("Response:", data) 32 } 33 }