txbit

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           = 63
	DEFAULT_TAKER_FEE    = 0.0025 // not from website
	DEFAULT_MAKER_FEE    = 0.0025
	DEFAULT_LOT_SIZE     = 0.0001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.txbit.io/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	UUID          string  `json:"Uuid"`
	Currency      string  `json:"Currency"`
	Balance       float64 `json:"Balance"`
	Available     float64 `json:"Available"`
	Pending       float64 `json:"Pending"`
	CryptoAddress string  `json:"CryptoAddress"`
	Requested     bool    `json:"Requested"`
}

type CoinsData

type CoinsData []struct {
	Currency        string  `json:"Currency"`
	CurrencyLong    string  `json:"CurrencyLong"`
	MinConfirmation int     `json:"MinConfirmation"`
	CoinType        string  `json:"CoinType"`
	TxFee           float64 `json:"TxFee"`
	IsActive        bool    `json:"IsActive"`
	BaseAddress     string  `json:"BaseAddress"`
}

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Buy []struct {
		Quantity float64 `json:"Quantity"`
		Rate     float64 `json:"Rate"`
	} `json:"buy"`
	Sell []struct {
		Quantity float64 `json:"Quantity"`
		Rate     float64 `json:"Rate"`
	} `json:"sell"`
}

type OrderStatus

type OrderStatus struct {
	Type                       string      `json:"Type"`
	AccountID                  interface{} `json:"AccountId"`
	CommissionReserved         float64     `json:"CommissionReserved"`
	CommissionReserveRemaining float64     `json:"CommissionReserveRemaining"`
	Sentinel                   interface{} `json:"Sentinel"`
	IsOpen                     bool        `json:"IsOpen"`
	OrderUUID                  string      `json:"OrderUuid"`
	Exchange                   string      `json:"Exchange"`
	Quantity                   float64     `json:"Quantity"`
	QuantityRemaining          float64     `json:"QuantityRemaining"`
	Limit                      float64     `json:"Limit"`
	CommissionPaid             float64     `json:"CommissionPaid"`
	Price                      float64     `json:"Price"`
	PricePerUnit               interface{} `json:"PricePerUnit"`
	Opened                     time.Time   `json:"Opened"`
	Closed                     interface{} `json:"Closed"`
	CancelInitiated            bool        `json:"CancelInitiated"`
	ImmediateOrCancel          bool        `json:"ImmediateOrCancel"`
	IsConditional              bool        `json:"IsConditional"`
	Condition                  interface{} `json:"Condition"`
	ConditionTarget            interface{} `json:"ConditionTarget"`
}

type PairsData

type PairsData []struct {
	MarketCurrency     string    `json:"MarketCurrency"`
	BaseCurrency       string    `json:"BaseCurrency"`
	MarketCurrencyLong string    `json:"MarketCurrencyLong"`
	BaseCurrencyLong   string    `json:"BaseCurrencyLong"`
	MinTradeSize       float64   `json:"MinTradeSize"`
	MarketName         string    `json:"MarketName"`
	IsActive           bool      `json:"IsActive"`
	Created            time.Time `json:"Created"`
}

type PlaceOrder

type PlaceOrder struct {
	AccountId                  string
	OrderUuid                  string `json:"OrderUuid"`
	Exchange                   string `json:"Exchange"`
	Type                       string
	Quantity                   float64 `json:"Quantity"`
	QuantityRemaining          float64 `json:"QuantityRemaining"`
	Limit                      float64 `json:"Limit"`
	Reserved                   float64
	ReserveRemaining           float64
	CommissionReserved         float64
	CommissionReserveRemaining float64
	CommissionPaid             float64
	Price                      float64 `json:"Price"`
	PricePerUnit               float64 `json:"PricePerUnit"`
	Opened                     string
	Closed                     string
	IsOpen                     bool
	Sentinel                   string
	CancelInitiated            bool
	ImmediateOrCancel          bool
	IsConditional              bool
	Condition                  string
	ConditionTarget            float64
}

type TradeHistory

type TradeHistory struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Result  []struct {
		ID        int       `json:"Id"`
		TimeStamp time.Time `json:"TimeStamp"`
		Quantity  float64   `json:"Quantity"`
		Price     float64   `json:"Price"`
		Total     float64   `json:"Total"`
		FillType  string    `json:"FillType"`
		OrderType string    `json:"OrderType"`
	} `json:"result"`
}

type Txbit

type Txbit 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 CreateTxbit

func CreateTxbit(config *exchange.Config) *Txbit

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

func (*Txbit) ApiKeyGET

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

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

func (*Txbit) CanWithdraw

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

func (*Txbit) CancelAllOrder

func (e *Txbit) CancelAllOrder() error

func (*Txbit) CancelOrder

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

func (*Txbit) DeleteCoin

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

func (*Txbit) DeletePair

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

func (*Txbit) DoAccountOperation

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

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

func (*Txbit) GetBalance

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

func (*Txbit) GetCoinBySymbol

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

func (*Txbit) GetCoinConstraint

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

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

func (*Txbit) GetCoins

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

func (*Txbit) GetCoinsData

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

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

func (*Txbit) GetConstraintFetchMethod

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

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

func (*Txbit) GetFee

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

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

func (*Txbit) GetID

func (e *Txbit) GetID() int

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

func (*Txbit) GetLotSize

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

func (*Txbit) GetName

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

func (*Txbit) GetPairBySymbol

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

func (*Txbit) GetPairConstraint

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

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

func (*Txbit) GetPairs

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

func (*Txbit) GetPairsData

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

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

func (*Txbit) GetSymbolByCoin

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

func (*Txbit) GetSymbolByPair

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

func (*Txbit) GetTradingWebURL

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

func (*Txbit) GetTxFee

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

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

func (*Txbit) HasPair

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

func (*Txbit) InitData

func (e *Txbit) InitData() error

func (*Txbit) LimitBuy

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

func (*Txbit) LimitSell

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

func (*Txbit) ListOrders

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

func (*Txbit) LoadPublicData

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

************** PUBLIC API **************

func (*Txbit) OrderBook

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

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

func (*Txbit) SetCoinConstraint

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

func (*Txbit) SetPairConstraint

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

func (*Txbit) UpdateAllBalances

func (e *Txbit) UpdateAllBalances()

func (*Txbit) UpdateConstraint

func (e *Txbit) UpdateConstraint()

func (*Txbit) Withdraw

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

done

type Uuid

type Uuid struct {
	UUID string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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