gobithumb

package module
v0.0.0-...-0fcdd15 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 16 Imported by: 0

README

goBithumb

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

해당 패키지에 대한 Issue 및 Pull requests, fork 는 언제든지 환영입니다!


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"
	ABT     Currency = "abt"
	ADA     Currency = "ada"
	ADD     Currency = "add"
	ADP     Currency = "adp"
	AE      Currency = "ae"
	AION    Currency = "aion"
	ALGO    Currency = "algo"
	AMO     Currency = "amo"
	ANKR    Currency = "ankr"
	ANV     Currency = "anv"
	ANW     Currency = "anw"
	AOA     Currency = "aoa"
	APIS    Currency = "apis"
	APIX    Currency = "apix"
	APM     Currency = "apm"
	ARN     Currency = "arn"
	ARPA    Currency = "arpa"
	ATD     Currency = "atd"
	ATOM    Currency = "atom"
	AUTO    Currency = "auto"
	AWO     Currency = "awo"
	BAL     Currency = "bal"
	BASIC   Currency = "basic"
	BAT     Currency = "bat"
	BCD     Currency = "bcd"
	BCH     Currency = "bch"
	BCHA    Currency = "bcha"
	BEL     Currency = "bel"
	BHP     Currency = "bhp"
	BHPC    Currency = "bhpc"
	BIOT    Currency = "biot"
	BLACK   Currency = "black"
	BLY     Currency = "bly"
	BNP     Currency = "bnp"
	BOA     Currency = "boa"
	BORA    Currency = "bora"
	BSV     Currency = "bsv"
	BTC     Currency = "btc"
	BTG     Currency = "btg"
	BTT     Currency = "btt"
	BXA     Currency = "bxa"
	BZNT    Currency = "bznt"
	CBK     Currency = "cbk"
	CENNZ   Currency = "cennz"
	CHL     Currency = "chl"
	CHR     Currency = "chr"
	CMT     Currency = "cmt"
	COMP    Currency = "comp"
	CON     Currency = "con"
	COS     Currency = "cos"
	COSM    Currency = "cosm"
	CRO     Currency = "cro"
	CTXC    Currency = "ctxc"
	CVC     Currency = "cvc"
	CVT     Currency = "cvt"
	DAC     Currency = "dac"
	DACC    Currency = "dacc"
	DAD     Currency = "dad"
	DASH    Currency = "dash"
	DOT     Currency = "dot"
	DVC     Currency = "dvc"
	DVP     Currency = "dvp"
	EGG     Currency = "egg"
	EL      Currency = "el"
	ELF     Currency = "elf"
	EM      Currency = "em"
	ENJ     Currency = "enj"
	EOS     Currency = "eos"
	EOSDAC  Currency = "eosdac"
	ETC     Currency = "etc"
	ETH     Currency = "eth"
	ETHOS   Currency = "ethos"
	ETZ     Currency = "etz"
	EVT369L Currency = "evt369l"
	EVZ     Currency = "evz"
	FAB     Currency = "fab"
	FCT     Currency = "fct"
	FIT     Currency = "fit"
	FLETA   Currency = "fleta"
	FNB     Currency = "fnb"
	FX      Currency = "fx"
	FZZ     Currency = "fzz"
	GLM     Currency = "glm"
	GOM2    Currency = "gom2"
	GRT     Currency = "grt"
	GTO     Currency = "gto"
	GXC     Currency = "gxc"
	HC      Currency = "hc"
	HDAC    Currency = "hdac"
	HIVE    Currency = "hive"
	HORUS   Currency = "horus"
	HSR     Currency = "hsr"
	HYC     Currency = "hyc"
	ICX     Currency = "icx"
	INS     Currency = "ins"
	IOST    Currency = "iost"
	IPX     Currency = "ipx"
	ITC     Currency = "itc"
	ITG     Currency = "itg"
	JST     Currency = "jst"
	KEOS    Currency = "keos"
	KKKK    Currency = "kkkk"
	KNC     Currency = "knc"
	LAMB    Currency = "lamb"
	LBA     Currency = "lba"
	LINK    Currency = "link"
	LOOM    Currency = "loom"
	LRC     Currency = "lrc"
	LTC     Currency = "ltc"
	LUNA    Currency = "luna"
	MAN     Currency = "man"
	MBL     Currency = "mbl"
	MCI     Currency = "mci"
	MCO     Currency = "mco"
	MEETONE Currency = "meetone"
	META    Currency = "meta"
	MIR     Currency = "mir"
	MITH    Currency = "mith"
	MIX     Currency = "mix"
	MLK     Currency = "mlk"
	MTL     Currency = "mtl"
	MVC     Currency = "mvc"
	MXC     Currency = "mxc"
	NEWS    Currency = "news"
	NPXS    Currency = "npxs"
	OBSR    Currency = "obsr"
	OCN     Currency = "ocn"
	OGO     Currency = "ogo"
	OMG     Currency = "omg"
	ONG     Currency = "ong"
	ONT     Currency = "ont"
	ONX     Currency = "onx"
	ORBS    Currency = "orbs"
	ORC     Currency = "orc"
	PAY     Currency = "pay"
	PCH     Currency = "pch"
	PCM     Currency = "pcm"
	PIVX    Currency = "pivx"
	PLX     Currency = "plx"
	POLA    Currency = "pola"
	POLY    Currency = "poly"
	POWR    Currency = "powr"
	PPT     Currency = "ppt"
	PST     Currency = "pst"
	QBZ     Currency = "qbz"
	QKC     Currency = "qkc"
	QTCON   Currency = "qtcon"
	QTUM    Currency = "qtum"
	RDN     Currency = "rdn"
	REN     Currency = "ren"
	REP     Currency = "rep"
	RINGX   Currency = "ringx"
	RNT     Currency = "rnt"
	ROM     Currency = "rom"
	SALT    Currency = "salt"
	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"
	VEN     Currency = "ven"
	VET     Currency = "vet"
	VSYS    Currency = "vsys"
	VTHO    Currency = "vtho"
	WAVES   Currency = "waves"
	WAXP    Currency = "waxp"
	WEMIX   Currency = "wemix"
	WET     Currency = "wet"
	WICC    Currency = "wicc"
	WIN     Currency = "win"
	WOM     Currency = "wom"
	WOZX    Currency = "wozx"
	WPX     Currency = "wpx"
	WTC     Currency = "wtc"
	XEM     Currency = "xem"
	XLM     Currency = "xlm"
	XMR     Currency = "xmr"
	XNO     Currency = "xno"
	XPR     Currency = "xpr"
	XRP     Currency = "xrp"
	XSR     Currency = "xsr"
	XTZ     Currency = "xtz"
	XVG     Currency = "xvg"
	YFI     Currency = "yfi"
	ZEC     Currency = "zec"
	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) ([]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