Goftx
FTX exchange golang library
Install / Use
/learn @grishinsana/GoftxREADME
goftx
FTX exchange golang library
Install
go get github.com/grishinsana/goftx
Usage
See examples directory and test cases for more examples
TODO
- Wallet
- Funding Payments
- Leveraged Tokens
- Options
- SRM Staking
REST
package main
import (
"fmt"
"net/http"
"time"
"github.com/grishinsana/goftx"
)
func main() {
client := goftx.New(
goftx.WithAuth("API-KEY", "API-SECRET"),
goftx.WithHTTPClient(&http.Client{
Timeout: 5 * time.Second,
}),
)
info, err := client.Account.GetAccountInformation()
if err != nil {
panic(err)
}
fmt.Println(info)
}
WebSocket
package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/grishinsana/goftx"
)
func main() {
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background())
client := goftx.New()
client.Stream.SetDebugMode(true)
data, err := client.Stream.SubscribeToTickers(ctx, "ETH/BTC")
if err != nil {
log.Fatalf("%+v", err)
}
go func() {
for {
select {
case <-ctx.Done():
return
case msg, ok := <-data:
if !ok {
return
}
log.Printf("%+v\n", msg)
}
}
}()
<-sigs
cancel()
time.Sleep(time.Second)
}
FTX US Mode
If you need to use FTX US than you could set goftx.WithFTXUS option
client := goftx.New(
goftx.WithFTXUS(),
)
Websocket Debug Mode
If need, it is possible to set debug mode to look error and system messages in stream methods
client := goftx.New()
client.Stream.SetDebugMode(true)
No Logged In Error
"Not logged in" errors usually come from a wrong signatures. FTX released an article on how to authenticate https://blog.ftx.com/blog/api-authentication/
If you have unauthorized error to private methods, then you need to use SetServerTimeDiff()
ftx := New()
ftx.SetServerTimeDiff()
Related Skills
canvas
337.3kCanvas Skill Display HTML content on connected OpenClaw nodes (Mac app, iOS, Android). Overview The canvas tool lets you present web content on any connected node's canvas view. Great for: -
gh-issues
337.3kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
337.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
337.3kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
