mxc

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: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 24
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://www.mxc.co" //"https://www.mxc.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	Frozen    string `json:"frozen"`
	Available string `json:"available"`
}

type JsonResponse

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

type Mxc

type Mxc 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 CreateMxc

func CreateMxc(config *exchange.Config) *Mxc

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

func (*Mxc) ApiKeyRequest

func (e *Mxc) ApiKeyRequest(strMethod string, strRequestPath string, mapParams map[string]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 (*Mxc) CanDeposit

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

func (*Mxc) CanWithdraw

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

func (*Mxc) CancelAllOrder

func (e *Mxc) CancelAllOrder() error

func (*Mxc) CancelOrder

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

func (*Mxc) DeleteCoin

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

func (*Mxc) DeletePair

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

func (*Mxc) DoAccountOperation

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

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

func (*Mxc) GetBalance

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

func (*Mxc) GetCoinBySymbol

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

func (*Mxc) GetCoinConstraint

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

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

func (*Mxc) GetCoins

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

func (*Mxc) GetCoinsData

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

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

func (*Mxc) GetConstraintFetchMethod

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

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

func (*Mxc) GetFee

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

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

func (*Mxc) GetID

func (e *Mxc) GetID() int

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

func (*Mxc) GetLotSize

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

func (*Mxc) GetName

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

func (*Mxc) GetPairBySymbol

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

func (*Mxc) GetPairConstraint

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

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

func (*Mxc) GetPairs

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

func (*Mxc) GetPairsData

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

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

func (*Mxc) GetSymbolByCoin

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

func (*Mxc) GetSymbolByPair

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

func (*Mxc) GetTradingWebURL

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

func (*Mxc) GetTxFee

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

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

func (*Mxc) HasPair

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

func (*Mxc) InitData

func (e *Mxc) InitData() error

func (*Mxc) LimitBuy

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

func (*Mxc) LimitSell

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

func (*Mxc) ListOrders

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

func (*Mxc) LoadPublicData

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

func (*Mxc) OrderBook

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

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

func (*Mxc) SetCoinConstraint

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

func (*Mxc) SetPairConstraint

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

func (*Mxc) UpdateAllBalances

func (e *Mxc) UpdateAllBalances()

func (*Mxc) UpdateConstraint

func (e *Mxc) UpdateConstraint()

func (*Mxc) Withdraw

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

type OrderBook

type OrderBook struct {
	Asks []struct {
		Price    string `json:"price"`
		Quantity string `json:"quantity"`
	} `json:"asks"`
	Bids []struct {
		Price    string `json:"price"`
		Quantity string `json:"quantity"`
	} `json:"bids"`
}

type OrderStatus

type OrderStatus struct {
	ID             string `json:"id"`
	Market         string `json:"market"`
	Price          string `json:"price"`
	Status         string `json:"status"`
	TotalQuantity  string `json:"totalQuantity"`
	TradedQuantity string `json:"tradedQuantity"`
	TradedAmount   string `json:"tradedAmount"`
	CreateTime     string `json:"createTime"`
	Type           int    `json:"type"`
}

type PairsData

type PairsData struct {
	PriceScale    int     `json:"priceScale"`
	QuantityScale int     `json:"quantityScale"`
	MinAmount     float64 `json:"minAmount"`
	BuyFeeRate    float64 `json:"buyFeeRate"`
	SellFeeRate   float64 `json:"sellFeeRate"`
}

type PlaceOrder

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

type TradeHistory

type TradeHistory []struct {
	TradeTime     string `json:"tradeTime"`
	TradePrice    string `json:"tradePrice"`
	TradeQuantity string `json:"tradeQuantity"`
	TradeType     string `json:"tradeType"`
}

Jump to

Keyboard shortcuts

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