btcmarkets

package
v0.0.0-...-8bcfbc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 14 Imported by: 0

README

GoCryptoTrader package Btcmarkets

Build Status Software License GoDoc Coverage Status Go Report Card

This btcmarkets package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

BTCMarkets Exchange

Current Features
  • Initial generation
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	Balance      float64 `json:"balance"`
	PendingFunds float64 `json:"pendingFunds"`
	Currency     string  `json:"currency"`
}

AccountBalance holds account balance details

type BTCMarkets

type BTCMarkets struct {
	exchange.Base
	Ticker map[string]Ticker
	*request.Handler
}

BTCMarkets is the overarching type across the BTCMarkets package

func (*BTCMarkets) CancelOrder

func (b *BTCMarkets) CancelOrder(orderID []int64) (bool, error)

CancelOrder cancels an order by its ID orderID - id for order example "1337"

func (*BTCMarkets) GetAccountBalance

func (b *BTCMarkets) GetAccountBalance() ([]AccountBalance, error)

GetAccountBalance returns the full account balance

func (*BTCMarkets) GetExchangeAccountInfo

func (b *BTCMarkets) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies for the BTCMarkets exchange

func (*BTCMarkets) GetExchangeHistory

func (b *BTCMarkets) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*BTCMarkets) GetFee

func (b *BTCMarkets) GetFee() float64

GetFee returns the BTCMarkets fee on transactions

func (*BTCMarkets) GetOrderDetail

func (b *BTCMarkets) GetOrderDetail(orderID []int64) ([]Order, error)

GetOrderDetail returns order information an a specific order orderID - example "1337"

func (*BTCMarkets) GetOrderbook

func (b *BTCMarkets) GetOrderbook(firstPair, secondPair string) (Orderbook, error)

GetOrderbook returns current orderbook symbol - example "btc" or "ltc"

func (*BTCMarkets) GetOrderbookEx

func (b *BTCMarkets) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*BTCMarkets) GetOrders

func (b *BTCMarkets) GetOrders(currency, instrument string, limit, since int64, historic bool) ([]Order, error)

GetOrders returns current order information on the exchange currency - example "AUD" instrument - example "BTC" limit - example "10" since - since a time example "33434568724" historic - if false just normal Orders open

func (*BTCMarkets) GetTicker

func (b *BTCMarkets) GetTicker(firstPair, secondPair string) (Ticker, error)

GetTicker returns a ticker symbol - example "btc" or "ltc"

func (*BTCMarkets) GetTickerPrice

func (b *BTCMarkets) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*BTCMarkets) GetTrades

func (b *BTCMarkets) GetTrades(firstPair, secondPair string, values url.Values) ([]Trade, error)

GetTrades returns executed trades on the exchange symbol - example "btc" or "ltc" values - optional paramater "since" example values.Set(since, "59868345231")

func (*BTCMarkets) NewOrder

func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount int64, orderSide, orderType, clientReq string) (int, error)

NewOrder requests a new order and returns an ID currency - example "AUD" instrument - example "BTC" price - example 13000000000 (i.e x 100000000) amount - example 100000000 (i.e x 100000000) orderside - example "Bid" or "Ask" orderType - example "limit" clientReq - example "abc-cdf-1000"

func (*BTCMarkets) Run

func (b *BTCMarkets) Run()

Run implements the BTC Markets wrapper

func (*BTCMarkets) SendAuthenticatedRequest

func (b *BTCMarkets) SendAuthenticatedRequest(reqType, path string, data interface{}, result interface{}) (err error)

SendAuthenticatedRequest sends an authenticated HTTP request

func (*BTCMarkets) SendHTTPRequest

func (b *BTCMarkets) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*BTCMarkets) SetDefaults

func (b *BTCMarkets) SetDefaults()

SetDefaults sets basic defaults

func (*BTCMarkets) Setup

func (b *BTCMarkets) Setup(exch config.ExchangeConfig)

Setup takes in an exchange configuration and sets all parameters

func (*BTCMarkets) Start

func (b *BTCMarkets) Start()

Start starts the BTC Markets go routine

func (*BTCMarkets) UpdateOrderbook

func (b *BTCMarkets) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*BTCMarkets) UpdateTicker

func (b *BTCMarkets) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*BTCMarkets) WithdrawAUD

func (b *BTCMarkets) WithdrawAUD(accountName, accountNumber, bankName, bsbNumber, currency string, amount int64) (string, error)

WithdrawAUD withdraws AUD into a designated bank address Does not return a TxID!

func (*BTCMarkets) WithdrawCrypto

func (b *BTCMarkets) WithdrawCrypto(amount int64, currency, address string) (string, error)

WithdrawCrypto withdraws cryptocurrency into a designated address

type Order

type Order struct {
	ID              int64           `json:"id"`
	Currency        string          `json:"currency"`
	Instrument      string          `json:"instrument"`
	OrderSide       string          `json:"orderSide"`
	OrderType       string          `json:"ordertype"`
	CreationTime    float64         `json:"creationTime"`
	Status          string          `json:"status"`
	ErrorMessage    string          `json:"errorMessage"`
	Price           float64         `json:"price"`
	Volume          float64         `json:"volume"`
	OpenVolume      float64         `json:"openVolume"`
	ClientRequestID string          `json:"clientRequestId"`
	Trades          []TradeResponse `json:"trades"`
}

Order holds order information

type OrderToGo

type OrderToGo struct {
	Currency        string `json:"currency"`
	Instrument      string `json:"instrument"`
	Price           int64  `json:"price"`
	Volume          int64  `json:"volume"`
	OrderSide       string `json:"orderSide"`
	OrderType       string `json:"ordertype"`
	ClientRequestID string `json:"clientRequestId"`
}

OrderToGo holds order information to be sent to the exchange

type Orderbook

type Orderbook struct {
	Currency   string      `json:"currency"`
	Instrument string      `json:"instrument"`
	Timestamp  int64       `json:"timestamp"`
	Asks       [][]float64 `json:"asks"`
	Bids       [][]float64 `json:"bids"`
}

Orderbook holds current orderbook information returned from the exchange

type Response

type Response struct {
	Success      bool   `json:"success"`
	ErrorCode    int    `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
	ID           int    `json:"id"`
	Responses    []struct {
		Success      bool   `json:"success"`
		ErrorCode    int    `json:"errorCode"`
		ErrorMessage string `json:"errorMessage"`
		ID           int64  `json:"id"`
	}
	ClientRequestID string  `json:"clientRequestId"`
	Orders          []Order `json:"orders"`
	Status          string  `json:"status"`
}

Response is the genralized response type

type Ticker

type Ticker struct {
	BestBID    float64 `json:"bestBid"`
	BestAsk    float64 `json:"bestAsk"`
	LastPrice  float64 `json:"lastPrice"`
	Currency   string  `json:"currency"`
	Instrument string  `json:"instrument"`
	Timestamp  int64   `json:"timestamp"`
	Volume     float64 `json:"volume24h"`
}

Ticker holds ticker information

type Trade

type Trade struct {
	TradeID int64   `json:"tid"`
	Amount  float64 `json:"amount"`
	Price   float64 `json:"price"`
	Date    int64   `json:"date"`
}

Trade holds trade information

type TradeResponse

type TradeResponse struct {
	ID           int64   `json:"id"`
	CreationTime float64 `json:"creationTime"`
	Description  string  `json:"description"`
	Price        float64 `json:"price"`
	Volume       float64 `json:"volume"`
	Fee          float64 `json:"fee"`
}

TradeResponse holds trade information

type WithdrawRequestAUD

type WithdrawRequestAUD struct {
	Amount        int64  `json:"amount"`
	Currency      string `json:"currency"`
	AccountName   string `json:"accountName"`
	AccountNumber string `json:"accountNumber"`
	BankName      string `json:"bankName"`
	BSBNumber     string `json:"bsbNumber"`
}

WithdrawRequestAUD is a generalized withdraw request type

type WithdrawRequestCrypto

type WithdrawRequestCrypto struct {
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
	Address  string `json:"address"`
}

WithdrawRequestCrypto is a generalized withdraw request type

Jump to

Keyboard shortcuts

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