All Projects → grishinsana → goftx

grishinsana / goftx

Licence: MIT license
FTX exchange golang library

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to goftx

moon-doge
Buy DogeCoin automatically when Elon Musk tweet about it, and sell after profit
Stars: ✭ 20 (-28.57%)
Mutual labels:  ftx
cryptogalaxy
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.
Stars: ✭ 96 (+242.86%)
Mutual labels:  ftx
ftx-api-wrapper-python3
FTX Exchange API wrapper in python3
Stars: ✭ 31 (+10.71%)
Mutual labels:  ftx
FTX.Net
No description or website provided.
Stars: ✭ 31 (+10.71%)
Mutual labels:  ftx
ftx-php
PHP wrapper for FTX.com REST API
Stars: ✭ 17 (-39.29%)
Mutual labels:  ftx
MT5-TradingToolCrypto
All the tradingtools: crypto integration to metatrader including cryptobridgepro, crypto charts, paymentbot, indicators, robots are located here. Just download the zip folder, drag and drop into Metatrader 5 directory
Stars: ✭ 70 (+150%)
Mutual labels:  ftx
ftx-lending-bot
Renew lending amount on FTX
Stars: ✭ 55 (+96.43%)
Mutual labels:  ftx
ftx-keep-lending
FTX - lending all available balance(USD/USDT) per hour using crontab
Stars: ✭ 18 (-35.71%)
Mutual labels:  ftx
add-tradingview-alerts-tool
Automated entry of TradingView alerts for bot trading tools such as 3Commas, Alertatron, CryptoHopper, etc.
Stars: ✭ 467 (+1567.86%)
Mutual labels:  ftx

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()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].