bithumb

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 39 Imported by: 0

README

GoCryptoTrader package Bithumb

Build Status Software License GoDoc Coverage Status Go Report Card

This bithumb package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Bithumb Exchange

Current Features
  • REST Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var b exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Bithumb" {
		b = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithdrawalFees = map[currency.Code]float64{
	currency.KRW:   1000,
	currency.BTC:   0.001,
	currency.ETH:   0.01,
	currency.DASH:  0.01,
	currency.LTC:   0.01,
	currency.ETC:   0.01,
	currency.XRP:   1,
	currency.BCH:   0.001,
	currency.XMR:   0.05,
	currency.ZEC:   0.001,
	currency.QTUM:  0.05,
	currency.BTG:   0.001,
	currency.ICX:   1,
	currency.TRX:   5,
	currency.ELF:   5,
	currency.MITH:  5,
	currency.MCO:   0.5,
	currency.OMG:   0.4,
	currency.KNC:   3,
	currency.GNT:   12,
	currency.HSR:   0.2,
	currency.ZIL:   30,
	currency.ETHOS: 2,
	currency.PAY:   2.4,
	currency.WAX:   5,
	currency.POWR:  5,
	currency.LRC:   10,
	currency.GTO:   15,
	currency.STEEM: 0.01,
	currency.STRAT: 0.2,
	currency.PPT:   0.5,
	currency.CTXC:  4,
	currency.CMT:   20,
	currency.THETA: 24,
	currency.WTC:   0.7,
	currency.ITC:   5,
	currency.TRUE:  4,
	currency.ABT:   5,
	currency.RNT:   20,
	currency.PLY:   20,
	currency.WAVES: 0.01,
	currency.LINK:  10,
	currency.ENJ:   35,
	currency.PST:   30,
}

WithdrawalFees the large list of predefined withdrawal fees Prone to change

Functions

This section is empty.

Types

type Account

type Account struct {
	Status string `json:"status"`
	Data   struct {
		Created   int64   `json:"created,string"`
		AccountID string  `json:"account_id"`
		TradeFee  float64 `json:"trade_fee,string"`
		Balance   float64 `json:"balance,string"`
	} `json:"data"`
	Message string `json:"message"`
}

Account holds account details

type ActionStatus

type ActionStatus struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

ActionStatus holds the return status

type Balance

type Balance struct {
	Status  string                 `json:"status"`
	Data    map[string]interface{} `json:"data"`
	Message string                 `json:"message"`
}

Balance holds balance details

type Bithumb

type Bithumb struct {
	exchange.Base
	// contains filtered or unexported fields
}

Bithumb is the overarching type across the Bithumb package

func (*Bithumb) CancelAllOrders

func (b *Bithumb) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Bithumb) CancelBatchOrders

func (b *Bithumb) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Bithumb) CancelOrder

func (b *Bithumb) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Bithumb) CancelTrade

func (b *Bithumb) CancelTrade(ctx context.Context, transactionType, orderID, currency string) (ActionStatus, error)

CancelTrade cancels a customer purchase/sales transaction transactionType: Transaction type(bid : purchase, ask : sales) orderID: Order number registered for purchase/sales currency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM, BTG, EOS (default value: BTC)

func (*Bithumb) FetchAccountInfo

func (b *Bithumb) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Bithumb) FetchExchangeLimits

func (b *Bithumb) FetchExchangeLimits(ctx context.Context) ([]order.MinMaxLevel, error)

FetchExchangeLimits fetches spot order execution limits

func (*Bithumb) FetchOrderbook

func (b *Bithumb) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Bithumb) FetchTicker

func (b *Bithumb) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Bithumb) FetchTradablePairs

func (b *Bithumb) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Bithumb) FormatExchangeKlineInterval

func (b *Bithumb) FormatExchangeKlineInterval(in kline.Interval) string

FormatExchangeKlineInterval returns Interval to exchange formatted string

func (*Bithumb) GenerateSubscriptions

func (b *Bithumb) GenerateSubscriptions() ([]subscription.Subscription, error)

GenerateSubscriptions generates the default subscription set

func (*Bithumb) GetAccountBalance

func (b *Bithumb) GetAccountBalance(ctx context.Context, c string) (FullBalance, error)

GetAccountBalance returns customer wallet information

func (*Bithumb) GetAccountFundingHistory

func (b *Bithumb) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Bithumb) GetAccountInformation

func (b *Bithumb) GetAccountInformation(ctx context.Context, orderCurrency, paymentCurrency string) (Account, error)

GetAccountInformation returns account information based on the desired order/payment currencies

func (*Bithumb) GetActiveOrders

func (b *Bithumb) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Bithumb) GetAllTickers

func (b *Bithumb) GetAllTickers(ctx context.Context) (map[string]Ticker, error)

GetAllTickers returns all ticker information

func (*Bithumb) GetAssetStatus

func (b *Bithumb) GetAssetStatus(ctx context.Context, symbol string) (*Status, error)

GetAssetStatus returns the withdrawal and deposit status for the symbol

func (*Bithumb) GetAssetStatusAll

func (b *Bithumb) GetAssetStatusAll(ctx context.Context) (*StatusAll, error)

GetAssetStatusAll returns the withdrawal and deposit status for all symbols

func (*Bithumb) GetCandleStick

func (b *Bithumb) GetCandleStick(ctx context.Context, symbol, interval string) (resp OHLCVResponse, err error)

GetCandleStick returns candle stick data for requested pair

func (*Bithumb) GetCurrencyTradeURL

func (b *Bithumb) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Bithumb) GetDepositAddress

func (b *Bithumb) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Bithumb) GetFee

func (b *Bithumb) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Bithumb) GetFeeByType

func (b *Bithumb) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Bithumb) GetFuturesContractDetails

func (b *Bithumb) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Bithumb) GetHistoricCandles

func (b *Bithumb) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Bithumb) GetHistoricCandlesExtended

func (b *Bithumb) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Bithumb) GetHistoricTrades

func (b *Bithumb) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Bithumb) GetLastTransaction

func (b *Bithumb) GetLastTransaction(ctx context.Context) (LastTransactionTicker, error)

GetLastTransaction returns customer last transaction

func (*Bithumb) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Bithumb) GetOrderBook

func (b *Bithumb) GetOrderBook(ctx context.Context, symbol string) (*Orderbook, error)

GetOrderBook returns current orderbook

symbol e.g. "btc"

func (*Bithumb) GetOrderDetails

func (b *Bithumb) GetOrderDetails(ctx context.Context, orderID, transactionType, currency string) (OrderDetails, error)

GetOrderDetails returns specific order details

orderID: Order number registered for purchase/sales transactionType: Transaction type(bid : purchase, ask : sales) currency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM, BTG, EOS (default value: BTC)

func (*Bithumb) GetOrderHistory

func (b *Bithumb) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Bithumb) GetOrderInfo

func (b *Bithumb) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, _ asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Bithumb) GetOrders

func (b *Bithumb) GetOrders(ctx context.Context, orderID, transactionType string, count int64, after time.Time, orderCurrency, paymentCurrency currency.Code) (Orders, error)

GetOrders returns order list

orderID: order number registered for purchase/sales transactionType: transaction type(bid : purchase, ask : sell) count: Value : 1 ~1000 (default : 100) after: YYYY-MM-DD hh:mm:ss's UNIX Timestamp (2014-11-28 16:40:01 = 1417160401000)

func (*Bithumb) GetRecentTrades

func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Bithumb) GetServerTime

func (b *Bithumb) GetServerTime(_ context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Bithumb) GetTicker

func (b *Bithumb) GetTicker(ctx context.Context, symbol string) (Ticker, error)

GetTicker returns ticker information

symbol e.g. "btc"

func (*Bithumb) GetTradablePairs

func (b *Bithumb) GetTradablePairs(ctx context.Context) ([]string, error)

GetTradablePairs returns a list of tradable currencies

func (*Bithumb) GetTransactionHistory

func (b *Bithumb) GetTransactionHistory(ctx context.Context, symbol string) (TransactionHistory, error)

GetTransactionHistory returns recent transactions

symbol e.g. "btc"

func (*Bithumb) GetUserTransactions

func (b *Bithumb) GetUserTransactions(ctx context.Context, offset, count, searchType int64, orderCurrency, paymentCurrency currency.Code) (UserTransactions, error)

GetUserTransactions returns customer transactions

func (*Bithumb) GetWalletAddress

func (b *Bithumb) GetWalletAddress(ctx context.Context, curr currency.Code) (WalletAddressRes, error)

GetWalletAddress returns customer wallet address

currency e.g. btc, ltc or "", will default to btc without currency specified

func (*Bithumb) GetWithdrawalsHistory

func (b *Bithumb) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Bithumb) MarketBuyOrder

func (b *Bithumb) MarketBuyOrder(ctx context.Context, pair currency.Pair, units float64) (MarketBuy, error)

MarketBuyOrder initiates a buy order through available order books

currency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM, BTG, EOS (default value: BTC) units: Order quantity

func (*Bithumb) MarketSellOrder

func (b *Bithumb) MarketSellOrder(ctx context.Context, pair currency.Pair, units float64) (MarketSell, error)

MarketSellOrder initiates a sell order through available order books

currency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM, BTG, EOS (default value: BTC) units: Order quantity

func (*Bithumb) ModifyOrder

func (b *Bithumb) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Bithumb) PlaceTrade

func (b *Bithumb) PlaceTrade(ctx context.Context, orderCurrency, transactionType string, units float64, price int64) (OrderPlace, error)

PlaceTrade executes a trade order

orderCurrency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM, BTG, EOS (default value: BTC) transactionType: Transaction type(bid : purchase, ask : sales) units: Order quantity price: Transaction amount per currency

func (*Bithumb) RequestKRWDepositDetails

func (b *Bithumb) RequestKRWDepositDetails(ctx context.Context) (KRWDeposit, error)

RequestKRWDepositDetails returns Bithumb banking details for deposit information

func (*Bithumb) RequestKRWWithdraw

func (b *Bithumb) RequestKRWWithdraw(ctx context.Context, bank, account string, price int64) (ActionStatus, error)

RequestKRWWithdraw allows a customer KRW withdrawal request

bank: Bankcode with bank name e.g. (bankcode)_(bankname) account: Withdrawing bank account number price: Withdrawing amount

func (*Bithumb) SeedLocalCache

func (b *Bithumb) SeedLocalCache(ctx context.Context, p currency.Pair) error

SeedLocalCache seeds depth data

func (*Bithumb) SeedLocalCacheWithBook

func (b *Bithumb) SeedLocalCacheWithBook(p currency.Pair, o *Orderbook) error

SeedLocalCacheWithBook seeds the local orderbook cache

func (*Bithumb) SendAuthenticatedHTTPRequest

func (b *Bithumb) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, path string, params url.Values, result interface{}) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to bithumb

func (*Bithumb) SendHTTPRequest

func (b *Bithumb) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Bithumb) SetDefaults

func (b *Bithumb) SetDefaults()

SetDefaults sets the basic defaults for Bithumb

func (*Bithumb) Setup

func (b *Bithumb) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Bithumb) SubmitOrder

func (b *Bithumb) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order TODO: Fill this out to support limit orders

func (*Bithumb) SubmitOrders added in v1.0.7

func (b *Bithumb) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

func (*Bithumb) Subscribe

func (b *Bithumb) Subscribe(channelsToSubscribe []subscription.Subscription) error

Subscribe subscribes to a set of channels

func (*Bithumb) SynchroniseWebsocketOrderbook

func (b *Bithumb) SynchroniseWebsocketOrderbook()

SynchroniseWebsocketOrderbook synchronises full orderbook for currency pair asset

func (*Bithumb) UpdateAccountInfo

func (b *Bithumb) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the Bithumb exchange

func (*Bithumb) UpdateCurrencyStates

func (b *Bithumb) UpdateCurrencyStates(ctx context.Context, a asset.Item) error

UpdateCurrencyStates updates currency states for exchange

func (*Bithumb) UpdateLocalBuffer

func (b *Bithumb) UpdateLocalBuffer(wsdp *WsOrderbooks) (bool, error)

UpdateLocalBuffer updates and returns the most recent iteration of the orderbook

func (*Bithumb) UpdateOrderExecutionLimits

func (b *Bithumb) UpdateOrderExecutionLimits(ctx context.Context, _ asset.Item) error

UpdateOrderExecutionLimits sets exchange executions for a required asset type

func (*Bithumb) UpdateOrderbook

func (b *Bithumb) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Bithumb) UpdateTicker

func (b *Bithumb) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Bithumb) UpdateTickers

func (b *Bithumb) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Bithumb) UpdateTradablePairs

func (b *Bithumb) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Bithumb) ValidateAPICredentials

func (b *Bithumb) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Bithumb) WithdrawCrypto

func (b *Bithumb) WithdrawCrypto(ctx context.Context, address, destination, currency string, units float64) (ActionStatus, error)

WithdrawCrypto withdraws a customer currency to an address

address: Currency withdrawing address destination: Currency withdrawal Destination Tag (when withdraw XRP) OR Currency withdrawal Payment ID (when withdraw XMR) currency: BTC, ETH, DASH, LTC, ETC, XRP, BCH, XMR, ZEC, QTUM (default value: BTC) units: Quantity to withdraw currency

func (*Bithumb) WithdrawCryptocurrencyFunds

func (b *Bithumb) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bithumb) WithdrawFiatFunds

func (b *Bithumb) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bithumb) WithdrawFiatFundsToInternationalBank

func (b *Bithumb) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank is not supported as Bithumb only withdraws KRW to South Korean banks

func (*Bithumb) WsConnect

func (b *Bithumb) WsConnect() error

WsConnect initiates a websocket connection

type FullBalance

type FullBalance struct {
	InUse     map[string]float64
	Misu      map[string]float64
	Total     map[string]float64
	Xcoin     map[string]float64
	Available map[string]float64
}

FullBalance defines a return type with full balance data

type KRWDeposit

type KRWDeposit struct {
	Status   string `json:"status"`
	Account  string `json:"account"`
	Bank     string `json:"bank"`
	BankUser string `json:"BankUser"`
	Message  string `json:"message"`
}

KRWDeposit resp type for a KRW deposit

type LastTransactionTicker

type LastTransactionTicker struct {
	Status string `json:"status"`
	Data   struct {
		OpeningPrice float64 `json:"opening_price,string"`
		ClosingPrice float64 `json:"closing_price,string"`
		MinPrice     float64 `json:"min_price,string"`
		MaxPrice     float64 `json:"max_price,string"`
		AveragePrice float64 `json:"average_price,string"`
		UnitsTraded  float64 `json:"units_traded,string"`
		Volume1Day   float64 `json:"volume_1day,string"`
		Volume7Day   float64 `json:"volume_7day,string"`
		BuyPrice     int64   `json:"buy_price,string"`
		SellPrice    int64   `json:"sell_price,string"`
		Date         int64   `json:"date,string"`
	} `json:"data"`
	Message string `json:"message"`
}

LastTransactionTicker holds customer last transaction information

type MarketBuy

type MarketBuy struct {
	Status  string `json:"status"`
	OrderID string `json:"order_id"`
	Data    []struct {
		ContID string  `json:"cont_id"`
		Units  float64 `json:"units,string"`
		Price  float64 `json:"price,string"`
		Total  float64 `json:"total,string"`
		Fee    float64 `json:"fee,string"`
	} `json:"data"`
	Message string `json:"message"`
}

MarketBuy holds market buy order information

type MarketSell

type MarketSell struct {
	Status  string `json:"status"`
	OrderID string `json:"order_id"`
	Data    []struct {
		ContID string  `json:"cont_id"`
		Units  float64 `json:"units,string"`
		Price  float64 `json:"price,string"`
		Total  float64 `json:"total,string"`
		Fee    float64 `json:"fee,string"`
	} `json:"data"`
	Message string `json:"message"`
}

MarketSell holds market buy order information

type OHLCVResponse

type OHLCVResponse struct {
	Status string           `json:"status"`
	Data   [][6]interface{} `json:"data"`
}

OHLCVResponse holds returned kline data

type OrderData

type OrderData struct {
	OrderID         string      `json:"order_id"`
	OrderCurrency   string      `json:"order_currency"`
	OrderDate       bithumbTime `json:"order_date"`
	PaymentCurrency string      `json:"payment_currency"`
	Type            string      `json:"type"`
	Status          string      `json:"status"`
	Units           float64     `json:"units,string"`
	UnitsRemaining  float64     `json:"units_remaining,string"`
	Price           float64     `json:"price,string"`
	Fee             float64     `json:"fee,string"`
	Total           float64     `json:"total,string"`
}

OrderData contains all individual order details

type OrderDetails

type OrderDetails struct {
	Status string `json:"status"`
	Data   []struct {
		TransactionDate int64   `json:"transaction_date,string"`
		Type            string  `json:"type"`
		OrderCurrency   string  `json:"order_currency"`
		PaymentCurrency string  `json:"payment_currency"`
		UnitsTraded     float64 `json:"units_traded,string"`
		Price           float64 `json:"price,string"`
		Total           float64 `json:"total,string"`
	} `json:"data"`
	Message string `json:"message"`
}

OrderDetails contains specific order information

type OrderPlace

type OrderPlace struct {
	Status string `json:"status"`
	Data   []struct {
		ContID string  `json:"cont_id"`
		Units  float64 `json:"units,string"`
		Price  float64 `json:"price,string"`
		Total  float64 `json:"total,string"`
		Fee    float64 `json:"fee,string"`
	} `json:"data"`
	Message string `json:"message"`
}

OrderPlace contains order information

type Orderbook

type Orderbook struct {
	Status string `json:"status"`
	Data   struct {
		Timestamp       int64  `json:"timestamp,string"`
		OrderCurrency   string `json:"order_currency"`
		PaymentCurrency string `json:"payment_currency"`
		Bids            []struct {
			Quantity float64 `json:"quantity,string"`
			Price    float64 `json:"price,string"`
		} `json:"bids"`
		Asks []struct {
			Quantity float64 `json:"quantity,string"`
			Price    float64 `json:"price,string"`
		} `json:"asks"`
	} `json:"data"`
	Message string `json:"message"`
}

Orderbook holds full range of order book information

type Orders

type Orders struct {
	Status  string      `json:"status"`
	Data    []OrderData `json:"data"`
	Message string      `json:"message"`
}

Orders contains information about your current orders

type RateLimit

type RateLimit struct {
	Auth   *rate.Limiter
	UnAuth *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit limits requests

type Status

type Status struct {
	Status string `json:"status"`
	Data   struct {
		DepositStatus    int64 `json:"deposit_status"`
		WithdrawalStatus int64 `json:"withdrawal_status"`
	} `json:"data"`
	Message string `json:"message"`
}

Status defines the current exchange allowance to deposit or withdraw a currency

type StatusAll

type StatusAll struct {
	Status string `json:"status"`
	Data   map[string]struct {
		DepositStatus    int64 `json:"deposit_status"`
		WithdrawalStatus int64 `json:"withdrawal_status"`
	} `json:"data"`
	Message string `json:"message"`
}

StatusAll defines the current exchange allowance to deposit or withdraw a currency

type Ticker

type Ticker struct {
	OpeningPrice              float64 `json:"opening_price,string"`
	ClosingPrice              float64 `json:"closing_price,string"`
	MinPrice                  float64 `json:"min_price,string"`
	MaxPrice                  float64 `json:"max_price,string"`
	UnitsTraded               float64 `json:"units_traded,string"`
	AccumulatedTradeValue     float64 `json:"acc_trade_value,string"`
	PreviousClosingPrice      float64 `json:"prev_closing_price,string"`
	UnitsTraded24Hr           float64 `json:"units_traded_24H,string"`
	AccumulatedTradeValue24hr float64 `json:"acc_trade_value_24H,string"`
	Fluctuate24Hr             float64 `json:"fluctate_24H,string"`
	FluctuateRate24hr         float64 `json:"fluctate_rate_24H,string"`
	Date                      int64   `json:"date,string"`
}

Ticker holds ticker data

type TickerResponse

type TickerResponse struct {
	Status  string `json:"status"`
	Data    Ticker `json:"data"`
	Message string `json:"message"`
}

TickerResponse holds the standard ticker response

type TickersResponse

type TickersResponse struct {
	Status  string                     `json:"status"`
	Data    map[string]json.RawMessage `json:"data"`
	Message string                     `json:"message"`
}

TickersResponse holds the standard ticker response

type TransactionHistory

type TransactionHistory struct {
	Status string `json:"status"`
	Data   []struct {
		ContNumber      int64   `json:"cont_no,string"`
		TransactionDate string  `json:"transaction_date"`
		Type            string  `json:"type"`
		UnitsTraded     float64 `json:"units_traded,string"`
		Price           float64 `json:"price,string"`
		Total           float64 `json:"total,string"`
	} `json:"data"`
	Message string `json:"message"`
}

TransactionHistory holds history of completed transaction data

type UserTransactions

type UserTransactions struct {
	Status string `json:"status"`
	Data   []struct {
		Search          int64         `json:"search,string"`
		TransferDate    int64         `json:"transfer_date"`
		OrderCurrency   currency.Code `json:"order_currency"`
		PaymentCurrency currency.Code `json:"payment_currency"`
		Units           float64       `json:"units,string"`
		Price           float64       `json:"price,string"`
		Amount          float64       `json:"amount,string"`
		FeeCurrency     currency.Code `json:"fee_currency"`
		Fee             float64       `json:"fee,string"`
		OrderBalance    float64       `json:"order_balance,string"`
		PaymentBalance  float64       `json:"payment_balance,string"`
	} `json:"data"`
	Message string `json:"message"`
}

UserTransactions holds users full transaction list

type WalletAddressRes

type WalletAddressRes struct {
	Status string `json:"status"`
	Data   struct {
		WalletAddress string `json:"wallet_address"`
		Tag           string // custom field we populate
		Currency      string `json:"currency"`
	} `json:"data"`
	Message string `json:"message"`
}

WalletAddressRes contains wallet address information

type WsOrderbook

type WsOrderbook struct {
	Symbol    currency.Pair `json:"symbol"`
	OrderSide string        `json:"orderType"`
	Price     float64       `json:"price,string"`
	Quantity  float64       `json:"quantity,string"`
	Total     int32         `json:"total,string"`
}

WsOrderbook defines a singular orderbook tranche

type WsOrderbooks

type WsOrderbooks struct {
	List     []WsOrderbook `json:"list"`
	DateTime bithumbTime   `json:"datetime"`
}

WsOrderbooks defines an amalgamated bid ask orderbook tranche list

type WsResponse

type WsResponse struct {
	Status          string          `json:"status"`
	ResponseMessage string          `json:"resmsg"`
	Type            string          `json:"type"`
	Content         json.RawMessage `json:"content"`
}

WsResponse is a generalised response data structure which will defer unmarshalling of different contents.

type WsSubscribe

type WsSubscribe struct {
	Type      string          `json:"type"`
	Symbols   []currency.Pair `json:"symbols"`
	TickTypes []string        `json:"tickTypes,omitempty"`
}

WsSubscribe is used to subscribe to the ws channel.

type WsTicker

type WsTicker struct {
	Symbol             currency.Pair `json:"symbol"`
	TickType           string        `json:"tickType"`
	Date               string        `json:"date"`
	Time               string        `json:"time"`
	OpenPrice          float64       `json:"openPrice,string"`
	ClosePrice         float64       `json:"closePrice,string"`
	LowPrice           float64       `json:"lowPrice,string"`
	HighPrice          float64       `json:"highPrice,string"`
	Value              float64       `json:"value,string"`
	Volume             float64       `json:"volume,string"`
	SellVolume         float64       `json:"sellVolume,string"`
	BuyVolume          float64       `json:"buyVolume,string"`
	PreviousClosePrice float64       `json:"prevClosePrice,string"`
	ChangeRate         float64       `json:"chgRate,string"`
	ChangeAmount       float64       `json:"chgAmt,string"`
	VolumePower        float64       `json:"volumePower,string"`
}

WsTicker defines a websocket ticker

type WsTransaction

type WsTransaction struct {
	Symbol           currency.Pair `json:"symbol"`
	BuySell          int32         `json:"buySellGb,string"` // 1: Sell 2: Buy
	ContractPrice    float64       `json:"contPrice,string"`
	ContractQuantity float64       `json:"contQty,string"`
	ContractAmount   float64       `json:"contAmt,string"`
	ContractTime     string        `json:"contDtm"` // 2020-01-29 12:24:18.830039
	UpOrDown         string        `json:"updn"`
}

WsTransaction defines a trade that has executed via their matching engine

type WsTransactions

type WsTransactions struct {
	List []WsTransaction `json:"list"`
}

WsTransactions defines a transaction list

Jump to

Keyboard shortcuts

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