idcm

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

Documentation

Index

Constants

View Source
const (
	API_URL_PUB string = "https://api.idcs.io:8323/api/v1/RealTimeQuote"
	API_URL     string = "https://api.IDCM.cc:8323/api/v1"
)
View Source
const (
	DEFAULT_ID           = 67
	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
)

Variables

This section is empty.

Functions

func ComputeHmac256Base64

func ComputeHmac256Base64(strMessage string, strSecret string) string

func ComputeHmac384NoDecode

func ComputeHmac384NoDecode(strMessage string, strSecret string) string

Types

type AccountBalances

type AccountBalances []struct {
	Code    string  `json:"code"`
	Free    float64 `json:"free"`
	Freezed float64 `json:"freezed"`
}

type Idcm

type Idcm 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 CreateIdcm

func CreateIdcm(config *exchange.Config) *Idcm

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

func (*Idcm) ApiKeyGET

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

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

func (*Idcm) CanDeposit

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

func (*Idcm) CanWithdraw

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

func (*Idcm) CancelAllOrder

func (e *Idcm) CancelAllOrder() error

func (*Idcm) CancelOrder

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

will return true even if the order doesn't exist

func (*Idcm) DeleteCoin

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

func (*Idcm) DeletePair

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

func (*Idcm) DoAccountOperation

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

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

func (*Idcm) GetBalance

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

func (*Idcm) GetCoinBySymbol

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

func (*Idcm) GetCoinConstraint

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

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

func (*Idcm) GetCoins

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

func (*Idcm) GetCoinsData

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

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

func (*Idcm) GetConstraintFetchMethod

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

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

func (*Idcm) GetFee

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

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

func (*Idcm) GetID

func (e *Idcm) GetID() int

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

func (*Idcm) GetLotSize

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

func (*Idcm) GetName

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

func (*Idcm) GetPairBySymbol

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

func (*Idcm) GetPairConstraint

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

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

func (*Idcm) GetPairs

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

func (*Idcm) GetPairsData

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

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

func (*Idcm) GetSymbolByCoin

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

func (*Idcm) GetSymbolByPair

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

func (*Idcm) GetTradingWebURL

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

func (*Idcm) GetTxFee

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

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

func (*Idcm) HasPair

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

func (*Idcm) InitData

func (e *Idcm) InitData() error

func (*Idcm) LimitBuy

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

func (*Idcm) LimitSell

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

func (*Idcm) ListOrders

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

func (*Idcm) LoadPublicData

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

************** Public API **************

func (*Idcm) OrderBook

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

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

func (*Idcm) SetCoinConstraint

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

func (*Idcm) SetPairConstraint

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

func (*Idcm) UpdateAllBalances

func (e *Idcm) UpdateAllBalances()

func (*Idcm) UpdateConstraint

func (e *Idcm) UpdateConstraint()

func (*Idcm) Withdraw

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

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Asks []struct {
		Symbol string  `json:"symbol"`
		Price  float64 `json:"price"`
		Amount float64 `json:"amount"`
	} `json:"asks"`
	Bids []struct {
		Symbol string  `json:"symbol"`
		Price  float64 `json:"price"`
		Amount float64 `json:"amount"`
	} `json:"bids"`
}

type OrderStatus

type OrderStatus []struct {
	Orderid        string  `json:"orderid"`
	Symbol         string  `json:"symbol"`
	Price          float64 `json:"price"`
	Avgprice       float64 `json:"avgprice"`
	Side           int     `json:"side"`
	Type           int     `json:"type"`
	Timestamp      string  `json:"timestamp"`
	Amount         int     `json:"amount"`
	Executedamount int     `json:"executedamount"`
	Status         int     `json:"status"`
}

type PairsData

type PairsData struct {
	Data []struct {
		TradePairID   string  `json:"TradePairID"`
		TradePairCode string  `json:"TradePairCode"`
		LastPrice     float64 `json:"LastPrice"`
		Change        float64 `json:"Change"`
		Rose          float64 `json:"Rose"`
		Volume        float64 `json:"Volume"`
		High          float64 `json:"High"`
		Low           float64 `json:"Low"`
		Open          float64 `json:"Open"`
		Close         float64 `json:"Close"`
		Turnover      float64 `json:"Turnover"`
		Sort          int     `json:"Sort"`
		PriceDigit    int     `json:"PriceDigit"`
		QuantityDigit int     `json:"QuantityDigit"`
	} `json:"Data"`
	NeedLang   bool        `json:"NeedLang"`
	Status     bool        `json:"Status"`
	Msg        interface{} `json:"Msg"`
	URL        interface{} `json:"Url"`
	StatusCode string      `json:"StatusCode"`
	Extra      interface{} `json:"Extra"`
}

type PlaceOrder

type PlaceOrder struct {
	Orderid string `json:"orderid"`
}

type Withdraw

type Withdraw struct {
	WithdrawID string `json:"WithdrawID"`
}

Jump to

Keyboard shortcuts

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