realtime

package
v0.0.0-...-81d47fe Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "wss://ws.lightstream.bitflyer.com/json-rpc"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMessage

type AuthMessage struct {
	JsonRPC string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  auth.Params `json:"params"`
	ID      int         `json:"id"`
}

func NewAuthMessage

func NewAuthMessage(param *auth.Auth) *AuthMessage

type BoardResponse

type BoardResponse struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string         `json:"channel"`
		Message board.Response `json:"message"`
	} `json:"params"`
}

type Channel

type Channel struct {
	ProductCode types.ProductCode
	Event       Event
}

func (*Channel) String

func (c *Channel) String() string

type ChildOrderEvent

type ChildOrderEvent struct {
	ProductCode            types.ProductCode    `json:"product_code"`
	ChildOrderID           string               `json:"child_order_id"`
	ChildOrderAcceptanceID string               `json:"child_order_acceptance_id"`
	EventDate              time.BitFlyerTime    `json:"event_date"`
	EventType              EventType            `json:"event_type"`
	ChildOrderType         types.ChildOrderType `json:"child_order_type"`
	ExpireDate             time.BitFlyerTime    `json:"expire_date"`
	Reason                 string               `json:"reason"`
	ExecID                 int                  `json:"exec_id"`
	Side                   types.Side           `json:"side"`
	Price                  float64              `json:"price"`
	Size                   float64              `json:"size"`
	Commission             float64              `json:"commission"`
	SFD                    float64              `json:"sfd"`
}

type ChildOrderEventsResponse

type ChildOrderEventsResponse struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string            `json:"channel"`
		Message []ChildOrderEvent `json:"message"`
	} `json:"params"`
}

type Event

type Event string
const (
	Ticker            Event = "ticker"
	Board             Event = "board"
	BoardSnapshot     Event = "board_snapshot"
	Executions        Event = "executions"
	ChildOrderEvents  Event = "child_order_events"
	ParentOrderEvents Event = "parent_order_events"
)

type EventType

type EventType string
const (
	Order        EventType = "ORDER"
	OrderFailed  EventType = "ORDER_FAILED"
	Cancel       EventType = "CANCEL"
	CancelFailed EventType = "CANCEL_FAILED"
	Execution    EventType = "EXECUTION"
	Expire       EventType = "EXPIRE"
)

type ExecutionsResponse

type ExecutionsResponse struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string              `json:"channel"`
		Message executions.Response `json:"message"`
	} `json:"params"`
}

type JsonRpcClient

type JsonRpcClient struct {
	Channels []Channel
	// contains filtered or unexported fields
}

func New

func New() *JsonRpcClient

func (*JsonRpcClient) AddChannel

func (c *JsonRpcClient) AddChannel(channel Channel) *JsonRpcClient

func (*JsonRpcClient) Auth

func (c *JsonRpcClient) Auth(auth *auth.Auth) *JsonRpcClient

func (*JsonRpcClient) ReceiveMessage

func (c *JsonRpcClient) ReceiveMessage(ch chan Response)

type ParentOrderEvent

type ParentOrderEvent struct {
	ProductCode             types.ProductCode    `json:"product_code"`
	ParentOrderID           string               `json:"parent_order_id"`
	ParentOrderAcceptanceID string               `json:"parent_order_acceptance_id"`
	EventDate               time.BitFlyerTime    `json:"event_date"`
	EventType               EventType            `json:"event_type"`
	ParentOrderType         string               `json:"parent_order_type"`
	Reason                  string               `json:"reason"`
	ChildOrderType          types.ChildOrderType `json:"child_order_type"`
	ParameterIndex          int                  `json:"parameter_index"`
	ChildOrderAcceptanceID  string               `json:"child_order_acceptance_id"`
	Side                    types.Side           `json:"side"`
	Price                   float64              `json:"price"`
	Size                    float64              `json:"size"`
	ExpireDate              time.BitFlyerTime    `json:"expire_date"`
}

type ParentOrderEventsResponse

type ParentOrderEventsResponse struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string             `json:"channel"`
		Message []ParentOrderEvent `json:"message"`
	} `json:"params"`
}

type Response

type Response struct {
	Event Event
	Error error

	Board             board.Response
	BoardSnapshot     board.Response
	Ticker            ticker.Response
	Executions        executions.Response
	ChildOrderEvents  []ChildOrderEvent
	ParentOrderEvents []ParentOrderEvent
}

type SubscribeMessage

type SubscribeMessage struct {
	JsonRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string `json:"channel"`
	} `json:"params"`
}

func NewSubscribeMessage

func NewSubscribeMessage(channel Channel) *SubscribeMessage

type TickerResponse

type TickerResponse struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  struct {
		Channel string          `json:"channel"`
		Message ticker.Response `json:"message"`
	} `json:"params"`
}

Jump to

Keyboard shortcuts

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