rest

package
v0.0.0-...-916f93d Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHmac256

func ComputeHmac256(message string, secret string) string

create signature

func CreateNonce

func CreateNonce() int64

create nonce by milliseconds

Types

type Account

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

func (Account) Balance

func (a Account) Balance() (*AccountBalance, error)

Make sure a balance.

func (Account) Info

func (a Account) Info() (*AccountInfo, error)

Get account information.

type AccountBalance

type AccountBalance struct {
	Success      bool   `json:"success"`
	JPY          string `json:"jpy"`
	BTC          string `json:"btc"`
	JPYReserved  string `json:"jpy_reserved"`
	BTCReserved  string `json:"btc_reserved"`
	JPYLendInUse string `json:"jpy_lend_in_use"`
	BTCLendInUse string `json:"btc_lend_in_use"`
	JPYLent      string `json:"jpy_lent"`
	BTCLent      string `json:"btc_lent"`
	JPYDebt      string `json:"jpy_debt"`
	BTCDebt      string `json:"btc_debt"`
	JPYTsumitate string `json:"jpy_tsumitate"`
	BTCTsumitate string `json:"btc_tsumitate"`
}

type AccountInfo

type AccountInfo struct {
	Success        bool                    `json:"success"`
	ID             int                     `json:"id"`
	Email          string                  `json:"email"`
	IdentityStatus string                  `json:"identity_status"`
	BitcoinAddress string                  `json:"bitcoin_address"`
	TakerFee       string                  `json:"taker_fee"`
	MakerFee       string                  `json:"maker_fee"`
	ExchangeFees   map[string]ExchangeFees `json:"exchange_fees"`
}

type Bank

type Bank struct {
	ID              int    `json:"id"`
	BankName        string `json:"bank_name"`
	BranchName      string `json:"branch_name"`
	BankAccountType string `json:"bank_account_type"`
	Number          string `json:"number"`
	Name            string `json:"name"`
}

type BankAccount

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

func (BankAccount) Create

func (a BankAccount) Create(param string) (*Bank, error)

Create a new BankAccount.

func (BankAccount) Delete

func (a BankAccount) Delete(id string) error

Delete a BankAccount.

func (BankAccount) Get

func (a BankAccount) Get() ([]Bank, error)

Get account information.

type Book

type Book struct {
	Price  float64
	Amount float64
}

type Client

type Client struct {
	Account
	BankAccount
	// borrow       Borrow
	Deposit
	// leverage   Leverage
	Order
	OrderBook
	Send
	Ticker
	Trade
	// transfer     Transfer
	Withdraw
	// contains filtered or unexported fields
}

func (*Client) NewClient

func (c *Client) NewClient(accessKey string, secretKey string) *Client

func (*Client) Request

func (c *Client) Request(method string, path string, param string) string

type Deposit

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

func (Deposit) Get

func (a Deposit) Get(param string) ([]ResponseForDeposit, error)

You Get Deposit history

type ExchangeFees

type ExchangeFees struct {
	MakerFeeRate string `json:"maker_fee_rate"`
	TakerFeeRate string `json:"taker_fee_rate"`
}

type Order

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

func (Order) Cancel

func (a Order) Cancel(id string) string

cancel a created order specified by order id. Optional argument amount is to refund partially.

func (Order) CancelStatus

func (a Order) CancelStatus(id string) (*ResponseForCancelStatus, error)

CancelStatus returns the status of the order cancellation.

func (Order) Create

func (a Order) Create(op RequestForOrder) (*ResponseForOrder, error)

Create a order object with given parameters.In live mode, this issues a transaction.

func (Order) Opens

func (a Order) Opens() ([]ResponseForOrder, error)

List charges filtered by params

func (Order) Transactions

func (a Order) Transactions() ([]ResponseForTransaction, error)

Get Order Transactions

type OrderBook

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

func (OrderBook) Get

func (a OrderBook) Get(symbol string) (*ResponseForOrderBook, error)

板情報を取得できます。

type RequestForOrder

type RequestForOrder struct {
	Pair            string `json:"pair"`                        // 取引ペア(例: "btc_jpy")
	OrderType       string `json:"order_type"`                  // 注文方法("buy", "sell", "market_buy", "market_sell")
	Price           string `json:"rate,omitempty"`              // 注文のレート(例: "28000")、指値注文の場合に必要
	Amount          string `json:"amount,omitempty"`            // 注文での量(例: "0.1")、指値注文および成行売り注文の場合に必要
	MarketBuyAmount string `json:"market_buy_amount,omitempty"` // 成行買で利用する日本円の金額(例: "10000")、成行買い注文の場合に必要
	StopLossRate    string `json:"stop_loss_rate,omitempty"`    // 逆指値レート、オプショナル
	TimeInForce     string `json:"time_in_force,omitempty"`     // 注文有効期間("good_til_cancelled" あるいは "post_only")、オプショナル
}

type Response

type Response struct {
	Success bool  `json:"success"`
	Data    []any `json:"data"`
}

type ResponseForCancelStatus

type ResponseForCancelStatus struct {
	ID        int       `json:"id"`
	Cancel    bool      `json:"cancel"`
	CreatedAt time.Time `json:"created_at"`
}

type ResponseForDeposit

type ResponseForDeposit struct {
	ID          int       `json:"id"`
	Amount      string    `json:"amount"`
	Currency    string    `json:"currency"`
	Address     string    `json:"address"`
	Status      string    `json:"status"`
	ConfirmedAt time.Time `json:"confirmed_at"`
	CreatedAt   time.Time `json:"created_at"`
}

type ResponseForOpenOrder

type ResponseForOpenOrder struct {
	ID                     int       `json:"id"`
	Pair                   string    `json:"pair"`
	Rate                   float64   `json:"rate"`           // nullの場合があるためポインタ型を使用
	PendingAmount          string    `json:"pending_amount"` // nullの場合があるためポインタ型を使用
	OrderType              string    `json:"order_type"`
	PendingMarketBuyAmount string    `json:"pending_market_buy_amount"` // nullの場合があるためポインタ型を使用
	StopLossRate           string    `json:"stop_loss_rate"`            // nullの場合があるためポインタ型を使用
	CreatedAt              time.Time `json:"created_at"`
}

type ResponseForOrder

type ResponseForOrder struct {
	ID           int       `json:"id"`
	Pair         string    `json:"pair"`
	Rate         string    `json:"rate"`
	Amount       string    `json:"amount"`
	OrderType    string    `json:"order_type"`
	TimeInForce  string    `json:"time_in_force"`
	StopLossRate string    `json:"stop_loss_rate,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
}

type ResponseForOrderBook

type ResponseForOrderBook struct {
	Asks []Book
	Bids []Book
}

func (*ResponseForOrderBook) UnmarshalJSON

func (o *ResponseForOrderBook) UnmarshalJSON(data []byte) error

type ResponseForPagination

type ResponseForPagination struct {
	Limit         int    `json:"limit"`
	Order         string `json:"order"`
	StartingAfter string `json:"starting_after,omitempty"`
	EndingBefore  string `json:"ending_before,omitempty"`
}

type ResponseForTicker

type ResponseForTicker struct {
	Last      float64 `json:"last"`
	Bid       float64 `json:"bid"`
	Ask       float64 `json:"ask"`
	High      float64 `json:"high"`
	Low       float64 `json:"low"`
	Volume    float64 `json:"volume"`
	Timestamp int64   `json:"timestamp"`
}

type ResponseForTrade

type ResponseForTrade struct {
	ID        int       `json:"id"`
	Amount    string    `json:"amount"`
	Rate      string    `json:"rate"`
	Pair      string    `json:"pair"`
	OrderType string    `json:"order_type"`
	CreatedAt time.Time `json:"created_at"`
}

type ResponseForTransaction

type ResponseForTransaction struct {
	ID      int `json:"id"`
	OrderID int `json:"order_id"`

	Pair string `json:"pair"`
	Side string `json:"side"`
	Rate string `json:"rate"`

	Fee         string `json:"fee"`
	FeeCurrency string `json:"fee_currency"`

	Liquidity string `json:"liquidity"`

	Funds     map[string]interface{} `json:"funds"`
	CreatedAt time.Time              `json:"created_at"`
}

type Send

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

func (Send) Create

func (a Send) Create(param string) string

Sending Bitcoin to specified Bitcoin addres.

func (Send) Get

func (a Send) Get(param string) string

You Get Send history

type Ticker

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

func (Ticker) Get

func (a Ticker) Get() (*ResponseForTicker, error)

各種最新情報を簡易に取得することができます。

type Trade

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

func (Trade) Get

func (a Trade) Get(symbol string) ([]ResponseForTrade, error)

最新の取引履歴を取得できます。

type Withdraw

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

func (Withdraw) Cancel

func (a Withdraw) Cancel(id string) string

Transfer Balance from Leverage.

func (Withdraw) Create

func (a Withdraw) Create(param string) string

Transfer Balance to Leverage.

func (Withdraw) Get

func (a Withdraw) Get() string

Transfer Balance from Leverage.

Jump to

Keyboard shortcuts

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