goko

package
v0.0.0-...-db5ea55 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 46
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL = "https://openapi.goko.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Asset     string  `json:"asset"`
	Total     float64 `json:"total"`
	Available float64 `json:"available"`
	Locked    float64 `json:"locked"`
}

********* Private API Structure*********

type Goko

type Goko 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 CreateGoko

func CreateGoko(config *exchange.Config) *Goko

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

func (*Goko) ApiKeyGet

func (e *Goko) ApiKeyGet(strRequestPath string, mapParams map[string]string) string

************** Signature Http Request ************** Method: API Get 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 (*Goko) ApiKeyRequest

func (e *Goko) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string

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

func (*Goko) CanDeposit

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

func (*Goko) CanWithdraw

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

func (*Goko) CancelAllOrder

func (e *Goko) CancelAllOrder() error

func (*Goko) CancelOrder

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

func (*Goko) DeleteCoin

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

func (*Goko) DeletePair

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

func (*Goko) DoAccountOperation

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

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

func (*Goko) GetBalance

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

func (*Goko) GetCoinBySymbol

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

func (*Goko) GetCoinConstraint

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

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

func (*Goko) GetCoins

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

func (*Goko) GetCoinsData

func (e *Goko) 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(strRequestPath)

func (*Goko) GetConfirmation

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

func (*Goko) GetConstraintFetchMethod

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

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

func (*Goko) GetFee

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

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

func (*Goko) GetID

func (e *Goko) GetID() int

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

func (*Goko) GetLotSize

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

func (*Goko) GetName

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

func (*Goko) GetPairBySymbol

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

func (*Goko) GetPairConstraint

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

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

func (*Goko) GetPairs

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

func (*Goko) GetPairsData

func (e *Goko) 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 (*Goko) GetPriceFilter

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

func (*Goko) GetSymbolByCoin

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

func (*Goko) GetSymbolByPair

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

func (*Goko) GetTradingWebURL

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

func (*Goko) GetTxFee

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

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

func (*Goko) HasPair

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

func (*Goko) InitData

func (e *Goko) InitData() error

func (*Goko) LimitBuy

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

func (*Goko) LimitSell

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

func (*Goko) ListOrders

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

func (*Goko) LoadPublicData

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

func (*Goko) OrderBook

func (e *Goko) OrderBook(p *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.GetSymbolByPair(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 (*Goko) OrderStatus

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

func (*Goko) SetCoinConstraint

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

func (*Goko) SetPairConstraint

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

func (*Goko) UpdateAllBalances

func (e *Goko) UpdateAllBalances()

func (*Goko) UpdateConstraint

func (e *Goko) UpdateConstraint()

func (*Goko) Withdraw

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

Withdraw(coin *coin.Coin, quantity float64, addr, tag string)

type JsonResponse

type JsonResponse struct {
	Code    string          `json:"code"`
	Msg     string          `json:"msg"`
	Message interface{}     `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Tick struct {
		Asks [][]float64 `json:"asks"`
		Bids [][]float64 `json:"bids"`
		Time interface{} `json:"time"`
	} `json:"tick"`
}

type PairsData

type PairsData []struct {
	Symbol          string `json:"symbol"`
	CountCoin       string `json:"count_coin"`
	AmountPrecision int    `json:"amount_precision"`
	BaseCoin        string `json:"base_coin"`
	PricePrecision  int    `json:"price_precision"`
}

********* Public API Structure*********

type PlaceOrder

type PlaceOrder struct {
	Symbol       string `json:"symbol"`
	OrderID      string `json:"orderId"`
	Side         string `json:"side"`
	Type         string `json:"type"`
	Price        string `json:"price"`
	AveragePrice string `json:"executedQty"`
	OrigQty      string `json:"origQty"`
	ExecutedQty  string `json:"executedQty"`
	Status       string `json:"status"`
	TimeInForce  string `json:"timeInForce"`
}

type WithdrawResponse

type WithdrawResponse struct {
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
	ID      string `json:"id"`
}

Jump to

Keyboard shortcuts

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