Documentation
¶
Index ¶
- Constants
- func ToPriceString(price float64) string
- func ToQtyString(size float64) string
- type Account
- type AccountBalance
- type AccountBalanceV2
- type Books
- type Client
- func (c *Client) CancelOrder(orderID int) (Order, error)
- func (c *Client) CloseAllTrade(side string) ([]Trade, error)
- func (c *Client) CloseLoanBid(loanBidID int) (LoanBid, error)
- func (c *Client) CloseTrade(tradeID int, closedQuantity float64) (Trade, error)
- func (c *Client) CreateFiatAccount(currency string) (Account, error)
- func (c *Client) CreateLoanBid(quantity, currency, rate string) (LoanBid, error)
- func (c *Client) CreateOrder(o *RequestOrder) (Order, error)
- func (c *Client) EditLiveOrder(id int, e *EditOrderParams) (Order, error)
- func (c *Client) GetATradingAccount(tradingAccountID int) (TradingAccount, error)
- func (c *Client) GetAllAccountBalances() ([]AccountBalance, error)
- func (c *Client) GetAllAccountBalancesV2() (AccountBalanceV2, error)
- func (c *Client) GetCryptoAccounts() ([]CryptoAccount, error)
- func (c *Client) GetExecutions(productID int, limit int, page int) (Executions, error)
- func (c *Client) GetExecutionsByTimestamp(productID int, limit int, timestamp int) ([]ExecutionsModels, error)
- func (c *Client) GetFiatAccounts() ([]Account, error)
- func (c *Client) GetInterestRates(currency string) (InterestRates, error)
- func (c *Client) GetLoanBids(currency string) (LoanBids, error)
- func (c *Client) GetLoans(currency string) (Loans, error)
- func (c *Client) GetOrder(orderID int) (Order, error)
- func (c *Client) GetOrderBook(productID int, full bool) (Depth, error)
- func (c *Client) GetOrderByClientID(clientID string) (Order, error)
- func (c *Client) GetOrderTrades(orderID int) ([]Trade, error)
- func (c *Client) GetOrders(filters OrdersFilter) (Order, error)
- func (c *Client) GetOwnExecutions(productID int) (Executions, error)
- func (c *Client) GetProduct(productID int) (Product, error)
- func (c *Client) GetProducts() ([]Product, error)
- func (c *Client) GetTrades(fundingCurrency, status string) (Trades, error)
- func (c *Client) GetTradesLoans(tradeID int) ([]Loan, error)
- func (c *Client) GetTradingAccounts() ([]TradingAccount, error)
- func (p *Client) OrderAllClose()
- func (c *Client) UpdateALoan(loanID int, fundReloaned bool) (Loan, error)
- func (c *Client) UpdateLeverageLevel(tradeAccountID, leverageLevel int) (TradingAccount, error)
- func (c *Client) UpdateTrade(tradeID, stopLoss, takeProfit int) (Trade, error)
- type CryptoAccount
- type Depth
- func (p *Depth) GetBuyDepthFloat64() [][]float64
- func (p *Depth) GetSellDepthFloat64() [][]float64
- func (p *Depth) SortBuyDepthByPrice(order string) [][]float64
- func (p *Depth) SortBuyDepthByQuontity() [][]float64
- func (p *Depth) SortSellDepthByPrice(order string) [][]float64
- func (p *Depth) SortSellDepthByQuontity() [][]float64
- type EditOrderParams
- type Executions
- type ExecutionsModels
- type InterestRates
- type Limit
- type Loan
- type LoanBid
- type LoanBids
- type Loans
- type Order
- type OrderExecutions
- type OrderParams
- type Orders
- type OrdersFilter
- type Product
- type PusherBooks
- type PusherExecution
- type PusherExecutionMe
- type Realtime
- type RequestOrder
- type Trade
- type Trades
- type TradingAccount
Constants ¶
View Source
const ( BASEURL = "https://api.liquid.com" VERSION = "2" FUNDJPY = "JPY" FUNDUSD = "USD" LIMIT = "limit" MARKET = "market" BUY = "buy" SELL = "sell" NETOUT = "netout" ONEDIRECTION = "one_direction" TWODIRECTION = "two_direction" APILIMIT = 300 // par 5minutes )
View Source
const ( PUSHERAPPNAME = "" PUSHERKEY = "LIQUID" PUSHERTAPHOST = "tap.liquid.com" PUSHERchEXECUTION = "executions_cash_%s" PUSHERchDETAILEXECUTION = "execution_details_cash_%s" PUSHERchUSEREXECUTION = "user_executions_cash_%s" PUSHERchASK = "price_ladders_cash_%s_sell" PUSHERchBID = "price_ladders_cash_%s_buy" PUSHERCREATED = "created" PUSHERUPDATE = "updated" BTCJPY = "btcjpy" BTCUSD = "btcusd" ETHJPY = "ethjpy" ETHUSD = "ethusd" XRPJPY = "xrpjpy" XRPUSD = "xrpusd" QASHJPY = "qashjpy" )
View Source
const (
PRODUCT5_BTCJPY int
)
Variables ¶
This section is empty.
Functions ¶
func ToPriceString ¶
ToPriceString is float to string price.00001
Types ¶
type Account ¶
type Account struct {
ID int `json:"id"`
Currency string `json:"currency"`
CurrencySymbol string `json:"currency_symbol"`
Balance float64 `json:"balance,string"`
PusherChannel string `json:"pusher_channel"`
LowestOfferInterestRate float64 `json:"lowest_offer_interest_rate,string"`
HighestOfferInterestRate float64 `json:"highest_offer_interest_rate,string"`
ExchangeRate big.Float `json:"exchange_rate,string"`
CurrencyType string `json:"currency_type"`
}
type AccountBalance ¶
type AccountBalanceV2 ¶ added in v1.0.3
type AccountBalanceV2 struct {
CryptoAccounts []struct {
ID int `json:"id,omitempty"`
Currency string `json:"currency,omitempty"`
Balance string `json:"balance,omitempty"`
ReservedBalance string `json:"reserved_balance,omitempty"`
PusherChannel string `json:"pusher_channel,omitempty"`
LowestOfferInterestRate interface{} `json:"lowest_offer_interest_rate,omitempty"`
HighestOfferInterestRate interface{} `json:"highest_offer_interest_rate,omitempty"`
Address interface{} `json:"address,omitempty"`
CurrencySymbol string `json:"currency_symbol,omitempty"`
MinimumWithdraw interface{} `json:"minimum_withdraw,omitempty"`
CurrencyType string `json:"currency_type,omitempty"`
} `json:"crypto_accounts,omitempty"`
FiatAccounts []struct {
ID int `json:"id,omitempty"`
Currency string `json:"currency,omitempty"`
Balance string `json:"balance,omitempty"`
ReservedBalance string `json:"reserved_balance,omitempty"`
PusherChannel string `json:"pusher_channel,omitempty"`
LowestOfferInterestRate interface{} `json:"lowest_offer_interest_rate,omitempty"`
HighestOfferInterestRate interface{} `json:"highest_offer_interest_rate,omitempty"`
CurrencySymbol string `json:"currency_symbol,omitempty"`
SendToBtcAddress interface{} `json:"send_to_btc_address,omitempty"`
ExchangeRate string `json:"exchange_rate,omitempty"`
CurrencyType string `json:"currency_type,omitempty"`
} `json:"fiat_accounts,omitempty"`
}
type Client ¶
type Client struct {
URL *url.URL
TokenNumber string
Secret string
HTTPClient *http.Client
Logger *log.Logger
}
func (*Client) CloseTrade ¶
func (*Client) CreateFiatAccount ¶
func (*Client) CreateLoanBid ¶
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(o *RequestOrder) (Order, error)
orderType, side, quantity, price, priceRange string, productID int
func (*Client) EditLiveOrder ¶
func (c *Client) EditLiveOrder(id int, e *EditOrderParams) (Order, error)
func (c *Client) EditLiveOrder(orderID int, quantity, price string) (Order, error) {
func (*Client) GetATradingAccount ¶
func (c *Client) GetATradingAccount(tradingAccountID int) (TradingAccount, error)
func (*Client) GetAllAccountBalances ¶
func (c *Client) GetAllAccountBalances() ([]AccountBalance, error)
func (*Client) GetAllAccountBalancesV2 ¶ added in v1.0.3
func (c *Client) GetAllAccountBalancesV2() (AccountBalanceV2, error)
func (*Client) GetCryptoAccounts ¶
func (c *Client) GetCryptoAccounts() ([]CryptoAccount, error)
func (*Client) GetExecutions ¶
func (*Client) GetExecutionsByTimestamp ¶
func (*Client) GetFiatAccounts ¶
func (*Client) GetInterestRates ¶
func (c *Client) GetInterestRates(currency string) (InterestRates, error)
func (*Client) GetOrderBook ¶
func (*Client) GetOrderByClientID ¶
func (*Client) GetOwnExecutions ¶
func (c *Client) GetOwnExecutions(productID int) (Executions, error)
func (*Client) GetProducts ¶
func (*Client) GetTradingAccounts ¶
func (c *Client) GetTradingAccounts() ([]TradingAccount, error)
func (*Client) OrderAllClose ¶
func (p *Client) OrderAllClose()
https://api.liquid.com/trades/close_all?funding_currency=JPY&product_id=5 OrderAllClose
func (*Client) UpdateALoan ¶
func (*Client) UpdateLeverageLevel ¶
func (c *Client) UpdateLeverageLevel(tradeAccountID, leverageLevel int) (TradingAccount, error)
type CryptoAccount ¶
type CryptoAccount struct {
ID int `json:"id"`
Balance string `json:"balance"`
Address string `json:"address"`
Currency string `json:"currency"`
CurrencySymbol string `json:"currency_symbol"`
PusherChannel string `json:"pusher_channel"`
MinimumWithdraw float64 `json:"minimum_withdraw"`
LowestOfferInterestRate string `json:"lowest_offer_interest_rate"`
HighestOfferInterestRate string `json:"highest_offer_interest_rate"`
CurrencyType string `json:"currency_type"`
}
type Depth ¶
type Depth struct {
BuyPriceLevels Books `json:"buy_price_levels"`
SellPriceLevels Books `json:"sell_price_levels"`
}
func (*Depth) GetBuyDepthFloat64 ¶
func (*Depth) GetSellDepthFloat64 ¶
func (*Depth) SortBuyDepthByPrice ¶
func (*Depth) SortBuyDepthByQuontity ¶
func (*Depth) SortSellDepthByPrice ¶
func (*Depth) SortSellDepthByQuontity ¶
type EditOrderParams ¶
type Executions ¶
type Executions struct {
Models []ExecutionsModels `json:"models"`
CurrentPage int `json:"current_page"`
TotalPages int `json:"total_pages"`
}
type ExecutionsModels ¶
type InterestRates ¶
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
Limit is managed API Limit
type Loan ¶
type Loan struct {
ID int `json:"id"`
Quantity string `json:"quantity"`
Rate string `json:"rate"`
CreatedAt int64 `json:"created_at"`
LenderID int `json:"lender_id"`
BorrowerID int `json:"borrower_id"`
Status string `json:"status"`
Currency string `json:"currency"`
FundReloaned bool `json:"fund_reloaned"`
}
type LoanBid ¶
type LoanBid struct {
ID int `json:"id"`
BidaskType string `json:"bidask_type"`
Quantity float64 `json:"quantity,string"`
Currency string `json:"currency"`
Side string `json:"side"`
FilledQuantity float64 `json:"filled_quantity,string"`
Status string `json:"status"`
Rate float64 `json:"rate,string"`
UserID int `json:"user_id"`
}
type Order ¶
type Order struct {
ID int64 `json:"id,omitempty"`
OrderType string `json:"order_type,omitempty"`
Quantity decimal.Decimal `json:"quantity,omitempty"`
DiscQuantity decimal.Decimal `json:"disc_quantity,omitempty"`
IcebergTotalQuantity decimal.Decimal `json:"iceberg_total_quantity,omitempty"`
Side string `json:"side,omitempty"`
FilledQuantity decimal.Decimal `json:"filled_quantity,omitempty"`
Price decimal.Decimal `json:"price,omitempty"`
CreatedAt int `json:"created_at,omitempty"`
UpdatedAt int `json:"updated_at,omitempty"`
Status string `json:"status,omitempty"`
LeverageLevel int `json:"leverage_level,omitempty"`
SourceExchange interface{} `json:"source_exchange,omitempty"`
ProductID int `json:"product_id,omitempty"`
MarginType interface{} `json:"margin_type,omitempty"`
TakeProfit interface{} `json:"take_profit,omitempty"`
StopLoss interface{} `json:"stop_loss,omitempty"`
TradingType string `json:"trading_type,omitempty"`
ProductCode string `json:"product_code,omitempty"`
FundingCurrency string `json:"funding_currency,omitempty"`
CryptoAccountID interface{} `json:"crypto_account_id,omitempty"`
CurrencyPairCode string `json:"currency_pair_code,omitempty"`
AveragePrice decimal.Decimal `json:"average_price,omitempty"`
Target string `json:"target,omitempty"`
OrderFee decimal.Decimal `json:"order_fee,omitempty"`
SourceAction string `json:"source_action,omitempty"`
UnwoundTradeID interface{} `json:"unwound_trade_id,omitempty"`
TradeID interface{} `json:"trade_id,omitempty"`
ClientOrderID string `json:"client_order_id,omitempty"`
Settings interface{} `json:"settings,omitempty"`
TrailingStopType interface{} `json:"trailing_stop_type,omitempty"`
TrailingStopValue interface{} `json:"trailing_stop_value,omitempty"`
StopTriggeredTime interface{} `json:"stop_triggered_time,omitempty"`
MarginUsed decimal.Decimal `json:"margin_used,omitempty"`
MarginInterest decimal.Decimal `json:"margin_interest,omitempty"`
UnwoundTradeLeverageLevel interface{} `json:"unwound_trade_leverage_level,omitempty"`
}
type OrderExecutions ¶
type OrderParams ¶
type OrderParams struct {
OrderType string `json:"order_type"` // limit, market or market_with_range
ProductID int `json:"product_id"`
Side string `json:"side"`
Quantity string `json:"quantity"`
Price string `json:"price,omitempty"`
PriceRange string `json:"price_range,omitempty"` // order type optional
// Margin trade
LeverageLevel int `json:"leverage_level,omitempty"`
FundingCurrency string `json:"funding_currency,omitempty"`
OrderDirection string `json:"order_direction,omitempty"`
// CFD Optionals
TradingType string `json:"trading_type,omitempty"` // margin or cfd, only available if leverage_level > 1
MarginType string `json:"margin_type,omitempty"` // cross or isolated, only available if leverage_level > 1, default is cross
// ClientID
ClientOrderID string `json:"client_order_id,omitempty"`
}
type OrdersFilter ¶
type OrdersFilter struct {
ProductID string `json:"product_id,omitempty"`
WithDetails string `json:"with_details,omitempty"`
Status string `json:"status,omitempty"`
FundingCurrency string `json:"funding_currency,omitempty"`
// 下記Doc非公開フィルター
// WebAPI: page=1&limit=24¤cy_pair_code=BTCJPY&status=live&trading_type=cfd
Page string `json:"page,omitempty"`
Limit string `json:"limit,omitempty"`
CurrencyPairCode string `json:"currency_pair_code,omitempty"`
TradingType string `json:"trading_type,omitempty"`
}
type Product ¶
type Product struct {
ID string `json:"id"`
ProductType string `json:"product_type"`
Code string `json:"code"`
Name string `json:"name"`
MarketAsk float64 `json:"market_ask,string"`
MarketBid float64 `json:"market_bid,string"`
Indicator int `json:"indicator"`
Currency string `json:"currency"`
CurrencyPairCode string `json:"currency_pair_code"`
Symbol string `json:"symbol"`
FiatMinimumWithdraw float64 `json:"fiat_minimum_withdraw,string"`
PusherChannel string `json:"pusher_channel"`
TakerFee float64 `json:"taker_fee,string"`
MakerFee float64 `json:"maker_fee,string"`
LowMarketBid float64 `json:"low_market_bid,string"`
HighMarketAsk float64 `json:"high_market_ask,string"`
Volume24H float64 `json:"volume_24h,string"`
LastPrice24H float64 `json:"last_price_24h,string"`
LastTradedPrice float64 `json:"last_traded_price,string"`
LastTradedQuantity float64 `json:"last_traded_quantity,string"`
QuotedCurrency string `json:"quoted_currency"`
BaseCurrency string `json:"base_currency"`
ExchangeRate float64 `json:"exchange_rate,string"`
}
type PusherExecution ¶
type PusherExecution struct {
CreatedAt int64 `json:"created_at"`
ID int `json:"id"`
Price float64 `json:"price,string"`
Quantity float64 `json:"quantity,string"`
TakerSide string `json:"taker_side"`
Delay time.Duration
}
PusherExecution for Pusher
type PusherExecutionMe ¶
type PusherExecutionMe struct {
ID int `json:"id"`
OrderID int `json:"order_id"`
CreatedAt int64 `json:"created_at"`
Quantity float64 `json:"quantity,string"`
Price float64 `json:"price,string"`
TakerSide string `json:"taker_side"`
MySide string `json:"my_side"`
ClientOrderID string `json:"client_order_id"`
Delay time.Duration
}
PusherExecution for Pusher
type RequestOrder ¶
type RequestOrder struct {
Order OrderParams `json:"order"`
}
type Trade ¶
type Trade struct {
ID int `json:"id"`
CurrencyPairCode string `json:"currency_pair_code"`
Status string `json:"status"`
Side string `json:"side"`
MarginUsed float64 `json:"margin_used,string"`
OpenQuantity float64 `json:"open_quantity,string"`
CloseQuantity float64 `json:"close_quantity,string"`
Quantity float64 `json:"quantity,string"`
LeverageLevel int `json:"leverage_level"`
ProductCode string `json:"product_code"`
ProductID int `json:"product_id"`
OpenPrice float64 `json:"open_price,string"`
ClosePrice float64 `json:"close_price,string"`
TraderID int `json:"trader_id"`
OpenPnl float64 `json:"open_pnl,string"`
ClosePnl float64 `json:"close_pnl,string"`
Pnl float64 `json:"pnl,string"`
StopLoss float64 `json:"stop_loss,string"`
TakeProfit float64 `json:"take_profit,string"`
FundingCurrency string `json:"funding_currency"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
CloseFee float64 `json:"close_fee,string"`
TotalInterest float64 `json:"total_interest,string"`
DailyInterest float64 `json:"daily_interest,string"`
}
type TradingAccount ¶
type TradingAccount struct {
ID int `json:"id"`
LeverageLevel int `json:"leverage_level"`
MaxLeverageLevel int `json:"max_leverage_level"`
Pnl json.Number `json:"pnl"`
Equity json.Number `json:"equity"`
Margin json.Number `json:"margin"`
FreeMargin json.Number `json:"free_margin"`
TraderID int `json:"trader_id"`
Status string `json:"status"`
ProductCode string `json:"product_code"`
CurrencyPairCode string `json:"currency_pair_code"`
Position json.Number `json:"position"`
Balance json.Number `json:"balance"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
PusherChannel string `json:"pusher_channel"`
MarginPercent json.Number `json:"margin_percent"`
ProductID int `json:"product_id"`
FundingCurrency string `json:"funding_currency"`
}
Click to show internal directories.
Click to hide internal directories.