gobithumb

package module
v0.0.0-...-12f97bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 16 Imported by: 0

README

goBithumb

Go용 Bithumb API 클라이언트 프로그램입니다. (Bithumb API Client for Golang)

Requirements

  • Go (version 1.15.6 이상)

How to Use

  • 라이브러리 Download
user@ubuntu:~$ go get github.com/lutergs/gobithumb
  • 라이브러리 Import
import(
	b "github.com/lutergs/gobithumb"
)
  • 라이브러리 Init
    BithumbClient := b.NewBithumb("YOUR CONNECT KEY", "YOUR SECRET KEY")
  • 라이브러리 사용 예제
    // Public API 사용 예시
    ticker, reqTime, err := BithumbClient.GetTicker(b.BTC, b.KRW)
    if err != nil{
        panic(err)	
    }
    
    // Private API 사용 예시
    buyId, err := BithumbClient.MarketBuy(b.BTC, b.KRW, 0.0002)
    if err != nil{
        panic(err)	
    }
    orderStatus, err := BithumbClient.GetOrderDetail(b.BTC, b.KRW, buyId)
    if err != nil{
        panic(err)	
    }
    fmt.Println("buy process : ", orderStatus)

Docs

여기 를 참고

Documentation

Index

Constants

View Source
const (
	AAVE  Currency = "aave"
	ADA   Currency = "ada"
	ADP   Currency = "adp"
	AION  Currency = "aion"
	ALGO  Currency = "algo"
	AMO   Currency = "amo"
	ANKR  Currency = "ankr"
	ANV   Currency = "anv"
	ANW   Currency = "anw"
	APIX  Currency = "apix"
	APM   Currency = "apm"
	ARPA  Currency = "arpa"
	ATOM  Currency = "atom"
	AWO   Currency = "awo"
	BAL   Currency = "bal"
	BASIC Currency = "basic"
	BAT   Currency = "bat"
	BCD   Currency = "bcd"
	BCH   Currency = "bch"
	BEL   Currency = "bel"
	BIOT  Currency = "biot"
	BLY   Currency = "bly"
	BOA   Currency = "boa"
	BORA  Currency = "bora"
	BSV   Currency = "bsv"
	BTC   Currency = "btc"
	BTG   Currency = "btg"
	BTT   Currency = "btt"
	CENNZ Currency = "cennz"
	CHR   Currency = "chr"
	COMP  Currency = "comp"
	CON   Currency = "con"
	COS   Currency = "cos"
	CRO   Currency = "cro"
	CTXC  Currency = "ctxc"
	DAD   Currency = "dad"
	DOT   Currency = "dot"
	EGG   Currency = "egg"
	EL    Currency = "el"
	ELF   Currency = "elf"
	ENJ   Currency = "enj"
	EOS   Currency = "eos"
	ETC   Currency = "etc"
	ETH   Currency = "eth"
	ETHOS Currency = "ethos"
	EVZ   Currency = "evz"
	FCT   Currency = "fct"
	FIT   Currency = "fit"
	FLETA Currency = "fleta"
	FX    Currency = "fx"
	GLM   Currency = "glm"
	GOM2  Currency = "gom2"
	GRT   Currency = "grt"
	GXC   Currency = "gxc"
	HIVE  Currency = "hive"
	ICX   Currency = "icx"
	IOST  Currency = "iost"
	IPX   Currency = "ipx"
	JST   Currency = "jst"
	KNC   Currency = "knc"
	LINK  Currency = "link"
	LOOM  Currency = "loom"
	LRC   Currency = "lrc"
	LTC   Currency = "ltc"
	LUNA  Currency = "luna"
	MBL   Currency = "mbl"
	META  Currency = "meta"
	MIR   Currency = "mir"
	MIX   Currency = "mix"
	MLK   Currency = "mlk"
	MTL   Currency = "mtl"
	MVC   Currency = "mvc"
	MXC   Currency = "mxc"
	OBSR  Currency = "obsr"
	OMG   Currency = "omg"
	ONG   Currency = "ong"
	ONT   Currency = "ont"
	ORBS  Currency = "orbs"
	ORC   Currency = "orc"
	POLA  Currency = "pola"
	POWR  Currency = "powr"
	QKC   Currency = "qkc"
	QTCON Currency = "qtcon"
	QTUM  Currency = "qtum"
	REN   Currency = "ren"
	REP   Currency = "rep"
	RINGX Currency = "ringx"
	SAND  Currency = "sand"
	SNT   Currency = "snt"
	SNX   Currency = "snx"
	SOC   Currency = "soc"
	SRM   Currency = "srm"
	SSX   Currency = "ssx"
	STEEM Currency = "steem"
	STRAX Currency = "strax"
	SUN   Currency = "sun"
	SXP   Currency = "sxp"
	TEMCO Currency = "temco"
	TFUEL Currency = "tfuel"
	THETA Currency = "theta"
	TMTG  Currency = "tmtg"
	TRUE  Currency = "true"
	TRV   Currency = "trv"
	TRX   Currency = "trx"
	UMA   Currency = "uma"
	UNI   Currency = "uni"
	VALOR Currency = "valor"
	VET   Currency = "vet"
	VSYS  Currency = "vsys"
	WAVES Currency = "waves"
	WAXP  Currency = "waxp"
	WEMIX Currency = "wemix"
	WICC  Currency = "wicc"
	WOM   Currency = "wom"
	WOZX  Currency = "wozx"
	WTC   Currency = "wtc"
	XEM   Currency = "xem"
	XLM   Currency = "xlm"
	XNO   Currency = "xno"
	XPR   Currency = "xpr"
	XRP   Currency = "xrp"
	XTZ   Currency = "xtz"
	YFI   Currency = "yfi"
	ZIL   Currency = "zil"
	ZRX   Currency = "zrx"

	KRW Currency = "krw"
	ALL Currency = "all" // -> 어떻게 짤 것인지 생각해봐야 함

	Min1   TimeInterval = "1m"
	Min3   TimeInterval = "3m"
	Min5   TimeInterval = "5m"
	Min10  TimeInterval = "10m"
	Min30  TimeInterval = "30m"
	Hour1  TimeInterval = "1h"
	Hour6  TimeInterval = "6h"
	Hour12 TimeInterval = "12h"
	Hour24 TimeInterval = "24h"

	All          SearchType = "0"
	BuyComplete  SearchType = "1"
	SellComplete SearchType = "2"
	InWidrawal   SearchType = "3"
	Deposit      SearchType = "4"
	Withdraw     SearchType = "5"
	InKRWDeposit SearchType = "9"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       string
	Created  time.Time
	Balance  float64
	TradeFee float64
}

type BTCI

type BTCI struct {
	BTAI BT_I
	BTMI BT_I
}

type BT_I

type BT_I struct {
	MarketIndex float64
	Rate        float64
	Width       float64
}

type Balance

type Balance struct {
	Total     float64
	InUse     float64
	Available float64
	XCoinLast float64
}

type Bidask

type Bidask struct {
	Price    float64
	Quantity float64
}

type BithumbRequester

type BithumbRequester struct {
	// contains filtered or unexported fields
}

func NewBithumb

func NewBithumb(connectKey string, secretKey string) *BithumbRequester

func (*BithumbRequester) CancelOrder

func (b *BithumbRequester) CancelOrder(orderCurrency Currency, paymentCurrency Currency, orderId string, order string) error

func (*BithumbRequester) GetAccount

func (b *BithumbRequester) GetAccount(orderCurrency Currency, paymentCurrency Currency) (Account, error)

func (*BithumbRequester) GetAssetsStatus

func (b *BithumbRequester) GetAssetsStatus(orderCurrency Currency) (bool, bool, error)

func (*BithumbRequester) GetBTCI

func (b *BithumbRequester) GetBTCI() (BTCI, time.Time, error)

func (*BithumbRequester) GetBalance

func (b *BithumbRequester) GetBalance(orderCurrency Currency) (map[Currency]*Balance, error)

func (*BithumbRequester) GetCandleStick

func (b *BithumbRequester) GetCandleStick(orderCurreny Currency, paymentCurrency Currency, chartInterval TimeInterval) ([]OneCandleStick, error)

func (*BithumbRequester) GetOrder

func (b *BithumbRequester) GetOrder(orderCurrency Currency, paymentCurrency Currency, count int, date ...time.Time) ([]Order, error)

-> date에 값이 들어올 경우, 최측 하나만 사용

func (*BithumbRequester) GetOrderDetail

func (b *BithumbRequester) GetOrderDetail(orderCurrency Currency, paymentCurrency Currency, orderId string) (OrderDetail, error)

func (*BithumbRequester) GetOrderbook

func (b *BithumbRequester) GetOrderbook(orderCurrency Currency, paymentCurrency Currency) (map[Currency]Orderbook, time.Time, error)

func (*BithumbRequester) GetTicker

func (b *BithumbRequester) GetTicker(orderCurrency Currency, paymentCurrency Currency) (map[Currency]Ticker, time.Time, error)

func (*BithumbRequester) GetTradableCoinList

func (b *BithumbRequester) GetTradableCoinList() []Currency

func (*BithumbRequester) GetTransactionHistory

func (b *BithumbRequester) GetTransactionHistory(orderCurrency Currency, paymentCurrency Currency, count int) ([]OneTransaction, error)

func (*BithumbRequester) GetTransactions

func (b *BithumbRequester) GetTransactions(orderCurrency Currency, paymentCurrency Currency, search SearchType, offset_count ...int) ([]Transaction, error)

func (*BithumbRequester) GetUserTicker

func (b *BithumbRequester) GetUserTicker(orderCurrency Currency, paymentCurrency Currency) (UserTicker, error)

func (*BithumbRequester) GetWalletAddress

func (b *BithumbRequester) GetWalletAddress(orderCurrency Currency) (string, error)

TODO : Docs 쓸 때, 만약 주소가 없으면 정상 처리는 되나 아무 값도 리턴하지 않는다고 서술해야함.

func (*BithumbRequester) MarketBuy

func (b *BithumbRequester) MarketBuy(orderCurrency Currency, paymentCurrency Currency, amount float64) (string, error)

func (*BithumbRequester) MarketSell

func (b *BithumbRequester) MarketSell(orderCurrency Currency, paymentCurrency Currency, amount float64) (string, error)

func (*BithumbRequester) PlaceOrder

func (b *BithumbRequester) PlaceOrder(orderCurrency Currency, paymentCurrency Currency, amount float64, price float64, order string) (string, error)

func (*BithumbRequester) StopLimit

func (b *BithumbRequester) StopLimit(orderCurrency Currency, paymentCurrency Currency, watchPrice float64, price float64, amount float64, order string) (string, error)

func (*BithumbRequester) WithDrawCoin

func (b *BithumbRequester) WithDrawCoin(orderCurrency Currency, amount float64, address string, destination ...interface{}) error

func (*BithumbRequester) WithdrawKRW

func (b *BithumbRequester) WithdrawKRW(account string, price int) error

type Currency

type Currency string

func COIN_ALL

func COIN_ALL() []Currency

type OneCandleStick

type OneCandleStick struct {
	Time         time.Time
	OpeningPrice float64
	ClosingPrice float64
	HighPrice    float64
	LowPrice     float64
	UnitsTraded  float64
}

type OneTransaction

type OneTransaction struct {
	TransactionDate time.Time
	Type            string
	UnitsTraded     float64
	Price           float64
	Total           float64
}

type Order

type Order struct {
	OrderDate       time.Time
	OrderCurrency   Currency
	PaymentCurrency Currency
	OrderID         string
	Price           float64
	Type            string
	Units           float64
	UnitsRemaining  float64
	WatchPrice      float64
}

type OrderDetail

type OrderDetail struct {
	OrderDate       time.Time
	Type            string
	OrderStatus     string
	OrderCurrency   Currency
	PaymentCurrency Currency
	OrderPrice      float64
	OrderQty        float64
	CancelDate      time.Time
	CancelType      string
	Contract        []SingleOrderDetail
}

type Orderbook

type Orderbook struct {
	Bids []Bidask
	Asks []Bidask
}

type RawCandleStick

type RawCandleStick struct {
	Status  int    `json:"status,string"`
	Message string `json:"message"`
	Data    [][]interface{}
}

type SearchType

type SearchType string

type SingleOrderDetail

type SingleOrderDetail struct {
	TransactionDate time.Time
	Price           float64
	Units           float64
	FeeCurrency     Currency
	Fee             float64
	Total           float64
}

type Ticker

type Ticker struct {
	OpeningPrice     float64
	ClosingPrice     float64
	MinPrice         float64
	MaxPrice         float64
	UnitsTraded      float64
	AccTradeValue    float64
	PrevClosingPrice float64
	UnitsTraded24H   float64
	AccTradeValue24H float64
	Fluctate24H      float64
	FluctateRate24H  float64
}

type TimeInterval

type TimeInterval string

type Transaction

type Transaction struct {
	Search          SearchType
	TransferDate    time.Time
	OrderCurrency   Currency
	PaymentCurrency Currency
	Units           float64
	Price           float64
	Amount          float64
	FeeCurrency     Currency
	Fee             float64
	OrderBalance    float64
	PaymentBalance  float64
}

type UserTicker

type UserTicker struct {
	OpeningPrice    float64
	ClosingPrice    float64
	AveragePrice    float64
	MaxPrice        float64
	MinPrice        float64
	UnitsTraded     float64
	Volume1Day      float64
	Volume7Day      float64
	Fluctate24H     float64
	FluctateRate24H float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL