gemini

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 35 Imported by: 0

README

GoCryptoTrader package Gemini

Build Status Software License GoDoc Coverage Status Go Report Card

This gemini 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

Gemini 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 g exchange.IBotExchange

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

// Public calls - wrapper functions

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

// Fetches current orderbook information
ob, err := g.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 := g.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

// Fetches current orderbook information
ob, err := g.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 := g.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := g.Trade(...)
if err != nil {
	// Handle error
}
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

Overview

Package gemini exchange documentation can be found at https://docs.sandbox.gemini.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auction

type Auction struct {
	LastAuctionEID               int64   `json:"last_auction_eid"`
	ClosedUntilMs                int64   `json:"closed_until_ms"`
	LastAuctionPrice             float64 `json:"last_auction_price,string"`
	LastAuctionQuantity          float64 `json:"last_auction_quantity,string"`
	LastHighestBidPrice          float64 `json:"last_highest_bid_price,string"`
	LastLowestAskPrice           float64 `json:"last_lowest_ask_price,string"`
	NextAuctionMS                int64   `json:"next_auction_ms"`
	NextUpdateMS                 int64   `json:"next_update_ms"`
	MostRecentIndicativePrice    float64 `json:"most_recent_indicative_price,string"`
	MostRecentIndicativeQuantity float64 `json:"most_recent_indicative_quantity,string"`
	MostRecentHighestBidPrice    float64 `json:"most_recent_highest_bid_price,string"`
	MostRecentLowestAskPrice     float64 `json:"most_recent_lowest_ask_price,string"`
}

Auction is generalized response type

type AuctionHistory

type AuctionHistory struct {
	AuctionID       int64   `json:"auction_id"`
	AuctionPrice    float64 `json:"auction_price,string"`
	AuctionQuantity float64 `json:"auction_quantity,string"`
	EID             int64   `json:"eid"`
	HighestBidPrice float64 `json:"highest_bid_price,string"`
	LowestAskPrice  float64 `json:"lowest_ask_price,string"`
	AuctionResult   string  `json:"auction_result"`
	Timestamp       int64   `json:"timestamp"`
	TimestampMS     int64   `json:"timestampms"`
	EventType       string  `json:"event_type"`
}

AuctionHistory holds auction history information

type Balance

type Balance struct {
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount,string"`
	Available float64 `json:"available,string"`
}

Balance is a simple balance type

type DepositAddress

type DepositAddress struct {
	Currency string `json:"currency"`
	Address  string `json:"address"`
	Label    string `json:"label"`
	Message  string `json:"message"`
}

DepositAddress holds assigned deposit address for a specific currency

type ErrorCapture

type ErrorCapture struct {
	Result  string `json:"result"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

ErrorCapture is a generalized error response from the server

type Gemini

type Gemini struct {
	exchange.Base
}

Gemini is the overarching type across the Gemini package, create multiple instances with differing APIkeys for segregation of roles for authenticated requests & sessions by appending new sessions to the Session map using AddSession. If sandbox test is needed, append a new session with the same API keys and change the IsSandbox variable to true.

func (*Gemini) CancelAllOrders

func (g *Gemini) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Gemini) CancelBatchOrders

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

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Gemini) CancelExistingOrder

func (g *Gemini) CancelExistingOrder(ctx context.Context, orderID int64) (Order, error)

CancelExistingOrder will cancel an order. If the order is already canceled, the message will succeed but have no effect.

func (*Gemini) CancelExistingOrders

func (g *Gemini) CancelExistingOrders(ctx context.Context, cancelBySession bool) (OrderResult, error)

CancelExistingOrders will cancel all outstanding orders created by all sessions owned by this account, including interactive orders placed through the UI. If sessions = true will only cancel the order that is called on this session associated with the APIKEY

func (*Gemini) CancelOrder

func (g *Gemini) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Gemini) FetchAccountInfo

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

FetchAccountInfo retrieves balances for all enabled currencies

func (*Gemini) FetchOrderbook

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

FetchOrderbook returns orderbook base on the currency pair

func (*Gemini) FetchTicker

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

FetchTicker returns the ticker for a currency pair

func (*Gemini) FetchTradablePairs

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

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Gemini) GenerateDefaultSubscriptions

func (g *Gemini) GenerateDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*Gemini) GetAccountFundingHistory

func (g *Gemini) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Gemini) GetActiveOrders

func (g *Gemini) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Gemini) GetAuction

func (g *Gemini) GetAuction(ctx context.Context, currencyPair string) (Auction, error)

GetAuction returns auction information

func (*Gemini) GetAuctionHistory

func (g *Gemini) GetAuctionHistory(ctx context.Context, currencyPair string, params url.Values) ([]AuctionHistory, error)

GetAuctionHistory returns the auction events, optionally including publications of indicative prices, since the specific timestamp.

currencyPair - example "btcusd" params -- [optional]

since - [timestamp] Only returns auction events after the specified

timestamp.

limit_auction_results - [integer] The maximum number of auction

events to return.

include_indicative - [bool] Whether to include publication of

indicative prices and quantities.

func (*Gemini) GetBalances

func (g *Gemini) GetBalances(ctx context.Context) ([]Balance, error)

GetBalances returns available balances in the supported currencies

func (*Gemini) GetCryptoDepositAddress

func (g *Gemini) GetCryptoDepositAddress(ctx context.Context, depositAddlabel, currency string) (DepositAddress, error)

GetCryptoDepositAddress returns a deposit address

func (*Gemini) GetCurrencyTradeURL

func (g *Gemini) 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 (*Gemini) GetDepositAddress

func (g *Gemini) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Gemini) GetFee

func (g *Gemini) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Gemini) GetFeeByType

func (g *Gemini) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Gemini) GetFuturesContractDetails

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

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Gemini) GetHistoricCandles

func (g *Gemini) 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 (*Gemini) GetHistoricCandlesExtended

func (g *Gemini) 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 (*Gemini) GetHistoricTrades

func (g *Gemini) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Gemini) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Gemini) GetNotionalVolume

func (g *Gemini) GetNotionalVolume(ctx context.Context) (NotionalVolume, error)

GetNotionalVolume returns the volume in price currency that has been traded across all pairs over a period of 30 days

func (*Gemini) GetOrderHistory

func (g *Gemini) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

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

func (*Gemini) GetOrderInfo

func (g *Gemini) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Gemini) GetOrderStatus

func (g *Gemini) GetOrderStatus(ctx context.Context, orderID int64) (Order, error)

GetOrderStatus returns the status for an order

func (*Gemini) GetOrderbook

func (g *Gemini) GetOrderbook(ctx context.Context, currencyPair string, params url.Values) (*Orderbook, error)

GetOrderbook returns the current order book, as two arrays, one of bids, and one of asks

params - limit_bids or limit_asks [OPTIONAL] default 50, 0 returns all Values Type is an integer ie "params.Set("limit_asks", 30)"

func (*Gemini) GetOrders

func (g *Gemini) GetOrders(ctx context.Context) ([]Order, error)

GetOrders returns active orders in the market

func (*Gemini) GetRecentTrades

func (g *Gemini) GetRecentTrades(ctx context.Context, pair currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Gemini) GetServerTime

func (g *Gemini) GetServerTime(_ context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Gemini) GetSymbolDetails

func (g *Gemini) GetSymbolDetails(ctx context.Context, symbol string) ([]SymbolDetails, error)

GetSymbolDetails returns extra symbol details use symbol "all" to get everything

func (*Gemini) GetSymbols

func (g *Gemini) GetSymbols(ctx context.Context) ([]string, error)

GetSymbols returns all available symbols for trading

func (*Gemini) GetTicker

func (g *Gemini) GetTicker(ctx context.Context, currencyPair string) (TickerV2, error)

GetTicker returns information about recent trading activity for the symbol

func (*Gemini) GetTradeHistory

func (g *Gemini) GetTradeHistory(ctx context.Context, currencyPair string, timestamp int64) ([]TradeHistory, error)

GetTradeHistory returns an array of trades that have been on the exchange

currencyPair - example "btcusd" timestamp - [optional] Only return trades on or after this timestamp.

func (*Gemini) GetTradeVolume

func (g *Gemini) GetTradeVolume(ctx context.Context) ([][]TradeVolume, error)

GetTradeVolume returns a multi-arrayed volume response

func (*Gemini) GetTrades

func (g *Gemini) GetTrades(ctx context.Context, currencyPair string, since, limit int64, includeBreaks bool) ([]Trade, error)

GetTrades return the trades that have executed since the specified timestamp. Timestamps are either seconds or milliseconds since the epoch (1970-01-01).

currencyPair - example "btcusd" params -- since, timestamp [optional] limit_trades integer Optional. The maximum number of trades to return. include_breaks boolean Optional. Whether to display broken trades. False by default. Can be '1' or 'true' to activate

func (*Gemini) GetWithdrawalsHistory

func (g *Gemini) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Gemini) ModifyOrder

func (g *Gemini) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

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

func (*Gemini) NewOrder

func (g *Gemini) NewOrder(ctx context.Context, symbol string, amount, price float64, side, orderType string) (int64, error)

NewOrder Only limit orders are supported through the API at present. returns order ID if successful

func (*Gemini) PostHeartbeat

func (g *Gemini) PostHeartbeat(ctx context.Context) (string, error)

PostHeartbeat sends a maintenance heartbeat to the exchange for all heartbeat maintained sessions

func (*Gemini) SendAuthenticatedHTTPRequest

func (g *Gemini) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, params map[string]interface{}, result interface{}) (err error)

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to the exchange and returns an error

func (*Gemini) SendHTTPRequest

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

SendHTTPRequest sends an unauthenticated request

func (*Gemini) SetDefaults

func (g *Gemini) SetDefaults()

SetDefaults sets package defaults for gemini exchange

func (*Gemini) Setup

func (g *Gemini) Setup(exch *config.Exchange) error

Setup sets exchange configuration parameters

func (*Gemini) SubmitOrder

func (g *Gemini) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Gemini) Subscribe

func (g *Gemini) Subscribe(channelsToSubscribe []subscription.Subscription) error

Subscribe sends a websocket message to receive data from the channel

func (*Gemini) Transfers

func (g *Gemini) Transfers(ctx context.Context, curr currency.Code, start time.Time, limit int64, account string, showCompletedDeposit bool) ([]TransferResponse, error)

Transfers returns transfer history ie withdrawals and deposits

func (*Gemini) Unsubscribe

func (g *Gemini) Unsubscribe(channelsToUnsubscribe []subscription.Subscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*Gemini) UpdateAccountInfo

func (g *Gemini) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo Retrieves balances for all enabled currencies for the Gemini exchange

func (*Gemini) UpdateOrderExecutionLimits

func (g *Gemini) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

UpdateOrderExecutionLimits sets exchange executions for a required asset type

func (*Gemini) UpdateOrderbook

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

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Gemini) UpdateTicker

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

UpdateTicker updates and returns the ticker for a currency pair

func (*Gemini) UpdateTickers

func (g *Gemini) UpdateTickers(_ context.Context, _ asset.Item) error

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

func (*Gemini) UpdateTradablePairs

func (g *Gemini) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

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

func (*Gemini) ValidateAPICredentials

func (g *Gemini) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Gemini) WithdrawCrypto

func (g *Gemini) WithdrawCrypto(ctx context.Context, address, currency string, amount float64) (WithdrawalAddress, error)

WithdrawCrypto withdraws crypto currency to a whitelisted address

func (*Gemini) WithdrawCryptocurrencyFunds

func (g *Gemini) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Gemini) WithdrawFiatFunds

func (g *Gemini) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Gemini) WithdrawFiatFundsToInternationalBank

func (g *Gemini) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Gemini) WsAuth

func (g *Gemini) WsAuth(ctx context.Context, dialer *websocket.Dialer) error

WsAuth will connect to Gemini's secure endpoint

func (*Gemini) WsConnect

func (g *Gemini) WsConnect() error

WsConnect initiates a websocket connection

type NotionalVolume

type NotionalVolume struct {
	APIAuctionFeeBPS      int64                  `json:"api_auction_fee_bps"`
	APIMakerFeeBPS        int64                  `json:"api_maker_fee_bps"`
	APITakerFeeBPS        int64                  `json:"api_taker_fee_bps"`
	BlockMakerFeeBPS      int64                  `json:"block_maker_fee_bps"`
	BlockTakerFeeBPS      int64                  `json:"block_taker_fee_bps"`
	FixAuctionFeeBPS      int64                  `json:"fix_auction_fee_bps"`
	FixMakerFeeBPS        int64                  `json:"fix_maker_fee_bps"`
	FixTakerFeeBPS        int64                  `json:"fix_taker_fee_bps"`
	OneDayNotionalVolumes []OneDayNotionalVolume `json:"notional_1d_volume"`
	ThirtyDayVolume       float64                `json:"notional_30d_volume"`
	WebAuctionFeeBPS      int64                  `json:"web_auction_fee_bps"`
	WebMakerFeeBPS        int64                  `json:"web_maker_fee_bps"`
	WebTakerFeeBPS        int64                  `json:"web_taker_fee_bps"`
	LastedUpdated         int64                  `json:"last_updated_ms"`
	Date                  string                 `json:"date"`
}

NotionalVolume api call for fees, all return fee amounts are in basis points

type OneDayNotionalVolume

type OneDayNotionalVolume struct {
	Date             string  `json:"date"`
	NotationalVolume float64 `json:"notional_volume"`
}

OneDayNotionalVolume Contains the notioanl volume for a single day

type Order

type Order struct {
	OrderID           int64    `json:"order_id,string"`
	ID                int64    `json:"id,string"`
	ClientOrderID     string   `json:"client_order_id"`
	Symbol            string   `json:"symbol"`
	Exchange          string   `json:"exchange"`
	Price             float64  `json:"price,string"`
	AvgExecutionPrice float64  `json:"avg_execution_price,string"`
	Side              string   `json:"side"`
	Type              string   `json:"type"`
	Timestamp         int64    `json:"timestamp,string"`
	TimestampMS       int64    `json:"timestampms"`
	IsLive            bool     `json:"is_live"`
	IsCancelled       bool     `json:"is_cancelled"`
	IsHidden          bool     `json:"is_hidden"`
	Options           []string `json:"options"`
	WasForced         bool     `json:"was_forced"`
	ExecutedAmount    float64  `json:"executed_amount,string"`
	RemainingAmount   float64  `json:"remaining_amount,string"`
	OriginalAmount    float64  `json:"original_amount,string"`
	Message           string   `json:"message"`
}

Order contains order information

type OrderResult

type OrderResult struct {
	Result  string `json:"result"`
	Details struct {
		CancelledOrders []string `json:"cancelledOrders"`
		CancelRejects   []string `json:"cancelRejects"`
	} `json:"details"`
	Message string `json:"message"`
}

OrderResult holds cancelled order information

type Orderbook

type Orderbook struct {
	Bids []OrderbookEntry `json:"bids"`
	Asks []OrderbookEntry `json:"asks"`
}

Orderbook contains orderbook information for both bid and ask side

type OrderbookEntry

type OrderbookEntry struct {
	Price  float64 `json:"price,string"`
	Amount float64 `json:"amount,string"`
}

OrderbookEntry subtype of orderbook information

type RateLimit

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

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit limits the endpoint functionality

type SymbolDetails

type SymbolDetails struct {
	Symbol                string       `json:"symbol"`
	BaseCurrency          string       `json:"base_currency"`
	QuoteCurrency         string       `json:"quote_currency"`
	TickSize              float64      `json:"tick_size"`
	QuoteIncrement        float64      `json:"quote_increment"`
	MinOrderSize          types.Number `json:"min_order_size"`
	Status                string       `json:"status"`
	WrapEnabled           bool         `json:"wrap_enabled"`
	ProductType           string       `json:"product_type"`
	ContractType          string       `json:"contract_type"`
	ContractPriceCurrency string       `json:"contract_price_currency"`
}

SymbolDetails contains additional symbol details

type Ticker

type Ticker struct {
	Ask    float64 `json:"ask,string"`
	Bid    float64 `json:"bid,string"`
	Last   float64 `json:"last,string"`
	Volume struct {
		Currency  float64
		USD       float64
		BTC       float64
		ETH       float64
		Timestamp int64
	}
}

Ticker holds returned ticker data from the exchange

type TickerV2

type TickerV2 struct {
	Ask     float64  `json:"ask,string"`
	Bid     float64  `json:"bid,string"`
	Changes []string `json:"changes"`
	Close   float64  `json:"close,string"`
	High    float64  `json:"high,string"`
	Low     float64  `json:"low,string"`
	Open    float64  `json:"open,string"`
	Message string   `json:"message,omitempty"`
	Reason  string   `json:"reason,omitempty"`
	Result  string   `json:"result,omitempty"`
	Symbol  string   `json:"symbol"`
}

TickerV2 holds returned ticker data from the exchange

type Trade

type Trade struct {
	Timestamp   int64   `json:"timestamp"`
	Timestampms int64   `json:"timestampms"`
	TID         int64   `json:"tid"`
	Price       float64 `json:"price,string"`
	Amount      float64 `json:"amount,string"`
	Exchange    string  `json:"exchange"`
	Type        string  `json:"type"`
}

Trade holds trade history for a specific currency pair

type TradeHistory

type TradeHistory struct {
	Price           float64 `json:"price,string"`
	Amount          float64 `json:"amount,string"`
	Timestamp       int64   `json:"timestamp"`
	TimestampMS     int64   `json:"timestampms"`
	Type            string  `json:"type"`
	FeeCurrency     string  `json:"fee_currency"`
	FeeAmount       float64 `json:"fee_amount,string"`
	TID             int64   `json:"tid"`
	OrderID         int64   `json:"order_id,string"`
	Exchange        string  `json:"exchange"`
	IsAuctionFilled bool    `json:"is_auction_fill"`
	ClientOrderID   string  `json:"client_order_id"`
	// Used to store values
	BaseCurrency  string
	QuoteCurrency string
}

TradeHistory holds trade history information

type TradeVolume

type TradeVolume struct {
	AccountID         int64   `json:"account_id"`
	Symbol            string  `json:"symbol"`
	BaseCurrency      string  `json:"base_currency"`
	NotionalCurrency  string  `json:"notional_currency"`
	Date              string  `json:"date_date"`
	TotalVolumeBase   float64 `json:"total_volume_base"`
	MakerBuySellRatio float64 `json:"maker_buy_sell_ratio"`
	BuyMakerBase      float64 `json:"buy_maker_base"`
	BuyMakerNotional  float64 `json:"buy_maker_notional"`
	BuyMakerCount     float64 `json:"buy_maker_count"`
	SellMakerBase     float64 `json:"sell_maker_base"`
	SellMakerNotional float64 `json:"sell_maker_notional"`
	SellMakerCount    float64 `json:"sell_maker_count"`
	BuyTakerBase      float64 `json:"buy_taker_base"`
	BuyTakerNotional  float64 `json:"buy_taker_notional"`
	BuyTakerCount     float64 `json:"buy_taker_count"`
	SellTakerBase     float64 `json:"sell_taker_base"`
	SellTakerNotional float64 `json:"sell_taker_notional"`
	SellTakerCount    float64 `json:"sell_taker_count"`
}

TradeVolume holds Volume information

type TransferResponse

type TransferResponse struct {
	Type                  string        `json:"type"`
	Status                string        `json:"status"`
	Timestamp             int64         `json:"timestampms"`
	EventID               int64         `json:"eid"`
	DepositAdvanceEventID int64         `json:"advanceEid"`
	Currency              currency.Code `json:"currency"`
	Amount                float64       `json:"amount,string"`
	FeeAmount             float64       `json:"feeAmount,string"`
	FeeCurrency           currency.Code `json:"feeCurrency"`
	Method                string        `json:"method"`
	TxHash                string        `json:"txHash"`
	WithdrawalID          string        `json:"withdrawalId"`
	OutputIdx             int64         `json:"outputIdx"`
	Destination           string        `json:"destination"`
	Purpose               string        `json:"purpose"`
}

TransferResponse contains transfer information

type WithdrawalAddress

type WithdrawalAddress struct {
	Address string  `json:"address"`
	Amount  float64 `json:"amount"`
	TXHash  string  `json:"txHash"`
	Message string  `json:"message"`
	Result  string  `json:"result"`
	Reason  string  `json:"reason"`
}

WithdrawalAddress holds withdrawal information

type WsHeartbeatResponse

type WsHeartbeatResponse struct {
	Type           string `json:"type"`
	Timestampms    int64  `json:"timestampms"`
	Sequence       int64  `json:"sequence"`
	TraceID        string `json:"trace_id"`
	SocketSequence int64  `json:"socket_sequence"`
}

WsHeartbeatResponse Gemini will send a heartbeat every five seconds so you'll know your WebSocket connection is active.

type WsOrderFilledData

type WsOrderFilledData struct {
	TradeID     string  `json:"trade_id"`
	Liquidity   string  `json:"liquidity"`
	Price       float64 `json:"price,string"`
	Amount      float64 `json:"amount,string"`
	Fee         float64 `json:"fee,string"`
	FeeCurrency string  `json:"fee_currency"`
}

WsOrderFilledData ws response data

type WsOrderResponse

type WsOrderResponse struct {
	IsLive            bool              `json:"is_live"`
	IsCancelled       bool              `json:"is_cancelled"`
	IsHidden          bool              `json:"is_hidden"`
	SocketSequence    int64             `json:"socket_sequence"`
	Timestampms       int64             `json:"timestampms"`
	AvgExecutionPrice float64           `json:"avg_execution_price,string"`
	ExecutedAmount    float64           `json:"executed_amount,string"`
	RemainingAmount   float64           `json:"remaining_amount,string"`
	OriginalAmount    float64           `json:"original_amount,string"`
	Price             float64           `json:"price,string"`
	EventID           string            `json:"event_id"`
	CancelCommandID   string            `json:"cancel_command_id"`
	Reason            string            `json:"reason"`
	Type              string            `json:"type"`
	OrderID           string            `json:"order_id"`
	APISession        string            `json:"api_session"`
	Symbol            string            `json:"symbol"`
	Side              string            `json:"side"`
	OrderType         string            `json:"order_type"`
	Timestamp         string            `json:"timestamp"`
	Fill              WsOrderFilledData `json:"fill"`
}

WsOrderResponse contains active orders

type WsRequestPayload

type WsRequestPayload struct {
	Request string `json:"request"`
	Nonce   int64  `json:"nonce"`
}

WsRequestPayload Request info to subscribe to a WS endpoint

type WsSubscriptionAcknowledgementResponse

type WsSubscriptionAcknowledgementResponse struct {
	Type             string   `json:"type"`
	AccountID        int64    `json:"accountId"`
	SubscriptionID   string   `json:"subscriptionId"`
	SymbolFilter     []string `json:"symbolFilter"`
	APISessionFilter []string `json:"apiSessionFilter"`
	EventTypeFilter  []string `json:"eventTypeFilter"`
}

WsSubscriptionAcknowledgementResponse The first message you receive acknowledges your subscription

Jump to

Keyboard shortcuts

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