Documentation ¶
Index ¶
- Constants
- type AccountBalances
- type Coin
- type CoinsData
- type JsonResponse
- type Newcapital
- func (e *Newcapital) ApiKeyGet(strRequestPath string, mapParams map[string]string) string
- func (e *Newcapital) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string
- func (e *Newcapital) CanDeposit(coin *coin.Coin) bool
- func (e *Newcapital) CanWithdraw(coin *coin.Coin) bool
- func (e *Newcapital) CancelAllOrder() error
- func (e *Newcapital) CancelOrder(order *exchange.Order) error
- func (e *Newcapital) DeleteCoin(coin *coin.Coin)
- func (e *Newcapital) DeletePair(pair *pair.Pair)
- func (e *Newcapital) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Newcapital) GetBalance(coin *coin.Coin) float64
- func (e *Newcapital) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Newcapital) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Newcapital) GetCoins() []*coin.Coin
- func (e *Newcapital) GetCoinsData() error
- func (e *Newcapital) GetConfirmation(coin *coin.Coin) int
- func (e *Newcapital) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Newcapital) GetFee(pair *pair.Pair) float64
- func (e *Newcapital) GetID() int
- func (e *Newcapital) GetLotSize(pair *pair.Pair) float64
- func (e *Newcapital) GetName() exchange.ExchangeName
- func (e *Newcapital) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Newcapital) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Newcapital) GetPairs() []*pair.Pair
- func (e *Newcapital) GetPairsData() error
- func (e *Newcapital) GetPriceFilter(pair *pair.Pair) float64
- func (e *Newcapital) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Newcapital) GetSymbolByPair(pair *pair.Pair) string
- func (e *Newcapital) GetTradingWebURL(pair *pair.Pair) string
- func (e *Newcapital) GetTxFee(coin *coin.Coin) float64
- func (e *Newcapital) HasPair(pair *pair.Pair) bool
- func (e *Newcapital) InitData() error
- func (e *Newcapital) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Newcapital) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Newcapital) ListOrders() ([]*exchange.Order, error)
- func (e *Newcapital) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Newcapital) OrderBook(p *pair.Pair) (*exchange.Maker, error)
- func (e *Newcapital) OrderStatus(order *exchange.Order) error
- func (e *Newcapital) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Newcapital) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Newcapital) UpdateAllBalances()
- func (e *Newcapital) UpdateConstraint()
- func (e *Newcapital) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type OrderBook
- type Pair
- type PairsData
- type PlaceOrder
- type WithdrawResponse
Constants ¶
const ( DEFAULT_ID = 58 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 )
const (
API_URL = "https://api.new.capital"
)
The Base Endpoint URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 Coin ¶
type Coin struct { Symbol string `json:"symbol"` BaseAsset string `json:"baseAsset"` BaseAssetPrecision int `json:"baseAssetPrecision"` BaseAssetName string `json:"baseAssetName"` QuoteAsset string `json:"quoteAsset"` QuotePrecision int `json:"quotePrecision"` QuoteAssetName string `json:"quoteAssetName"` OrderTypes interface{} `json:"orderTypes"` }
********* Public API Structure*********
type JsonResponse ¶
type JsonResponse struct { Success bool `json:"success"` Message string `json:"message"` Data json.RawMessage `json:"data"` }
type Newcapital ¶
type Newcapital 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 CreateNewcapital ¶
func CreateNewcapital(config *exchange.Config) *Newcapital
*************************************************
func (*Newcapital) ApiKeyGet ¶
func (e *Newcapital) 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 (*Newcapital) ApiKeyRequest ¶
func (e *Newcapital) 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 (*Newcapital) CanDeposit ¶
func (e *Newcapital) CanDeposit(coin *coin.Coin) bool
func (*Newcapital) CanWithdraw ¶
func (e *Newcapital) CanWithdraw(coin *coin.Coin) bool
func (*Newcapital) CancelAllOrder ¶
func (e *Newcapital) CancelAllOrder() error
func (*Newcapital) CancelOrder ¶
func (e *Newcapital) CancelOrder(order *exchange.Order) error
func (*Newcapital) DeleteCoin ¶
func (e *Newcapital) DeleteCoin(coin *coin.Coin)
func (*Newcapital) DeletePair ¶
func (e *Newcapital) DeletePair(pair *pair.Pair)
func (*Newcapital) DoAccountOperation ¶
func (e *Newcapital) DoAccountOperation(operation *exchange.AccountOperation) error
************** Private API **************
func (*Newcapital) GetBalance ¶
func (e *Newcapital) GetBalance(coin *coin.Coin) float64
func (*Newcapital) GetCoinBySymbol ¶
func (e *Newcapital) GetCoinBySymbol(symbol string) *coin.Coin
func (*Newcapital) GetCoinConstraint ¶
func (e *Newcapital) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Newcapital) GetCoins ¶
func (e *Newcapital) GetCoins() []*coin.Coin
func (*Newcapital) GetCoinsData ¶
func (e *Newcapital) 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 (*Newcapital) GetConfirmation ¶
func (e *Newcapital) GetConfirmation(coin *coin.Coin) int
func (*Newcapital) GetConstraintFetchMethod ¶
func (e *Newcapital) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Newcapital) GetFee ¶
func (e *Newcapital) GetFee(pair *pair.Pair) float64
*************** Pair Constraint ***************
func (*Newcapital) GetID ¶
func (e *Newcapital) GetID() int
*************** Exchange Information ***************
func (*Newcapital) GetLotSize ¶
func (e *Newcapital) GetLotSize(pair *pair.Pair) float64
func (*Newcapital) GetName ¶
func (e *Newcapital) GetName() exchange.ExchangeName
func (*Newcapital) GetPairBySymbol ¶
func (e *Newcapital) GetPairBySymbol(symbol string) *pair.Pair
func (*Newcapital) GetPairConstraint ¶
func (e *Newcapital) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Newcapital) GetPairs ¶
func (e *Newcapital) GetPairs() []*pair.Pair
func (*Newcapital) GetPairsData ¶
func (e *Newcapital) 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 (*Newcapital) GetPriceFilter ¶
func (e *Newcapital) GetPriceFilter(pair *pair.Pair) float64
func (*Newcapital) GetSymbolByCoin ¶
func (e *Newcapital) GetSymbolByCoin(coin *coin.Coin) string
func (*Newcapital) GetSymbolByPair ¶
func (e *Newcapital) GetSymbolByPair(pair *pair.Pair) string
func (*Newcapital) GetTradingWebURL ¶
func (e *Newcapital) GetTradingWebURL(pair *pair.Pair) string
func (*Newcapital) GetTxFee ¶
func (e *Newcapital) GetTxFee(coin *coin.Coin) float64
*************** Coin Constraint ***************
func (*Newcapital) InitData ¶
func (e *Newcapital) InitData() error
func (*Newcapital) ListOrders ¶
func (e *Newcapital) ListOrders() ([]*exchange.Order, error)
func (*Newcapital) LoadPublicData ¶
func (e *Newcapital) LoadPublicData(operation *exchange.PublicOperation) error
func (*Newcapital) OrderBook ¶
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 (*Newcapital) OrderStatus ¶
func (e *Newcapital) OrderStatus(order *exchange.Order) error
func (*Newcapital) SetCoinConstraint ¶
func (e *Newcapital) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Newcapital) SetPairConstraint ¶
func (e *Newcapital) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Newcapital) UpdateAllBalances ¶
func (e *Newcapital) UpdateAllBalances()
func (*Newcapital) UpdateConstraint ¶
func (e *Newcapital) UpdateConstraint()
type Pair ¶
type Pair struct { Symbol string `json:"symbol"` // PriceChange string `json:"priceChange"` PriceChangePercent string `json:"priceChangePercent"` LastPrice string `json:"lastPrice"` BidPrice interface{} `json:"bidPrice"` AskPrice interface{} `json:"askPrice"` OpenPrice string `json:"openPrice"` HighPrice string `json:"highPrice"` LowPrice string `json:"lowPrice"` Volume string `json:"volume"` QuoteVolume string `json:"quoteVolume"` OpenTime int `json:"openTime"` CloseTime int `json:"closeTime"` FirstId int `json:"firstId"` LastId int `json:"lastId"` Count int `json:"count"` }
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"` }