ws

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WsBTCJPY  = "btc_jpy"
	WsETCJPY  = "etc_jpy"
	WsLSKJPY  = "lsk_jpy"
	WsMONAJPY = "mona_jpy"
	WsPLTJPY  = "plt_jpy"
	WsFNCTJPY = "fnct_jpy"
	WsDAIJPY  = "dai_jpy"
	WsWBTCJPY = "wbtc_jpy"

	WsExecution = "trades"
	WsOrderbook = "orderbook"
)
View Source
const (
	WSENDPOINT = "wss://ws-api.coincheck.com/"
)

Variables

This section is empty.

Functions

func UnixTimeStringToTime

func UnixTimeStringToTime(unixTimeStr string) (time.Time, error)

Types

type Books

type Books struct {
	Bids         [][]string `json:"bids"`
	Asks         [][]string `json:"asks"`
	LastUpdateAt time.Time  `json:"last_update_at"`
}

type JsonRPC2

type JsonRPC2 struct {
	Type    string `json:"type"`
	Channel string `json:"channel"`
}

type Orderbook

type Orderbook struct {
	Pair  string `json:"pair"`
	Books Books  `json:"orderBook"`
}

func (*Orderbook) UnmarshalJSON

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

type Realtime

type Realtime struct {
	Result chan []byte
	// contains filtered or unexported fields
}

func NewRealtime

func NewRealtime() *Realtime

WebSocket APIはHTTP通信では実装が難しかった、リアルタイムでのやり取りが容易になり、取引所で公開されている取引の履歴、板情報を取得することができます。

WebSocket APIはβ版であるため、仕様に変更があったり、動作が不安定になる可能性があります。また、利用可能な通貨ペアは"btc_jpy"のみになります。(2017/03/03時点)

Update: 利用可能な通貨ペアはbtc_jpy, etc_jpy, lsk_jpy, mona_jpy, plt_jpy, fnct_jpy, dai_jpy, wbtc_jpyになります。(2020/09時点)

func (*Realtime) Close

func (p *Realtime) Close()

func (*Realtime) Connect

func (p *Realtime) Connect(ctx context.Context) error

func (*Realtime) SetPing

func (p *Realtime) SetPing(sec int)

func (*Realtime) Subscribe

func (p *Realtime) Subscribe(products, channels []string)

type Trade

type Trade struct {
	TradeID      string    `json:"trade_id"`
	Pair         string    `json:"pair"`
	Rate         string    `json:"rate"`
	Amount       string    `json:"amount"`
	OrderType    string    `json:"order_type"`
	TakerOrderID string    `json:"taker_order_id"`
	MakerOrderID string    `json:"maker_order_id"`
	Timestamp    time.Time `json:"timestamp"`
}

type Trades

type Trades struct {
	Trades []Trade `json:"trades"`
}

func (*Trades) UnmarshalJSON

func (p *Trades) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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