newton

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

go-newton-co

go api for http://newton.co/ bitcoin exchance

To create a client:

n := New(<ClientId>, <ClientSecret>)

	_, err := n.Balances("BTC")

	if err != nil {
		t.Error("test failed: " + err.Error())
	}
  

TODO:

  • API for private endpoints
  • API for public endpoints
  • Add sandbox environment for unit tests

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType added in v0.0.2

type ActionType string
const (
	DEPOSIT    ActionType = "DEPOSIT"
	WITHDRAWAL ActionType = "WITHDRAWAL"
	TRANSACT   ActionType = "TRANSACT"
)

type ActionsResp

type ActionsResp struct {
	Actions []struct {
		Type        string    `json:"type"`
		Asset       string    `json:"asset"`
		Quantity    float64   `json:"quantity"`
		Status      string    `json:"status"`
		DateCreated time.Time `json:"date_created"`
		Price       float64   `json:"price,omitempty"`
	}
}

type Args

type Args struct {
	Key   string
	Value string
}

type BalancesResp

type BalancesResp struct {
	Balances map[string]float64
}

type GetApplicableFeesResp added in v0.0.2

type GetApplicableFeesResp struct {
	Fees struct {
		Maker float64 `json:"maker"`
		Taker float64 `json:"taker"`
	}
}

type GetMaxTradeAmountsResp added in v0.0.2

type GetMaxTradeAmountsResp struct {
	TradeAmounts map[string]struct {
		Buy  float64 `json:"buy"`
		Sell float64 `json:"sell"`
	}
}

type GetMinTradeAmountsResp added in v0.0.2

type GetMinTradeAmountsResp GetMaxTradeAmountsResp

type GetSymbolsResp added in v0.0.2

type GetSymbolsResp struct {
	Symbols []string
}

type GetTickSizesResp added in v0.0.2

type GetTickSizesResp struct {
	Ticks map[string]struct {
		Tick float64 `json:"tick"`
	}
}

type NewOrderReq

type NewOrderReq struct {
	OrderType   string  `json:"order_type"`
	TimeInForce string  `json:"time_in_force"`
	Side        string  `json:"side"`
	Symbol      string  `json:"symbol"`
	Price       float64 `json:"price"`
	Quantity    float64 `json:"quantity"`
}

type Newton

type Newton struct {
	// contains filtered or unexported fields
}

func New

func New(ClientId string, ClientSecret string) *Newton

func (*Newton) Actions

func (n *Newton) Actions(actionType ActionType, limit int, offset int, startDate int64, endDate int64) (*ActionsResp, error)

func (*Newton) Balances

func (n *Newton) Balances(asset string) (*BalancesResp, error)

func (*Newton) GetApplicableFees added in v0.0.2

func (n *Newton) GetApplicableFees() (*GetApplicableFeesResp, error)

func (*Newton) GetMaximumTradeAmounts added in v0.0.2

func (n *Newton) GetMaximumTradeAmounts() (*GetMaxTradeAmountsResp, error)

func (*Newton) GetMinimumTradeAmount added in v0.0.2

func (n *Newton) GetMinimumTradeAmount() (*GetMinTradeAmountsResp, error)

func (*Newton) GetSymbols added in v0.0.2

func (n *Newton) GetSymbols(baseAsset, quoteAsset string) (*GetSymbolsResp, error)

func (*Newton) GetTickSizes added in v0.0.2

func (n *Newton) GetTickSizes() (*GetTickSizesResp, error)

func (*Newton) HealthCheck added in v0.0.2

func (n *Newton) HealthCheck() error

func (*Newton) NewOrder

func (n *Newton) NewOrder(orderType string, timeInForce string, side string, symbol string, price float64, quantity float64) (*OpenOrdersResp, error)

func (*Newton) OpenOrders

func (n *Newton) OpenOrders(limit int, offset int, symbol string, timeInForce string) (*OpenOrdersResp, error)

func (*Newton) OrdersHistory

func (n *Newton) OrdersHistory(limit int, offset int, startDate int64, endDate int64, symbol string, timeInForce string) (*OrdersHistoryResp, error)

type OpenOrdersResp

type OpenOrdersResp struct {
	OpenOrders []struct {
		OrderID      string    `json:"order_id"`
		Symbol       string    `json:"symbol"`
		Quantity     int       `json:"quantity"`
		Price        float64   `json:"price"`
		DateCreated  time.Time `json:"date_created"`
		OrderType    string    `json:"order_type"`
		TimeInForce  string    `json:"time_in_force"`
		Side         string    `json:"side"`
		QuantityLeft float64   `json:"quantity_left"`
		ExpiryTime   time.Time `json:"expiry_time"`
	}
}

type OrdersHistoryResp

type OrdersHistoryResp struct {
	OrdersHistory []struct {
		OrderID      string    `json:"order_id"`
		Symbol       string    `json:"symbol"`
		Quantity     int       `json:"quantity"`
		Price        float64   `json:"price"`
		Status       string    `json:"status"`
		DateCreated  time.Time `json:"date_created"`
		DateExecuted string    `json:"date_executed"`
		OrderType    string    `json:"order_type"`
		TimeInForce  string    `json:"time_in_force"`
		Side         string    `json:"side"`
		ExpiryTime   time.Time `json:"expiry_time,omitempty"`
	}
}

Jump to

Keyboard shortcuts

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