otcbtc

package
v0.0.0-...-5439e55 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 10
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://bb.otcbtc.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	UserName      string `json:"user_name"`
	Email         string `json:"email"`
	Icon          string `json:"icon"`
	OtbFeeEnabled bool   `json:"otb_fee_enabled"`
	Accounts      []struct {
		Currency string `json:"currency"`
		Balance  string `json:"balance"`
		Locked   string `json:"locked"`
		Saving   string `json:"saving"`
	} `json:"accounts"`
}

type ErrorResponse

type ErrorResponse struct {
	Error struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type OrderBook

type OrderBook struct {
	Timestamp int        `json:"timestamp"`
	Bids      [][]string `json:"bids"`
	Asks      [][]string `json:"asks"`
}

type Otcbtc

type Otcbtc struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateOtcbtc

func CreateOtcbtc(config *exchange.Config) *Otcbtc

*************************************************

func (*Otcbtc) ApiKeyGET

func (e *Otcbtc) ApiKeyGET(mapParams map[string]string, strRequestPath string) string

************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests

func (*Otcbtc) ApiKeyPost

func (e *Otcbtc) ApiKeyPost(strRequestPath string, mapParams map[string]string) string

func (*Otcbtc) CanDeposit

func (e *Otcbtc) CanDeposit(coin *coin.Coin) bool

func (*Otcbtc) CanWithdraw

func (e *Otcbtc) CanWithdraw(coin *coin.Coin) bool

func (*Otcbtc) CancelAllOrder

func (e *Otcbtc) CancelAllOrder() error

func (*Otcbtc) CancelOrder

func (e *Otcbtc) CancelOrder(order *exchange.Order) error

func (*Otcbtc) DeleteCoin

func (e *Otcbtc) DeleteCoin(coin *coin.Coin)

func (*Otcbtc) DeletePair

func (e *Otcbtc) DeletePair(pair *pair.Pair)

func (*Otcbtc) DoAccountOperation

func (e *Otcbtc) DoAccountOperation(operation *exchange.AccountOperation) error

************** Private API **************

func (*Otcbtc) GetBalance

func (e *Otcbtc) GetBalance(coin *coin.Coin) float64

func (*Otcbtc) GetCoinBySymbol

func (e *Otcbtc) GetCoinBySymbol(symbol string) *coin.Coin

func (*Otcbtc) GetCoinConstraint

func (e *Otcbtc) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint

************** Coins on the Exchanges **************

func (*Otcbtc) GetCoins

func (e *Otcbtc) GetCoins() []*coin.Coin

func (*Otcbtc) GetCoinsData

func (e *Otcbtc) GetCoinsData() error

************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Otcbtc) GetConfirmation

func (e *Otcbtc) GetConfirmation(coin *coin.Coin) int

func (*Otcbtc) GetConstraintFetchMethod

func (e *Otcbtc) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod

*************** Exchange Constraint ***************

func (*Otcbtc) GetFee

func (e *Otcbtc) GetFee(pair *pair.Pair) float64

*************** Pair Constraint ***************

func (*Otcbtc) GetID

func (e *Otcbtc) GetID() int

*************** Exchange Information ***************

func (*Otcbtc) GetLotSize

func (e *Otcbtc) GetLotSize(pair *pair.Pair) float64

func (*Otcbtc) GetName

func (e *Otcbtc) GetName() exchange.ExchangeName

func (*Otcbtc) GetPairBySymbol

func (e *Otcbtc) GetPairBySymbol(symbol string) *pair.Pair

func (*Otcbtc) GetPairConstraint

func (e *Otcbtc) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint

************** Pairs on the Exchanges **************

func (*Otcbtc) GetPairs

func (e *Otcbtc) GetPairs() []*pair.Pair

func (*Otcbtc) GetPairsData

func (e *Otcbtc) GetPairsData() error
GetPairsData - Get Pairs Information (If API provide)

Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Otcbtc) GetPriceFilter

func (e *Otcbtc) GetPriceFilter(pair *pair.Pair) float64

func (*Otcbtc) GetSymbolByCoin

func (e *Otcbtc) GetSymbolByCoin(coin *coin.Coin) string

func (*Otcbtc) GetSymbolByPair

func (e *Otcbtc) GetSymbolByPair(pair *pair.Pair) string

func (*Otcbtc) GetTradingWebURL

func (e *Otcbtc) GetTradingWebURL(pair *pair.Pair) string

func (*Otcbtc) GetTxFee

func (e *Otcbtc) GetTxFee(coin *coin.Coin) float64

*************** Coin Constraint ***************

func (*Otcbtc) HasPair

func (e *Otcbtc) HasPair(pair *pair.Pair) bool

func (*Otcbtc) InitData

func (e *Otcbtc) InitData() error

func (*Otcbtc) LimitBuy

func (e *Otcbtc) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Otcbtc) LimitSell

func (e *Otcbtc) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Otcbtc) ListOrders

func (e *Otcbtc) ListOrders() ([]*exchange.Order, error)

func (*Otcbtc) LoadPublicData

func (e *Otcbtc) LoadPublicData(operation *exchange.PublicOperation) error

func (*Otcbtc) OrderBook

func (e *Otcbtc) OrderBook(pair *pair.Pair) (*exchange.Maker, error)

Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct

func (*Otcbtc) OrderStatus

func (e *Otcbtc) OrderStatus(order *exchange.Order) error

func (*Otcbtc) SetCoinConstraint

func (e *Otcbtc) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)

func (*Otcbtc) SetPairConstraint

func (e *Otcbtc) SetPairConstraint(pairConstraint *exchange.PairConstraint)

func (*Otcbtc) UpdateAllBalances

func (e *Otcbtc) UpdateAllBalances()

func (*Otcbtc) UpdateConstraint

func (e *Otcbtc) UpdateConstraint()

func (*Otcbtc) Withdraw

func (e *Otcbtc) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool

type PairsData

type PairsData []struct {
	ID                 string  `json:"id"`
	TickerID           string  `json:"ticker_id"`
	Name               string  `json:"name"`
	MinimalTotalVolume float64 `json:"minimal_total_volume"`
	TradingRule        struct {
		MinAmount      float64 `json:"min_amount"`
		MinPrice       float64 `json:"min_price"`
		MinOrderVolume float64 `json:"min_order_volume"`
	} `json:"trading_rule"`
}

type PlaceOrder

type PlaceOrder struct {
	ID              int       `json:"id"`
	Side            string    `json:"side"`
	OrdType         string    `json:"ord_type"`
	Price           string    `json:"price"`
	AvgPrice        string    `json:"avg_price"`
	State           string    `json:"state"`
	Market          string    `json:"market"`
	CreatedAt       time.Time `json:"created_at"`
	Volume          string    `json:"volume"`
	RemainingVolume string    `json:"remaining_volume"`
	ExecutedVolume  string    `json:"executed_volume"`
	TradesCount     int       `json:"trades_count"`
}

Jump to

Keyboard shortcuts

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