tokok

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           = 23
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.002
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://www.tokok.com/api/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	HotMoney  string `json:"hotMoney"`
	ColdMoney string `json:"coldMoney"`
	CoinCode  string `json:"coinCode"`
}

type CancelOrder

type CancelOrder struct {
	Result bool `json:"result"`
	Code   int  `json:"code"`
}

type JsonResponse

type JsonResponse struct {
	Result bool            `json:"result"`
	Code   int             `json:"code"`
	Data   json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Bids [][]interface{} `json:"bids"`
	Asks [][]interface{} `json:"asks"`
}

type OrderStatus

type OrderStatus struct {
	EntrustNum          string `json:"entrustNum"`
	Type                int    `json:"type"`
	Status              int    `json:"status"`
	EntrustPrice        string `json:"entrustPrice"`
	EntrustCount        string `json:"entrustCount"`
	EntrustSum          string `json:"entrustSum"`
	SurplusEntrustCount string `json:"surplusEntrustCount"`
	EntrustTimeLong     int64  `json:"entrustTime_long"`
	TransactionFee      string `json:"transactionFee"`
	ProcessedPrice      string `json:"processedPrice"`
	OpenTokFee          int    `json:"openTokFee"`
	Symbol              string `json:"symbol"`
}

type PairsData

type PairsData []struct {
	Symbol              string `json:"symbol"`
	Status              string `json:"status"`
	BaseAsset           string `json:"baseAsset"`
	BaseAssetPrecision  int    `json:"baseAssetPrecision"`
	QuoteAsset          string `json:"quoteAsset"`
	QuoteAssetPrecision int    `json:"quoteAssetPrecision"`
	MinOrderAmount      string `json:"minOrderAmount"`
	MaxOrderAmount      string `json:"maxOrderAmount"`
}

type PlaceOrder

type PlaceOrder struct {
	Data string `json:"data"`
}

type Tokok

type Tokok 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 CreateTokok

func CreateTokok(config *exchange.Config) *Tokok

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

func (*Tokok) ApiKeyGET

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

func (*Tokok) ApiKeyRequest

func (e *Tokok) ApiKeyRequest(strMethod string, mapParams map[string]interface{}, 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 (*Tokok) CanDeposit

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

func (*Tokok) CanWithdraw

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

func (*Tokok) CancelAllOrder

func (e *Tokok) CancelAllOrder() error

func (*Tokok) CancelOrder

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

func (*Tokok) DeleteCoin

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

func (*Tokok) DeletePair

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

func (*Tokok) DoAccountOperation

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

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

func (*Tokok) GetBalance

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

func (*Tokok) GetCoinBySymbol

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

func (*Tokok) GetCoinConstraint

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

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

func (*Tokok) GetCoins

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

func (*Tokok) GetCoinsData

func (e *Tokok) 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 (*Tokok) GetConfirmation

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

func (*Tokok) GetConstraintFetchMethod

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

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

func (*Tokok) GetFee

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

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

func (*Tokok) GetID

func (e *Tokok) GetID() int

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

func (*Tokok) GetLotSize

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

func (*Tokok) GetName

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

func (*Tokok) GetPairBySymbol

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

func (*Tokok) GetPairConstraint

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

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

func (*Tokok) GetPairs

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

func (*Tokok) GetPairsData

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

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

func (*Tokok) GetSymbolByCoin

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

func (*Tokok) GetSymbolByPair

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

func (*Tokok) GetTradingWebURL

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

func (*Tokok) GetTxFee

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

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

func (*Tokok) HasPair

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

func (*Tokok) InitData

func (e *Tokok) InitData() error

func (*Tokok) LimitBuy

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

func (*Tokok) LimitSell

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

func (*Tokok) ListOrders

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

func (*Tokok) LoadPublicData

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

func (*Tokok) OrderBook

func (e *Tokok) 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 (*Tokok) OrderStatus

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

func (*Tokok) SetCoinConstraint

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

func (*Tokok) SetPairConstraint

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

func (*Tokok) UpdateAllBalances

func (e *Tokok) UpdateAllBalances()

func (*Tokok) UpdateConstraint

func (e *Tokok) UpdateConstraint()

func (*Tokok) Withdraw

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

Jump to

Keyboard shortcuts

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