BigoneAPI

package
v0.0.0-...-d060b71 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_BASE_URL = "https://big.one/api/v2"
	TICKER_URI   = API_BASE_URL + "/markets/%s/ticker"
	DEPTH_URI    = API_BASE_URL + "/markets/%s/depth"
	ACCOUNT_URI  = API_BASE_URL + "/viewer/accounts"
	ORDERS_URI   = API_BASE_URL + "/viewer/orders"
)

Variables

This section is empty.

Functions

func HttpGet

func HttpGet(client *http.Client, reqUrl string, headers map[string]string, result interface{}) error

func HttpPostForm

func HttpPostForm(client *http.Client, reqUrl string, postData map[string]string, headers map[string]string) ([]byte, error)

func NewHttpRequest

func NewHttpRequest(client *http.Client, reqType string, reqUrl string, postData string, requstHeaders map[string]string) ([]byte, error)

Types

type AccountResp

type AccountResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data []struct {
		AssetID       string `json:"asset_id"`
		AssetUUID     string `json:"asset_uuid"`
		Balance       string `json:"balance"`
		LockedBalance string `json:"locked_balance"`
	} `json:"data"`
}

type Bigone

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

func New

func New(client *http.Client, api_key, secret_key string) *Bigone

func (*Bigone) CancelOrder

func (bo *Bigone) CancelOrder(orderId string, currencyPair string) (*CancelOrderResp, error)

func (*Bigone) GetAccount

func (bo *Bigone) GetAccount() (*AccountResp, error)

func (*Bigone) GetDepth

func (bo *Bigone) GetDepth(currencyPair string) (*DepthResp, error)

func (*Bigone) GetOrderHistorys

func (bo *Bigone) GetOrderHistorys(currencyPair string) (*OrderListResp, error)

func (*Bigone) GetTicker

func (bo *Bigone) GetTicker(currencyPair string) (*TickerResp, error)

func (*Bigone) GetUnfinishOrders

func (bo *Bigone) GetUnfinishOrders(currencyPair string) (*OrderListResp, error)

func (*Bigone) LimitBuy

func (bo *Bigone) LimitBuy(amount, price string, currencyPair string) (*PlaceOrderResp, error)

func (*Bigone) LimitSell

func (bo *Bigone) LimitSell(amount, price string, currencyPair string) (*PlaceOrderResp, error)

func (*Bigone) MarketBuy

func (bo *Bigone) MarketBuy(amount, price string, currencyPair string) (*PlaceOrderResp, error)

func (*Bigone) MarketSell

func (bo *Bigone) MarketSell(amount, price string, currencyPair string) (*PlaceOrderResp, error)

type CancelOrderResp

type CancelOrderResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data struct {
		ID           string `json:"id"`
		MarketUUID   string `json:"market_uuid"`
		Price        string `json:"price"`
		Amount       string `json:"amount"`
		FilledAmount string `json:"filled_amount"`
		AvgDealPrice string `json:"avg_deal_price"`
		Side         string `json:"side"`
		State        string `json:"state"`
	}
}

type DepthResp

type DepthResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data struct {
		MarketID string `json:"market_id"`
		Bids     []struct {
			Price      string `json:"price"`
			OrderCount int    `json:"order_count"`
			Amount     string `json:"amount"`
		} `json:"bids"`
		Asks []struct {
			Price      string `json:"price"`
			OrderCount int    `json:"order_count"`
			Amount     string `json:"amount"`
		} `json:"asks"`
	}
}

type OrderListResp

type OrderListResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data struct {
		Edges []struct {
			Cursor string `json:"cursor"`
			Node   struct {
				Amount       string `json:"amount"`
				AvgDealPrice string `json:"avg_deal_price"`
				FilledAmount string `json:"filled_amount"`
				ID           string `json:"id"`
				InsertedAt   string `json:"inserted_at"`
				MarketID     string `json:"market_id"`
				MarketUUID   string `json:"market_uuid"`
				Price        string `json:"price"`
				Side         string `json:"side"`
				State        string `json:"state"`
				UpdatedAt    string `json:"updated_at"`
			} `json:"node"`
		} `json:"edges"`
		PageInfo struct {
			EndCursor       string `json:"end_cursor"`
			HasNextPage     bool   `json:"has_next_page"`
			HasPreviousPage bool   `json:"has_previous_page"`
			StartCursor     string `json:"start_cursor"`
		} `json:"page_info"`
	} `json:"data"`
}

type PlaceOrderResp

type PlaceOrderResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data struct {
		Amount       string `json:"amount"`
		AvgDealPrice string `json:"avg_deal_price"`
		FilledAmount string `json:"filled_amount"`
		ID           string `json:"id"`
		InsertedAt   string `json:"inserted_at"`
		MarketID     string `json:"market_id"`
		MarketUUID   string `json:"market_uuid"`
		Price        string `json:"price"`
		Side         string `json:"side"`
		State        string `json:"state"`
		UpdatedAt    string `json:"updated_at"`
	} `json:"data"`
}

type TickerResp

type TickerResp struct {
	Errors []struct {
		Code      int `json:"code"`
		Locations []struct {
			Column int `json:"column"`
			Line   int `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`

	Data struct {
		Ask struct {
			Amount string `json:"amount"`
			Price  string `json:"price"`
		} `json:"ask"`
		Bid struct {
			Amount string `json:"amount"`
			Price  string `json:"price"`
		} `json:"bid"`
		Close           string `json:"close"`
		DailyChange     string `json:"daily_change"`
		DailyChangePerc string `json:"daily_change_perc"`
		High            string `json:"high"`
		Low             string `json:"low"`
		MarketID        string `json:"market_id"`
		MarketUUID      string `json:"market_uuid"`
		Open            string `json:"open"`
		Volume          string `json:"volume"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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