bitflyer

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 28 Imported by: 0

README

GoCryptoTrader package Bitflyer

Build Status Software License GoDoc Coverage Status Go Report Card

This bitflyer package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Bitflyer Exchange

Current Features
  • REST Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var b exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Bitflyer" {
		b = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	CurrencyCode string  `json:"currency_code"`
	Amount       float64 `json:"amount"`
	Available    float64 `json:"available"`
}

AccountBalance holds account balance information

type BankAccount

type BankAccount struct {
	ID            int64  `json:"id"`
	IsVerified    bool   `json:"is_verified"`
	BankName      string `json:"bank_name"`
	BranchName    string `json:"branch_name"`
	AccountType   string `json:"account_type"`
	AccountNumber int    `json:"account_number"`
	AccountName   string `json:"account_name"`
}

BankAccount holds bank account information

type Bitflyer

type Bitflyer struct {
	exchange.Base
}

Bitflyer is the overarching type across this package

func (*Bitflyer) CancelAllExistingOrders

func (b *Bitflyer) CancelAllExistingOrders()

CancelAllExistingOrders cancels all orders on the exchange

func (*Bitflyer) CancelAllOrders

func (b *Bitflyer) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Bitflyer) CancelBatchOrders

func (b *Bitflyer) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Bitflyer) CancelExistingOrder

func (b *Bitflyer) CancelExistingOrder()

CancelExistingOrder cancels an order

func (*Bitflyer) CancelOrder

func (b *Bitflyer) CancelOrder(_ context.Context, _ *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Bitflyer) CancelParentOrder

func (b *Bitflyer) CancelParentOrder()

CancelParentOrder cancels a special order

func (*Bitflyer) CheckFXString

func (b *Bitflyer) CheckFXString(p currency.Pair) currency.Pair

CheckFXString upgrades currency pair if needed

func (*Bitflyer) FetchAccountInfo

func (b *Bitflyer) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Bitflyer) FetchOrderbook

func (b *Bitflyer) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns the orderbook for a currency pair

func (*Bitflyer) FetchTicker

func (b *Bitflyer) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Bitflyer) FetchTradablePairs

func (b *Bitflyer) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Bitflyer) GetAccountBalance

func (b *Bitflyer) GetAccountBalance()

GetAccountBalance returnsthe full list of account funds

func (*Bitflyer) GetAccountFundingHistory

func (b *Bitflyer) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Bitflyer) GetActiveOrders

GetActiveOrders retrieves any orders that are active/open

func (*Bitflyer) GetAddressInfoCA

func (b *Bitflyer) GetAddressInfoCA(ctx context.Context, addressln string) (ChainAnalysisAddress, error)

GetAddressInfoCA returns balance information for address by addressln string from bitflyer chain analysis system

func (*Bitflyer) GetAllOrders

func (b *Bitflyer) GetAllOrders()

GetAllOrders returns a list of all orders

func (*Bitflyer) GetBankAccSummary

func (b *Bitflyer) GetBankAccSummary()

GetBankAccSummary returns a full list of bank accounts assoc. with your keys

func (*Bitflyer) GetBlockCA

func (b *Bitflyer) GetBlockCA(ctx context.Context, blockhash string) (ChainAnalysisBlock, error)

GetBlockCA returns block information by blockhash from bitflyer chain analysis system

func (*Bitflyer) GetBlockbyHeightCA

func (b *Bitflyer) GetBlockbyHeightCA(ctx context.Context, height int64) (ChainAnalysisBlock, error)

GetBlockbyHeightCA returns the block information by height from bitflyer chain analysis system

func (*Bitflyer) GetCashDeposits

func (b *Bitflyer) GetCashDeposits()

GetCashDeposits returns a full list of cash deposits to the exchange

func (*Bitflyer) GetChats

func (b *Bitflyer) GetChats(ctx context.Context, fromDate string) ([]ChatLog, error)

GetChats returns trollbox chat log Note: returns vary from instant to infinity

func (*Bitflyer) GetCollateralAccounts

func (b *Bitflyer) GetCollateralAccounts()

GetCollateralAccounts returns a full list of collateralised accounts

func (*Bitflyer) GetCryptoDepositAddress

func (b *Bitflyer) GetCryptoDepositAddress()

GetCryptoDepositAddress returns an address for cryptocurrency deposits

func (*Bitflyer) GetCurrencyTradeURL

func (b *Bitflyer) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Bitflyer) GetDepositAddress

func (b *Bitflyer) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Bitflyer) GetDepositCancellationHistory

func (b *Bitflyer) GetDepositCancellationHistory()

GetDepositCancellationHistory returns the cancellation history of deposits

func (*Bitflyer) GetDepositHistory

func (b *Bitflyer) GetDepositHistory()

GetDepositHistory returns a full history of deposits

func (*Bitflyer) GetExchangeStatus

func (b *Bitflyer) GetExchangeStatus(ctx context.Context) (string, error)

GetExchangeStatus returns exchange status information

func (*Bitflyer) GetExecutionHistory

func (b *Bitflyer) GetExecutionHistory(ctx context.Context, symbol string) ([]ExecutedTrade, error)

GetExecutionHistory returns past trades that were executed on the market

func (*Bitflyer) GetExecutions

func (b *Bitflyer) GetExecutions()

GetExecutions returns execution details

func (*Bitflyer) GetFee

func (b *Bitflyer) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction TODO: Figure out the weird fee structure. Do we use Bitcoin Easy Exchange,Lightning Spot,Bitcoin Market,Lightning FX/Futures ???

func (*Bitflyer) GetFeeByType

func (b *Bitflyer) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on the type of transaction

func (*Bitflyer) GetFuturesContractDetails

func (b *Bitflyer) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Bitflyer) GetHistoricCandles

func (b *Bitflyer) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Bitflyer) GetHistoricCandlesExtended

func (b *Bitflyer) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Bitflyer) GetHistoricTrades

func (b *Bitflyer) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Bitflyer) GetLatestBlockCA

func (b *Bitflyer) GetLatestBlockCA(ctx context.Context) (ChainAnalysisBlock, error)

GetLatestBlockCA returns the latest block information from bitflyer chain analysis system

func (*Bitflyer) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Bitflyer) GetMarginChange

func (b *Bitflyer) GetMarginChange()

GetMarginChange returns collateral history

func (*Bitflyer) GetMarginStatus

func (b *Bitflyer) GetMarginStatus()

GetMarginStatus returns current margin status

func (*Bitflyer) GetMarkets

func (b *Bitflyer) GetMarkets(ctx context.Context) ([]MarketInfo, error)

GetMarkets returns market information

func (*Bitflyer) GetOpenInterestData

func (b *Bitflyer) GetOpenInterestData()

GetOpenInterestData returns a summary of open interest

func (*Bitflyer) GetOrderBook

func (b *Bitflyer) GetOrderBook(ctx context.Context, symbol string) (Orderbook, error)

GetOrderBook returns market orderbook depth

func (*Bitflyer) GetOrderHistory

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Bitflyer) GetOrderInfo

func (b *Bitflyer) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Bitflyer) GetParentOrderDetails

func (b *Bitflyer) GetParentOrderDetails()

GetParentOrderDetails returns a detailing of a parent order

func (*Bitflyer) GetParentOrders

func (b *Bitflyer) GetParentOrders()

GetParentOrders returns a list of all parent orders

func (*Bitflyer) GetPermissions

func (b *Bitflyer) GetPermissions()

GetPermissions returns current permissions for associated with your API keys

func (*Bitflyer) GetRecentTrades

func (b *Bitflyer) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns recent historic trades

func (*Bitflyer) GetServerTime

func (b *Bitflyer) GetServerTime(_ context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Bitflyer) GetTicker

func (b *Bitflyer) GetTicker(ctx context.Context, symbol string) (Ticker, error)

GetTicker returns ticker information

func (*Bitflyer) GetTradingCommission

func (b *Bitflyer) GetTradingCommission()

GetTradingCommission returns trading commission

func (*Bitflyer) GetTransactionByHashCA

func (b *Bitflyer) GetTransactionByHashCA(ctx context.Context, txHash string) (ChainAnalysisTransaction, error)

GetTransactionByHashCA returns transaction information by txHash from bitflyer chain analysis system

func (*Bitflyer) GetTransactionHistory

func (b *Bitflyer) GetTransactionHistory()

GetTransactionHistory returns a full history of transactions

func (*Bitflyer) GetWithdrawalsHistory

func (b *Bitflyer) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Bitflyer) ModifyOrder

func (b *Bitflyer) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Bitflyer) SendAuthHTTPRequest

func (b *Bitflyer) SendAuthHTTPRequest()

SendAuthHTTPRequest sends an authenticated HTTP request Note: HTTP not done due to incorrect account privileges, please open a PR if you have access and update the authenticated requests TODO: Fill out this function once API access is obtained

func (*Bitflyer) SendHTTPRequest

func (b *Bitflyer) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated request

func (*Bitflyer) SendOrder

func (b *Bitflyer) SendOrder()

SendOrder creates new order

func (*Bitflyer) SendParentOrder

func (b *Bitflyer) SendParentOrder()

SendParentOrder sends a special order

func (*Bitflyer) SetDefaults

func (b *Bitflyer) SetDefaults()

SetDefaults sets the basic defaults for Bitflyer

func (*Bitflyer) Setup

func (b *Bitflyer) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Bitflyer) SubmitOrder

func (b *Bitflyer) SubmitOrder(_ context.Context, _ *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Bitflyer) SubmitOrders added in v1.0.7

func (b *Bitflyer) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

func (*Bitflyer) UpdateAccountInfo

func (b *Bitflyer) UpdateAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies on the Bitflyer exchange

func (*Bitflyer) UpdateOrderExecutionLimits

func (b *Bitflyer) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error

UpdateOrderExecutionLimits updates order execution limits

func (*Bitflyer) UpdateOrderbook

func (b *Bitflyer) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Bitflyer) UpdateTicker

func (b *Bitflyer) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Bitflyer) UpdateTickers

func (b *Bitflyer) UpdateTickers(_ context.Context, _ asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Bitflyer) UpdateTradablePairs

func (b *Bitflyer) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Bitflyer) ValidateAPICredentials

func (b *Bitflyer) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Bitflyer) WithdrawCryptocurrencyFunds

func (b *Bitflyer) WithdrawCryptocurrencyFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bitflyer) WithdrawFiatFunds

func (b *Bitflyer) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bitflyer) WithdrawFiatFundsToInternationalBank

func (b *Bitflyer) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Bitflyer) WithdrawFunds

func (b *Bitflyer) WithdrawFunds()

WithdrawFunds withdraws funds to a certain bank

type CancellationHistory

type CancellationHistory struct {
	ID           int64   `json:"id"`
	OrderID      string  `json:"order_id"`
	CurrencyCode string  `json:"currency_code"`
	Amount       float64 `json:"amount"`
	Status       string  `json:"status"`
	EventDate    string  `json:"event_date"`
}

CancellationHistory cancellation history

type CashDeposit

type CashDeposit struct {
	ID           int64   `json:"id"`
	OrderID      string  `json:"order_id"`
	CurrencyCode string  `json:"currency_code"`
	Amount       float64 `json:"amount"`
	Status       string  `json:"status"`
	EventDate    string  `json:"event_date"`
}

CashDeposit holds cash deposit information

type ChainAnalysisAddress

type ChainAnalysisAddress struct {
	Address            string  `json:"address"`
	UnconfirmedBalance float64 `json:"unconfirmed_balance"`
	ConfirmedBalance   float64 `json:"confirmed_balance"`
}

ChainAnalysisAddress holds address information from the bitcoin network

type ChainAnalysisBlock

type ChainAnalysisBlock struct {
	BlockHash     string   `json:"block_hash"`
	Height        int64    `json:"height"`
	IsMain        bool     `json:"is_main"`
	Version       float64  `json:"version"`
	PreviousBlock string   `json:"prev_block"`
	MerkleRoot    string   `json:"merkle_root"`
	Timestamp     string   `json:"timestamp"`
	Bits          int64    `json:"bits"`
	Nonce         int64    `json:"nonce"`
	TxNum         int64    `json:"txnum"`
	TotalFees     float64  `json:"total_fees"`
	TxHashes      []string `json:"tx_hashes"`
}

ChainAnalysisBlock holds block information from the bitcoin network

type ChainAnalysisTransaction

type ChainAnalysisTransaction struct {
	TxHash        string  `json:"tx_hash"`
	BlockHeight   int64   `json:"block_height"`
	Confirmations int64   `json:"confirmed"`
	Fees          float64 `json:"fees"`
	Size          int64   `json:"size"`
	ReceivedDate  string  `json:"received_date"`
	Version       float64 `json:"version"`
	LockTime      int64   `json:"lock_time"`
	Inputs        []struct {
		PrevHash  string `json:"prev_hash"`
		PrevIndex int    `json:"prev_index"`
		Value     int64  `json:"value"`
		Script    string `json:"script"`
		Address   string `json:"address"`
		Sequence  int64  `json:"sequence"`
	} `json:"inputs"`
	Outputs []struct {
		Value   int64  `json:"value"`
		Script  string `json:"script"`
		Address string `json:"address"`
	} `json:"outputs"`
}

ChainAnalysisTransaction holds transaction data from the bitcoin network

type ChatLog

type ChatLog struct {
	Nickname string `json:"nickname"`
	Message  string `json:"message"`
	Date     string `json:"date"`
}

ChatLog holds chat log information

type CollateralAccounts

type CollateralAccounts struct {
	CurrencyCode string  `json:"currency_code"`
	Amount       float64 `json:"amount"`
}

CollateralAccounts holds collateral balances

type CollateralHistory

type CollateralHistory struct {
	ID           int64   `json:"id"`
	CurrencyCode string  `json:"currency_code"`
	Change       float64 `json:"change"`
	Amount       float64 `json:"amount"`
	Reason       string  `json:"reason_code"`
	Date         string  `json:"date"`
}

CollateralHistory holds collateral history data

type DepositAddress

type DepositAddress struct {
	Type         string `json:"type"`
	CurrencyCode string `json:"currency_code"`
	Address      string `json:"address"`
}

DepositAddress hold depositing address information

type DepositHistory

type DepositHistory struct {
	ID           int64   `json:"id"`
	OrderID      int64   `json:"order_id"`
	CurrencyCode string  `json:"currency_code"`
	Amount       float64 `json:"amount"`
	Address      string  `json:"address"`
	TXHash       string  `json:"tx_hash"`
	Status       string  `json:"status"`
	EventDate    string  `json:"event_date"`
}

DepositHistory holds deposit history information

type ExecutedTrade

type ExecutedTrade struct {
	ID             int64   `json:"id"`
	Side           string  `json:"side"`
	Price          float64 `json:"price"`
	Size           float64 `json:"size"`
	ExecDate       string  `json:"exec_date"`
	BuyAcceptedID  string  `json:"buy_child_order_acceptance_id"`
	SellAcceptedID string  `json:"sell_child_order_acceptance_id"`
}

ExecutedTrade holds past trade information

type Executions

type Executions struct {
	ID                     int64   `json:"id"`
	ChildOrderID           string  `json:"child_order_id"`
	Side                   string  `json:"side"`
	Price                  float64 `json:"price"`
	Size                   float64 `json:"size"`
	Commission             float64 `json:"commission"`
	ExecDate               string  `json:"exec_date"`
	ChildOrderAcceptanceID string  `json:"child_order_acceptance_id"`
}

Executions holds past executed trade details

type MarginStatus

type MarginStatus struct {
	Collateral         float64 `json:"collateral"`
	OpenPosPNL         float64 `json:"open_position_pnl"`
	RequiredCollateral float64 `json:"require_collateral"`
	KeepRate           float64 `json:"keep_rate"`
}

MarginStatus holds margin status information

type MarketInfo

type MarketInfo struct {
	ProductCode string `json:"product_code"`
	Alias       string `json:"alias"`
	MarketType  string `json:"market_type"`
}

MarketInfo holds market information returned from bitflyer

type NewOrder

type NewOrder struct {
	ProductCode    string  `json:"product_code"`
	ChildOrderType string  `json:"child_order_type"`
	Side           string  `json:"side"`
	Price          float64 `json:"price"`
	Size           float64 `json:"size"`
	MinuteToExpire float64 `json:"minute_to_expire"`
	TimeInForce    string  `json:"time_in_force"`
}

NewOrder to send a new order

type OpenInterest

type OpenInterest struct {
	ProductCode         string  `json:"product_code"`
	Side                string  `json:"side"`
	Price               float64 `json:"price"`
	Size                float64 `json:"size"`
	Commission          float64 `json:"commission"`
	SwapPointAccumulate float64 `json:"swap_point_accumulate"`
	RequiredCollateral  float64 `json:"require_collateral"`
	OpenDate            string  `json:"open_date"`
	Leverage            float64 `json:"leverage"`
	PNL                 float64 `json:"pnl"`
}

OpenInterest holds open interest information

type Orderbook

type Orderbook struct {
	MidPrice float64 `json:"mid_price"`
	Bids     []struct {
		Price float64 `json:"price"`
		Size  float64 `json:"size"`
	} `json:"bids"`
	Asks []struct {
		Price float64 `json:"price"`
		Size  float64 `json:"size"`
	} `json:"asks"`
}

Orderbook holds orderbook information

type Orders

type Orders struct {
	ID                     int64   `json:"id"`
	ChildOrderID           string  `json:"child_order_id"`
	ProductCode            string  `json:"product_code"`
	Side                   string  `json:"side"`
	ChildOrderType         string  `json:"child_order_type"`
	Price                  float64 `json:"price"`
	AveragePrice           float64 `json:"average_price"`
	Size                   float64 `json:"size"`
	ChildOrderState        string  `json:"child_order_state"`
	ExpireDate             string  `json:"expire_date"`
	ChildOrderDate         string  `json:"child_order_date"`
	ChildOrderAcceptanceID string  `json:"child_order_acceptance_id"`
	OutstandingSize        float64 `json:"outstanding_size"`
	CancelSize             float64 `json:"cancel_size"`
	ExecutedSize           float64 `json:"executed_size"`
	TotalCommission        float64 `json:"total_commission"`
}

Orders holds order full order information

type ParentOrderDetail

type ParentOrderDetail struct {
	ID              int64   `json:"id"`
	ParentOrderID   string  `json:"parent_order_id"`
	OrderMethod     string  `json:"order_method"`
	MinutesToExpire float64 `json:"minute_to_expire"`
	Parameters      []struct {
		ProductCode   string  `json:"product_code"`
		ConditionType string  `json:"condition_type"`
		Side          string  `json:"side"`
		Price         float64 `json:"price"`
		Size          float64 `json:"size"`
		TriggerPrice  float64 `json:"trigger_price"`
		Offset        float64 `json:"offset"`
	} `json:"parameters"`
}

ParentOrderDetail holds detailed information about an order

type ParentOrders

type ParentOrders struct {
	ID                      int64   `json:"id"`
	ParentOrderID           string  `json:"parent_order_id"`
	ProductCode             string  `json:"product_code"`
	Side                    string  `json:"side"`
	ParentOrderType         string  `json:"parent_order_type"`
	Price                   float64 `json:"price"`
	AveragePrice            float64 `json:"average_price"`
	Size                    float64 `json:"size"`
	ParentOrderState        string  `json:"parent_order_state"`
	ExpireDate              string  `json:"expire_date"`
	ParentOrderDate         string  `json:"parent_order_date"`
	ParentOrderAcceptanceID string  `json:"parent_order_acceptance_id"`
	OutstandingSize         float64 `json:"outstanding_size"`
	CancelSize              float64 `json:"cancel_size"`
	ExecutedSize            float64 `json:"executed_size"`
	TotalCommission         float64 `json:"total_commission"`
}

ParentOrders holds order full order information

type RateLimit

type RateLimit struct {
	Auth   *rate.Limiter
	UnAuth *rate.Limiter

	// Send a New Order
	// Submit New Parent Order (Special order)
	// Cancel All Orders
	Order     *rate.Limiter
	LowVolume *rate.Limiter
}

RateLimit implements the rate.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit limits outbound requests

type Ticker

type Ticker struct {
	ProductCode     string  `json:"product_code"`
	TimeStamp       string  `json:"timestamp"`
	TickID          int64   `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"`
	Last            float64 `json:"ltp"`
	Volume          float64 `json:"volume"`
	VolumeByProduct float64 `json:"volume_by_product"`
}

Ticker holds ticker information

type TransactionHistory

type TransactionHistory struct {
	ID            int64   `json:"id"`
	OrderID       int64   `json:"order_id"`
	CurrencyCode  string  `json:"currency_code"`
	Amount        float64 `json:"amount"`
	Address       string  `json:"address"`
	TXHash        string  `json:"tx_hash"`
	Fee           float64 `json:"fee"`
	AdditionalFee float64 `json:"additional_fee"`
	Status        string  `json:"status"`
	EventDate     string  `json:"event_date"`
}

TransactionHistory holds prior transaction history data

Jump to

Keyboard shortcuts

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