okexdm

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           = 45
	DEFAULT_TAKER_FEE    = 0.0005
	DEFAULT_MAKER_FEE    = 0.0002
	DEFAULT_LOT_SIZE     = 0.0001
	DEFAULT_PRICE_FILTER = 0.0001 //PRICE FILTER
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = false
	DEFAULT_DEPOSIT      = false
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL = "https://www.okex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

func GetCodeByDate

func GetCodeByDate(code string) string

func GetContractByCode

func GetContractByCode(code string) string

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 ContractsData

type ContractsData []struct {
	InstrumentID string    `json:"instrument_id"`
	Last         string    `json:"last"`
	BestBid      string    `json:"best_bid"`
	BestAsk      string    `json:"best_ask"`
	High24H      string    `json:"high_24h"`
	Low24H       string    `json:"low_24h"`
	Volume24H    string    `json:"volume_24h"`
	Timestamp    time.Time `json:"timestamp"`
}

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

type JsonResponse

type JsonResponse struct {
	Success bool            `json:"success"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type Okexdm

type Okexdm 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 CreateOkexdm

func CreateOkexdm(config *exchange.Config) *Okexdm

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

func (*Okexdm) ApiKeyGet

func (e *Okexdm) 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 (*Okexdm) ApiKeyRequest

func (e *Okexdm) 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 (*Okexdm) CanDeposit

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

func (*Okexdm) CanWithdraw

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

func (*Okexdm) CancelAllOrder

func (e *Okexdm) CancelAllOrder() error

func (*Okexdm) CancelOrder

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

func (*Okexdm) DeleteCoin

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

func (*Okexdm) DeletePair

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

func (*Okexdm) DoAccountOperation

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

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

func (*Okexdm) GetBalance

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

func (*Okexdm) GetCoinBySymbol

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

func (*Okexdm) GetCoinConstraint

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

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

func (*Okexdm) GetCoins

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

func (*Okexdm) GetCoinsData

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

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

func (*Okexdm) GetConstraintFetchMethod

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

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

func (*Okexdm) GetFee

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

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

func (*Okexdm) GetID

func (e *Okexdm) GetID() int

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

func (*Okexdm) GetLotSize

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

func (*Okexdm) GetName

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

func (*Okexdm) GetPairBySymbol

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

func (*Okexdm) GetPairConstraint

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

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

func (*Okexdm) GetPairs

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

func (*Okexdm) GetPairsData

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

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

func (*Okexdm) GetSymbolByCoin

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

func (*Okexdm) GetSymbolByPair

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

func (*Okexdm) GetTradingWebURL

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

func (*Okexdm) GetTxFee

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

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

func (*Okexdm) HasPair

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

func (*Okexdm) InitData

func (e *Okexdm) InitData() error

func (*Okexdm) LimitBuy

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

func (*Okexdm) LimitSell

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

func (*Okexdm) ListOrders

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

func (*Okexdm) LoadPublicData

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

func (*Okexdm) OrderBook

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

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

func (*Okexdm) SetCoinConstraint

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

func (*Okexdm) SetPairConstraint

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

func (*Okexdm) UpdateAllBalances

func (e *Okexdm) UpdateAllBalances()

func (*Okexdm) UpdateConstraint

func (e *Okexdm) UpdateConstraint()

func (*Okexdm) Withdraw

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

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

type OrderBook

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

type PairsData

type PairsData []struct {
	Symbol      string  `json:"symbol"`
	Status      string  `json:"status"`
	BaseAsset   string  `json:"baseAsset"`
	QuoteAsset  string  `json:"quoteAsset"`
	MakerFee    float64 `json:"makerFee"`
	TakerFee    float64 `json:"takerFee"`
	PriceFilter float64 `json:"priceFilter"`
	LotSize     float64 `json:"lotSize"`
}

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