virgocx

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           = 50
	DEFAULT_TAKER_FEE    = 0.002
	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
)
View Source
const (
	API_URL string = "https://www.virgocx.ca/api"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	FreezingBalance float64 `json:"freezingBalance"`
	Total           float64 `json:"total"`
	Balance         float64 `json:"balance"` // available
	CoinName        string  `json:"coinName"`
}

type CancelOrder

type CancelOrder struct {
	Code    int    `json:"code"`
	Msg     string `json:"msg"`
	Data    string `json:"data"`
	Success bool   `json:"success"`
}

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Asks []struct {
		Price  float64 `json:"price"`
		Qty    float64 `json:"qty"`
		Volume float64 `json:"volume"`
	} `json:"asks"`
	Bids []struct {
		Price  float64 `json:"price"`
		Qty    float64 `json:"qty"`
		Volume float64 `json:"volume"`
	} `json:"bids"`
	Ts int64 `json:"ts"`
}

type OrderStatus

type OrderStatus []SingleOrder

type PairsData

type PairsData []struct {
	Volume     string  `json:"volume"`
	Symbol     string  `json:"symbol"`
	High       string  `json:"high"`
	Last       string  `json:"last"`
	Low        string  `json:"low"`
	Buy        float64 `json:"buy"`
	Sell       float64 `json:"sell"`
	ID         int     `json:"id"`
	ChangeRate string  `json:"changeRate"`
	Open       string  `json:"open"`
}

type PlaceOrder

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

type RawKline

type RawKline []struct {
	ID         int         `json:"id"`
	MarketID   int         `json:"marketId"`
	Open       float64     `json:"open"`
	High       float64     `json:"high"`
	Low        float64     `json:"low"`
	Close      float64     `json:"close"`
	Qty        float64     `json:"qty"`
	CreateTime int64       `json:"createTime"`
	CountTime  interface{} `json:"countTime"`
}

type SingleOrder

type SingleOrder struct {
	CreateTime int64   `json:"createTime"`
	Price      float64 `json:"price"`
	Qty        float64 `json:"qty"`
	TradeQty   float64 `json:"tradeQty"`
	ID         int     `json:"id"`
	Type       int     `json:"type"`
	Direction  int     `json:"direction"`
	Status     int     `json:"status"`
}

type Virgocx

type Virgocx 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 CreateVirgocx

func CreateVirgocx(config *exchange.Config) *Virgocx

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

func (*Virgocx) ApiKeyGET

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

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

func (*Virgocx) CanDeposit

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

func (*Virgocx) CanWithdraw

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

func (*Virgocx) CancelAllOrder

func (e *Virgocx) CancelAllOrder() error

func (*Virgocx) CancelOrder

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

func (*Virgocx) DeleteCoin

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

func (*Virgocx) DeletePair

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

func (*Virgocx) DoAccountOperation

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

func (*Virgocx) GetBalance

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

func (*Virgocx) GetCoinBySymbol

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

func (*Virgocx) GetCoinConstraint

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

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

func (*Virgocx) GetCoins

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

func (*Virgocx) GetCoinsData

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

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

func (*Virgocx) GetConstraintFetchMethod

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

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

func (*Virgocx) GetFee

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

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

func (*Virgocx) GetID

func (e *Virgocx) GetID() int

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

func (*Virgocx) GetLotSize

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

func (*Virgocx) GetName

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

func (*Virgocx) GetPairBySymbol

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

func (*Virgocx) GetPairConstraint

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

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

func (*Virgocx) GetPairs

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

func (*Virgocx) GetPairsData

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

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

func (*Virgocx) GetSymbolByCoin

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

func (*Virgocx) GetSymbolByPair

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

func (*Virgocx) GetTradingWebURL

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

use pair ID in url; but api does not provide pair ID

func (*Virgocx) GetTxFee

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

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

func (*Virgocx) HasPair

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

func (*Virgocx) InitData

func (e *Virgocx) InitData() error

func (*Virgocx) LimitBuy

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

func (*Virgocx) LimitSell

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

func (*Virgocx) ListOrders

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

func (*Virgocx) LoadPublicData

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

func (*Virgocx) OrderBook

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

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

need test Status code

func (*Virgocx) SetCoinConstraint

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

func (*Virgocx) SetPairConstraint

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

func (*Virgocx) UpdateAllBalances

func (e *Virgocx) UpdateAllBalances()

func (*Virgocx) UpdateConstraint

func (e *Virgocx) UpdateConstraint()

func (*Virgocx) Withdraw

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