bitflyer

package
v0.0.0-...-82d0e4a Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	Max_buy_orders  int
	Max_sell_orders int
	// contains filtered or unexported fields
}

func NewBitflyer

func NewBitflyer(key, secret string, max_buy_orders, max_sell_orders int) *APIClient

func (*APIClient) CancelOrder

func (apiClient *APIClient) CancelOrder(order *Order) error

func (*APIClient) GetActiveBuyOrders

func (apiClient *APIClient) GetActiveBuyOrders(product_code, order_status string) (*[]Order, error)

func (*APIClient) GetBalance

func (apiClient *APIClient) GetBalance() ([]Balance, error)

func (*APIClient) GetTicker

func (apiClient *APIClient) GetTicker(productCode string) (*Ticker, error)

func (*APIClient) PlaceOrder

func (apiClient *APIClient) PlaceOrder(order *Order) (*PlaceOrderResponse, error)

type Balance

type Balance struct {
	CurrentCode string  `json:"currency_code"`
	Amount      float64 `json:"amount"`
	Available   float64 `json:"available"`
}

type CancelOrderResponse

type CancelOrderResponse struct {
	OrderId string `json:"child_order_acceptance_id"`
}

type JsonRPC2

type JsonRPC2 struct {
	Version string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
	Result  interface{} `json:"result,omitempty"`
	Id      *int        `json:"id,omitempty"`
}

type Order

type Order struct {
	ID                     int     `json:"id"`
	ChildOrderAcceptanceID string  `json:"child_order_acceptance_id"`
	ProductCode            string  `json:"product_code"`
	ChildOrderType         string  `json:"child_order_type"`
	Side                   string  `json:"side"`
	Price                  float64 `json:"price"`
	Size                   float64 `json:"size"`
	MinuteToExpires        int     `json:"minute_to_expire"`
	TimeInForce            string  `json:"time_in_force"`
	Status                 string  `json:"status"`
	ErrorMessage           string  `json:"error_message"`
	AveragePrice           float64 `json:"average_price"`
	ChildOrderState        string  `json:"child_order_state"`
	ExpireDate             string  `json:"expire_date"`
	ChildOrderDate         string  `json:"child_order_date"`
	OutstandingSize        float64 `json:"outstanding_size"`
	CancelSize             float64 `json:"cancel_size"`
	ExecutedSize           float64 `json:"executed_size"`
	TotalCommission        float64 `json:"total_commission"`
	Count                  int     `json:"count"`
	Before                 int     `json:"before"`
	After                  int     `json:"after"`
}

type PlaceOrderResponse

type PlaceOrderResponse struct {
	OrderId string `json:"child_order_acceptance_id"`
}

type SubscribeParams

type SubscribeParams struct {
	Channel string `json:"channel"`
}

type Ticker

type Ticker struct {
	ProductCode     string  `json:"product_code"`
	Timestamp       string  `json:"timestamp"`
	TickID          int     `json:"tick_id"`
	BestBid         float64 `json:"best_bid"`
	BestAsk         float64 `json:"best_ask"`
	BestBidSize     float64 `json:"best_bid_size"`
	BestAskSize     float64 `json:"best_ask_size"`
	TotalBidDepth   float64 `json:"total_bid_depth"`
	TotalAskDepth   float64 `json:"total_ask_depth"`
	Ltp             float64 `json:"ltp"`
	Volume          float64 `json:"volume"`
	VolumeByProduct float64 `json:"volume_by_product"`
}

easy to convert json to struct with https://mholt.github.io/json-to-go/

func (*Ticker) DateTime

func (t *Ticker) DateTime() time.Time

func (*Ticker) GetMiddlePrice

func (t *Ticker) GetMiddlePrice() float64

func (*Ticker) TruncateDateTime

func (t *Ticker) TruncateDateTime(duration time.Duration) time.Time

Jump to

Keyboard shortcuts

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