intx

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 4

README

INTX Go SDK README

GoDoc Go Report Card

Overview

The INTX Go SDK is a sample library that demonstrates the structure of a Coinbase International Exchange (INTX) driver for the REST APIs.

License

The INTX Go SDK sample library is free and open source and released under the Apache License, Version 2.0.

The application and code are only available for demonstration purposes.

Usage

To use the INTX Go SDK, initialize the Credentials struct and create a new client. The Credentials struct is JSON enabled. Ensure that INTX API credentials are stored in a secure manner.

credentials := &intx.Credentials{}
if err := json.Unmarshal([]byte(os.Getenv("INTX_CREDENTIALS")), credentials); err != nil {
    return nil, fmt.Errorf("unable to deserialize intx credentials JSON: %w", err)
}

client := intx.NewClient(credentials, http.Client{})

There are convenience functions to read the credentials as an environment variable (intx.ReadEnvCredentials) and to deserialize the JSON structure (intx.UnmarshalCredentials) if pulled from a different source. The JSON format expected by both is:

{
  "accessKey": "",
  "passphrase": "",
  "signingKey": "",
  "portfolioId": "",
}

Coinbase INTX API credentials can be created in the INTX web console under API on the left-hand panel.

Once the client is initialized, make the desired call. For example, to list portfolios, pass in the request object, check for an error, and if nil, process the response.

response, err := client.ListPortfolios(ctx, &intx.ListPortfoliosRequest{})

Build

To build the sample library, ensure that Go 1.19+ is installed and then run:

go build *.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address      string `json:"address"`
	NetworkArnId string `json:"network_arn_id"`
}

type Asset

type Asset struct {
	AssetId                  string  `json:"asset_id"`
	AssetUuid                string  `json:"asset_uuid"`
	AssetName                string  `json:"asset_name"`
	Status                   string  `json:"status"`
	CollateralWeight         float64 `json:"collateral_weight"`
	SupportedNetworksEnabled bool    `json:"supported_networks_enabled"`
}

type Balance

type Balance struct {
	AssetId           string `json:"asset_id"`
	AssetUuid         string `json:"asset_uuid"`
	AssetName         string `json:"asset_name"`
	Quantity          string `json:"quantity"`
	Hold              string `json:"hold"`
	TransferHold      string `json:"transfer_hold"`
	CollateralValue   string `json:"collateral_value"`
	MaxWithdrawAmount string `json:"max_withdraw_amount"`
}

type CancelOrderRequest

type CancelOrderRequest struct {
	PortfolioId string `json:"portfolio"`
	OrderId     string `json:"id"`
}

type CancelOrderResponse

type CancelOrderResponse struct {
	Order   *Order
	Request *CancelOrderRequest
}

type CancelOrdersRequest

type CancelOrdersRequest struct {
	PortfolioId  string `json:"portfolio"`
	InstrumentId string `json:"instrument"`
}

type CancelOrdersResponse

type CancelOrdersResponse struct {
	Order   []Order
	Request *CancelOrdersRequest
}

type Client

type Client struct {
	Credentials *Credentials
	// contains filtered or unexported fields
}

func NewClient

func NewClient(credentials *Credentials, httpClient http.Client) *Client

func (*Client) CancelOrder

func (c *Client) CancelOrder(
	ctx context.Context,
	request *CancelOrderRequest,
) (*CancelOrderResponse, error)

func (*Client) CancelOrders

func (c *Client) CancelOrders(
	ctx context.Context,
	request *CancelOrdersRequest,
) (*CancelOrdersResponse, error)

func (*Client) CreateCounterpartyId

func (c *Client) CreateCounterpartyId(
	ctx context.Context,
	request *CreateCounterpartyIdRequest,
) (*CreateCounterpartyIdResponse, error)

func (*Client) CreateCryptoAddress

func (c *Client) CreateCryptoAddress(
	ctx context.Context,
	request *CreateCryptoAddressRequest,
) (*CreateCryptoAddressResponse, error)

func (*Client) CreateOrder

func (c *Client) CreateOrder(
	ctx context.Context,
	request *CreateOrderRequest,
) (*CreateOrderResponse, error)

func (*Client) CreatePortfolio

func (c *Client) CreatePortfolio(
	ctx context.Context,
	request *CreatePortfolioRequest,
) (*CreatePortfolioResponse, error)

func (*Client) CreatePortfolioTransfer

func (c *Client) CreatePortfolioTransfer(
	ctx context.Context,
	request *CreatePortfolioTransferRequest,
) (*CreatePortfolioTransferResponse, error)

func (*Client) GetAsset

func (c *Client) GetAsset(
	ctx context.Context,
	request *GetAssetRequest,
) (*GetAssetResponse, error)

func (*Client) GetAssetBalance

func (c *Client) GetAssetBalance(
	ctx context.Context,
	request *GetAssetBalanceRequest,
) (*GetAssetBalanceResponse, error)

func (*Client) GetHistoricalFundingRates

func (c *Client) GetHistoricalFundingRates(
	ctx context.Context,
	request *GetHistoricalFundingRequest,
) (*GetHistoricalFundingResponse, error)

func (*Client) GetInstrument

func (c *Client) GetInstrument(
	ctx context.Context,
	request *GetInstrumentRequest,
) (*GetInstrumentResponse, error)

func (*Client) GetInstrumentPosition

func (c *Client) GetInstrumentPosition(
	ctx context.Context,
	request *GetInstrumentPositionRequest,
) (*GetInstrumentPositionResponse, error)

func (*Client) GetInstrumentQuote

func (c *Client) GetInstrumentQuote(
	ctx context.Context,
	request *GetInstrumentQuoteRequest,
) (*GetInstrumentQuoteResponse, error)

func (*Client) GetOrderDetails

func (c *Client) GetOrderDetails(
	ctx context.Context,
	request *GetOrderDetailsRequest,
) (*GetOrderDetailsResponse, error)

func (*Client) GetPortfolio

func (c *Client) GetPortfolio(
	ctx context.Context,
	request *GetPortfolioRequest,
) (*GetPortfolioResponse, error)

func (*Client) GetPortfolioBalances

func (c *Client) GetPortfolioBalances(
	ctx context.Context,
	request *GetPortfolioBalancesRequest,
) (*GetPortfolioBalancesResponse, error)

func (*Client) GetPortfolioDetails

func (c *Client) GetPortfolioDetails(
	ctx context.Context,
	request *GetPortfolioDetailsRequest,
) (*GetPortfolioDetailsResponse, error)

func (*Client) GetPortfolioFills

func (c *Client) GetPortfolioFills(
	ctx context.Context,
	request *GetPortfolioFillsRequest,
) (*GetPortfolioFillsResponse, error)

func (*Client) GetPortfolioPositions

func (c *Client) GetPortfolioPositions(
	ctx context.Context,
	request *GetPortfolioPositionsRequest,
) (*GetPortfolioPositionsResponse, error)

func (*Client) GetPortfolioSummary

func (c *Client) GetPortfolioSummary(
	ctx context.Context,
	request *GetPortfolioSummaryRequest,
) (*GetPortfolioSummaryResponse, error)

func (*Client) GetSupportedNetworks

func (c *Client) GetSupportedNetworks(
	ctx context.Context,
	request *GetSupportedNetworksRequest,
) (*GetSupportedNetworksResponse, error)

func (*Client) GetTransfer

func (c *Client) GetTransfer(
	ctx context.Context,
	request *GetTransferRequest,
) (*GetTransferResponse, error)

func (*Client) HttpBaseUrl

func (c *Client) HttpBaseUrl() string

func (*Client) HttpClient

func (c *Client) HttpClient() *http.Client

func (*Client) ListAssets

func (c *Client) ListAssets(
	ctx context.Context,
	request *ListAssetsRequest,
) (*ListAssetsResponse, error)

func (*Client) ListFillsByPortfolios

func (c *Client) ListFillsByPortfolios(
	ctx context.Context,
	request *ListFillsByPortfoliosRequest,
) (*ListFillsByPortfoliosResponse, error)

func (*Client) ListInstruments

func (c *Client) ListInstruments(
	ctx context.Context,
	request *ListInstrumentsRequest,
) (*ListInstrumentsResponse, error)

func (*Client) ListOpenOrders

func (c *Client) ListOpenOrders(
	ctx context.Context,
	request *ListOpenOrdersRequest,
) (*ListOpenOrdersResponse, error)

func (*Client) ListPortfolios

func (c *Client) ListPortfolios(
	ctx context.Context,
	request *ListPortfoliosRequest,
) (*ListPortfoliosResponse, error)

func (*Client) ListTransfers

func (c *Client) ListTransfers(
	ctx context.Context,
	request *ListTransfersRequest,
) (*ListTransfersResponse, error)

func (*Client) ModifyOrder

func (c *Client) ModifyOrder(
	ctx context.Context,
	request *ModifyOrderRequest,
) (*ModifyOrderResponse, error)

func (*Client) SetBaseUrl added in v0.1.2

func (c *Client) SetBaseUrl(u string) *Client

func (*Client) SetMarginOverride

func (c *Client) SetMarginOverride(
	ctx context.Context,
	request *SetMarginOverrideRequest,
) (*SetMarginOverrideResponse, error)

func (*Client) UpdatePortfolio

func (c *Client) UpdatePortfolio(
	ctx context.Context,
	request *UpdatePortfolioRequest,
) (*UpdatePortfolioResponse, error)

func (*Client) ValidateCounterpartyId

func (c *Client) ValidateCounterpartyId(
	ctx context.Context,
	request *ValidateCounterpartyIdRequest,
) (*ValidateCounterpartyIdResponse, error)

type Counterparty

type Counterparty struct {
	PortfolioUuid  string `json:"portfolio_uuid"`
	CounterpartyId string `json:"counterparty_id"`
}

type CounterpartyWithdrawal

type CounterpartyWithdrawal struct {
	Idem                 string  `json:"idem"`
	PortfolioUuid        string  `json:"portfolio_uuid"`
	SourceCounterpartyId string  `json:"source_counterparty_id"`
	TargetCounterpartyId string  `json:"target_counterparty_id"`
	Asset                string  `json:"asset"`
	Amount               float64 `json:"amount"`
}

type CreateCounterpartyIdRequest

type CreateCounterpartyIdRequest struct {
	PortfolioId string `json:"portfolio"`
}

type CreateCounterpartyIdResponse

type CreateCounterpartyIdResponse struct {
	Counterparty *Counterparty                `json:"counterparty"`
	Request      *CreateCounterpartyIdRequest `json:"request"`
}

type CreateCryptoAddressRequest

type CreateCryptoAddressRequest struct {
	PortfolioId  string `json:"portfolio"`
	AssetId      string `json:"asset"`
	NetworkArnId string `json:"network_arn_id"`
}

type CreateCryptoAddressResponse

type CreateCryptoAddressResponse struct {
	Address *Address                    `json:"address"`
	Request *CreateCryptoAddressRequest `json:"request"`
}

type CreateOrderRequest

type CreateOrderRequest struct {
	ClientOrderId string  `json:"client_order_id"`
	Side          string  `json:"side"`
	Size          string  `json:"size"`
	Tif           string  `json:"tif"`
	InstrumentId  string  `json:"instrument"`
	Type          string  `json:"type"`
	Price         string  `json:"price,omitempty"`
	StopPrice     *string `json:"stop_price,omitempty"`
	ExpireTime    *string `json:"expire_time,omitempty"`
	PortfolioId   string  `json:"portfolio"`
	UserId        *string `json:"user,omitempty"`
	StpMode       *string `json:"stp_mode,omitempty"`
	PostOnly      *bool   `json:"post_only,omitempty"`
}

type CreateOrderResponse

type CreateOrderResponse struct {
	Order   *Order              `json:"order"`
	Request *CreateOrderRequest `json:"request"`
}

type CreatePortfolioRequest

type CreatePortfolioRequest struct {
	Name string `json:"name"`
}

type CreatePortfolioResponse

type CreatePortfolioResponse struct {
	Portfolio *Portfolio              `json:"portfolio"`
	Request   *CreatePortfolioRequest `json:"request"`
}

type CreatePortfolioTransferRequest

type CreatePortfolioTransferRequest struct {
	From    string `json:"from"`
	To      string `json:"to"`
	AssetId string `json:"asset"`
	Amount  string `json:"amount"`
}

type CreatePortfolioTransferResponse

type CreatePortfolioTransferResponse struct {
	Success bool                            `json:"success"`
	Request *CreatePortfolioTransferRequest `json:"request"`
}

type CreateWithdrawalToCounterpartyIdRequest

type CreateWithdrawalToCounterpartyIdRequest struct {
	PortfolioId    string `json:"portfolio"`
	CounterpartyId string `json:"counterparty_id"`
	AssetId        string `json:"asset"`
	Amount         string `json:"amount"`
	Nonce          string `json:"nonce"`
}

type CreateWithdrawalToCounterpartyIdResponse

type CreateWithdrawalToCounterpartyIdResponse struct {
	Withdrawal *CounterpartyWithdrawal                  `json:"withdrawal"`
	Request    *CreateWithdrawalToCounterpartyIdRequest `json:"request"`
}

type CreateWithdrawalToCryptoAddressRequest

type CreateWithdrawalToCryptoAddressRequest struct {
	PortfolioId          string `json:"portfolio"`
	AssetId              string `json:"asset"`
	Amount               string `json:"amount"`
	AddNetworkFeeToTotal bool   `json:"add_network_fee_to_total"`
	NetworkArnId         string `json:"network_arn_id"`
	Address              string `json:"address"`
	Nonce                string `json:"nonce"`
}

type CreateWithdrawalToCryptoAddressResponse

type CreateWithdrawalToCryptoAddressResponse struct {
	Idem    string                                  `json:"idem"`
	Request *CreateWithdrawalToCryptoAddressRequest `json:"request"`
}

type Credentials

type Credentials struct {
	AccessKey   string `json:"accessKey"`
	Passphrase  string `json:"passphrase"`
	SigningKey  string `json:"signingKey"`
	PortfolioId string `json:"portfolioId"`
}

func ReadEnvCredentials

func ReadEnvCredentials(variableName string) (*Credentials, error)

func UnmarshalCredentials

func UnmarshalCredentials(b []byte) (*Credentials, error)

type Details

type Details struct {
	Summary   Summary    `json:"summary"`
	Balances  []Balance  `json:"balances"`
	Positions []Position `json:"positions"`
}

type ErrorMessage

type ErrorMessage struct {
	Value string `json:"message"`
}

type Fill

type Fill struct {
	PortfolioId    string `json:"portfolio_id"`
	PortfolioUuid  string `json:"portfolio_uuid"`
	PortfolioName  string `json:"portfolio_name"`
	FillId         string `json:"fill_id"`
	ExecId         string `json:"exec_id"`
	OrderId        string `json:"order_id"`
	InstrumentId   string `json:"instrument_id"`
	InstrumentUuid string `json:"instrument_uuid"`
	Symbol         string `json:"symbol"`
	MatchId        string `json:"match_id"`
	FillPrice      string `json:"fill_price"`
	FillQty        string `json:"fill_qty"`
	ClientId       string `json:"client_id"`
	ClientOrderId  string `json:"client_order_id"`
	OrderQty       string `json:"order_qty"`
	LimitPrice     string `json:"limit_price"`
	TotalFilled    string `json:"total_filled"`
	FilledVwap     string `json:"filled_vwap"`
	ExpireTime     string `json:"expire_time"`
	StopPrice      string `json:"stop_price"`
	Side           string `json:"side"`
	Tif            string `json:"tif"`
	StpMode        string `json:"stp_mode"`
	Flags          string `json:"flags"`
	Fee            string `json:"fee"`
	FeeAsset       string `json:"fee_asset"`
	OrderStatus    string `json:"order_status"`
	EventTime      string `json:"event_time"`
}

type GetAssetBalanceRequest

type GetAssetBalanceRequest struct {
	PortfolioId string `json:"portfolio"`
	AssetId     string `json:"asset"`
}

type GetAssetBalanceResponse

type GetAssetBalanceResponse struct {
	Balance *Balance                `json:"balance"`
	Request *GetAssetBalanceRequest `json:"request"`
}

type GetAssetRequest

type GetAssetRequest struct {
	AssetId string `json:"asset"`
}

type GetAssetResponse

type GetAssetResponse struct {
	AssetDetail *Asset
	Request     *GetAssetRequest
}

type GetHistoricalFundingRequest

type GetHistoricalFundingRequest struct {
	InstrumentId string `json:"instrument"`
}

type GetHistoricalFundingResponse

type GetHistoricalFundingResponse struct {
	HistoricalFundingRates *HistoricalFundingRate       `json:"historical_funding_rates"`
	Request                *GetHistoricalFundingRequest `json:"request"`
}

type GetInstrumentPositionRequest

type GetInstrumentPositionRequest struct {
	PortfolioId  string `json:"portfolio"`
	InstrumentId string `json:"instrument"`
}

type GetInstrumentPositionResponse

type GetInstrumentPositionResponse struct {
	Positions []Position                    `json:"positions"`
	Request   *GetInstrumentPositionRequest `json:"request"`
}

type GetInstrumentQuoteRequest

type GetInstrumentQuoteRequest struct {
	InstrumentId string `json:"instrument"`
}

type GetInstrumentQuoteResponse

type GetInstrumentQuoteResponse struct {
	InstrumentQuote *Quote                     `json:"instrument_quote"`
	Request         *GetInstrumentQuoteRequest `json:"request"`
}

type GetInstrumentRequest

type GetInstrumentRequest struct {
	InstrumentId string `json:"instrument"`
}

type GetInstrumentResponse

type GetInstrumentResponse struct {
	InstrumentDetail *Instrument           `json:"instrument_detail"`
	Request          *GetInstrumentRequest `json:"request"`
}

type GetOrderDetailsRequest

type GetOrderDetailsRequest struct {
	PortfolioId string `json:"portfolio"`
	OrderId     string `json:"id"`
}

type GetOrderDetailsResponse

type GetOrderDetailsResponse struct {
	Order   *Order
	Request *GetOrderDetailsRequest
}

type GetPortfolioBalancesRequest

type GetPortfolioBalancesRequest struct {
	PortfolioId string `json:"portfolio"`
}

type GetPortfolioBalancesResponse

type GetPortfolioBalancesResponse struct {
	Balances []Balance                    `json:"balances"`
	Request  *GetPortfolioBalancesRequest `json:"request"`
}

type GetPortfolioDetailsRequest

type GetPortfolioDetailsRequest struct {
	PortfolioId string `json:"portfolio"`
}

type GetPortfolioDetailsResponse

type GetPortfolioDetailsResponse struct {
	Details *Details                    `json:"details"`
	Request *GetPortfolioDetailsRequest `json:"request"`
}

type GetPortfolioFillsRequest

type GetPortfolioFillsRequest struct {
	PortfolioId   string `json:"portfolio"`
	OrderId       string `json:"order_id,omitempty"`
	ClientOrderId string `json:"client_order_id,omitempty"`
	RefDatetime   string `json:"ref_datetime,omitempty"`
	ResultLimit   int    `json:"result_limit,omitempty"`
	ResultOffset  int    `json:"result_offset,omitempty"`
	TimeFrom      string `json:"time_from,omitempty"`
	Pagination    *PaginationParams
}

type GetPortfolioFillsResponse

type GetPortfolioFillsResponse struct {
	Pagination PaginationParams          `json:"pagination"`
	Results    []Fill                    `json:"results"`
	Request    *GetPortfolioFillsRequest `json:"request"`
}

type GetPortfolioPositionsRequest

type GetPortfolioPositionsRequest struct {
	PortfolioId string `json:"portfolio"`
}

type GetPortfolioPositionsResponse

type GetPortfolioPositionsResponse struct {
	Positions []Position                    `json:"positions"`
	Request   *GetPortfolioPositionsRequest `json:"request"`
}

type GetPortfolioRequest

type GetPortfolioRequest struct {
	PortfolioId string `json:"portfolio"`
}

type GetPortfolioResponse

type GetPortfolioResponse struct {
	Portfolio *Portfolio           `json:"portfolio"`
	Request   *GetPortfolioRequest `json:"request"`
}

type GetPortfolioSummaryRequest

type GetPortfolioSummaryRequest struct {
	PortfolioId string `json:"portfolio"`
}

type GetPortfolioSummaryResponse

type GetPortfolioSummaryResponse struct {
	Summary *Summary                    `json:"summary"`
	Request *GetPortfolioSummaryRequest `json:"request"`
}

type GetSupportedNetworksRequest

type GetSupportedNetworksRequest struct {
	AssetId string `json:"asset"`
}

type GetSupportedNetworksResponse

type GetSupportedNetworksResponse struct {
	NetworkDetail []Network                    `json:"network_detail"`
	Request       *GetSupportedNetworksRequest `json:"request"`
}

type GetTransferRequest

type GetTransferRequest struct {
	TransferUuid string `json:"transfer_uuid"`
}

type GetTransferResponse

type GetTransferResponse struct {
	Transfers []Transfer          `json:"results"`
	Request   *GetTransferRequest `json:"request"`
}

type HistoricalFundingRate

type HistoricalFundingRate struct {
	InstrumentId string  `json:"instrument_id"`
	FundingRate  float64 `json:"funding_rate"`
	MarkPrice    float64 `json:"mark_price"`
	EventTime    string  `json:"event_time"`
}

type Instrument

type Instrument struct {
	InstrumentId       string  `json:"instrument_id"`
	InstrumentUuid     string  `json:"instrument_uuid"`
	Symbol             string  `json:"symbol"`
	Type               string  `json:"type"`
	BaseAssetId        string  `json:"base_asset_id"`
	BaseAssetUuid      string  `json:"base_asset_uuid"`
	BaseAssetName      string  `json:"base_asset_name"`
	QuoteAssetId       string  `json:"quote_asset_id"`
	QuoteAssetUuid     string  `json:"quote_asset_uuid"`
	QuoteAssetName     string  `json:"quote_asset_name"`
	BaseIncrement      string  `json:"base_increment"`
	QuoteIncrement     string  `json:"quote_increment"`
	MarketOrderPercent float64 `json:"market_order_percent"`
	PriceBandPercent   float64 `json:"price_band_percent"`
	Qty24hr            string  `json:"qty_24hr"`
	Notional24hr       string  `json:"notional_24hr"`
	AvgDailyQty        string  `json:"avg_daily_qty"`
	AvgDailyNotional   string  `json:"avg_daily_notional"`
	PreviousDayQty     string  `json:"previous_day_qty"`
	PositionLimitQty   string  `json:"position_limit_qty"`
	PositionLimitAdv   float64 `json:"position_limit_adv"`
	InitialMarginAdv   float64 `json:"initial_margin_adv"`
	ReplacementCost    string  `json:"replacement_cost"`
	BaseImf            float64 `json:"base_imf"`
	MinNotionalValue   string  `json:"min_notional_value"`
	FundingInterval    string  `json:"funding_interval"`
	TradingState       string  `json:"trading_state"`
	OpenInterest       string  `json:"open_interest"`
	Quote              Quote   `json:"quote"`
}

type ListAssetsRequest

type ListAssetsRequest struct{}

type ListAssetsResponse

type ListAssetsResponse struct {
	Assets  []*Asset           `json:"assets"`
	Request *ListAssetsRequest `json:"request"`
}

type ListFillsByPortfoliosRequest

type ListFillsByPortfoliosRequest struct {
	PortfolioIds  string `json:"portfolios"`
	OrderId       string `json:"order_id,omitempty"`
	ClientOrderId string `json:"client_order_id,omitempty"`
	RefDatetime   string `json:"ref_datetime,omitempty"`
	ResultLimit   int    `json:"result_limit,omitempty"`
	ResultOffset  int    `json:"result_offset,omitempty"`
	TimeFrom      string `json:"time_from,omitempty"`
	Pagination    *PaginationParams
}

type ListFillsByPortfoliosResponse

type ListFillsByPortfoliosResponse struct {
	Pagination PaginationParams              `json:"pagination"`
	Results    []Fill                        `json:"results"`
	Request    *ListFillsByPortfoliosRequest `json:"request"`
}

type ListInstrumentsRequest

type ListInstrumentsRequest struct{}

type ListInstrumentsResponse

type ListInstrumentsResponse struct {
	Instruments []*Instrument           `json:"instruments"`
	Request     *ListInstrumentsRequest `json:"request"`
}

type ListOpenOrdersRequest

type ListOpenOrdersRequest struct {
	PortfolioId   string `json:"portfolio"`
	InstrumentId  string `json:"instrument,omitempty"`
	ClientOrderId string `json:"client_order_id,omitempty"`
	EventType     string `json:"event_type,omitempty"`
	RefDatetime   string `json:"ref_datetime,omitempty"`
	ResultLimit   int    `json:"result_limit,omitempty"`
	ResultOffset  int    `json:"result_offset,omitempty"`
	Pagination    *PaginationParams
}

type ListOpenOrdersResponse

type ListOpenOrdersResponse struct {
	Pagination PaginationParams       `json:"pagination"`
	Results    []Order                `json:"results"`
	Request    *ListOpenOrdersRequest `json:"request"`
}

type ListPortfoliosRequest

type ListPortfoliosRequest struct{}

type ListPortfoliosResponse

type ListPortfoliosResponse struct {
	Portfolios []*Portfolio           `json:"portfolios"`
	Request    *ListPortfoliosRequest `json:"request"`
}

type ListTransfersRequest

type ListTransfersRequest struct {
	PortfolioIds string `json:"portfolios"`
	TimeFrom     string `json:"time_from"`
	TimeTo       string `json:"time_to"`
	ResultLimit  int    `json:"result_limit"`
	ResultOffset int    `json:"result_offset"`
	Status       string `json:"status"`
	Type         string `json:"type"`
	Pagination   *PaginationParams
}

type ListTransfersResponse

type ListTransfersResponse struct {
	Pagination PaginationSubset      `json:"pagination"`
	Transfers  []Transfer            `json:"results"`
	Request    *ListTransfersRequest `json:"request"`
}

type MarginOverride

type MarginOverride struct {
	PortfolioId    string `json:"portfolio_id"`
	MarginOverride string `json:"margin_override"`
}

type ModifyOrderRequest

type ModifyOrderRequest struct {
	OrderId       string `json:"id"`
	PortfolioId   string `json:"portfolio"`
	ClientOrderId string `json:"client_order_id"`
	Price         string `json:"price,omitempty"`
	StopPrice     string `json:"stop_price,omitempty"`
	Size          string `json:"size,omitempty"`
}

type ModifyOrderResponse

type ModifyOrderResponse struct {
	Order   *Order
	Request *ModifyOrderRequest
}

type Network

type Network struct {
	AssetId          string `json:"asset_id"`
	AssetUuid        string `json:"asset_uuid"`
	AssetName        string `json:"asset_name"`
	IsDefault        bool   `json:"is_default"`
	NetworkName      string `json:"network_name"`
	DisplayName      string `json:"display_name"`
	NetworkArnId     string `json:"network_arn_id"`
	MinWithdrawalAmt string `json:"min_withdrawal_amt"`
	MaxWithdrawalAmt string `json:"max_withdrawal_amt"`
	NetworkConfirms  int    `json:"network_confirms"`
	ProcessingTime   int    `json:"processing_time"`
}

type Order

type Order struct {
	OrderId        string `json:"order_id"`
	ClientOrderId  string `json:"client_order_id"`
	Side           string `json:"side"`
	InstrumentId   string `json:"instrument_id"`
	InstrumentUuid string `json:"instrument_uuid"`
	Symbol         string `json:"symbol"`
	PortfolioId    string `json:"portfolio_id"`
	PortfolioUuid  string `json:"portfolio_uuid"`
	Type           string `json:"type"`
	Price          string `json:"price"`
	StopPrice      string `json:"stop_price"`
	Size           string `json:"size"`
	Tif            string `json:"tif"`
	ExpireTime     string `json:"expire_time"`
	StpMode        string `json:"stp_mode"`
	EventType      string `json:"event_type"`
	OrderStatus    string `json:"order_status"`
	LeavesQty      string `json:"leaves_qty"`
	ExecQty        string `json:"exec_qty"`
	AvgPrice       string `json:"avg_price"`
	Message        string `json:"message"`
	Fee            string `json:"fee"`
}

type PaginationParams

type PaginationParams struct {
	RefDatetime  string `json:"ref_datetime"`
	ResultLimit  int    `json:"result_limit"`
	ResultOffset int    `json:"result_offset"`
}

type PaginationSubset

type PaginationSubset struct {
	ResultLimit  int `json:"result_limit"`
	ResultOffset int `json:"result_offset"`
}

type Portfolio

type Portfolio struct {
	PortfolioId    string `json:"portfolio_id"`
	PortfolioUuid  string `json:"portfolio_uuid"`
	Name           string `json:"name"`
	UserUuid       string `json:"user_uuid"`
	MakerFeeRate   string `json:"maker_fee_rate"`
	TakerFeeRate   string `json:"taker_fee_rate"`
	TradingLock    bool   `json:"trading_lock"`
	BorrowDisabled bool   `json:"borrow_disabled"`
	IsLsp          bool   `json:"is_lsp"`
	IsDefault      bool   `json:"is_default"`
}

type PortfolioSubset

type PortfolioSubset struct {
	Id   string `json:"id"`
	Uuid string `json:"uuid"`
	Name string `json:"name"`
}

type Position

type Position struct {
	InstrumentId   string `json:"instrument_id"`
	InstrumentUuid string `json:"instrument_uuid"`
	Symbol         string `json:"symbol"`
	Vwap           string `json:"vwap"`
	NetSize        string `json:"net_size"`
	BuyOrderSize   string `json:"buy_order_size"`
	SellOrderSize  string `json:"sell_order_size"`
	ImContribution string `json:"im_contribution"`
	UnrealizedPnl  string `json:"unrealized_pnl"`
	MarkPrice      string `json:"mark_price"`
}

type Quote

type Quote struct {
	BestBidPrice     string `json:"best_bid_price"`
	BestBidSize      string `json:"best_bid_size"`
	BestAskPrice     string `json:"best_ask_price"`
	BestAskSize      string `json:"best_ask_size"`
	TradePrice       string `json:"trade_price"`
	TradeQty         string `json:"trade_qty"`
	IndexPrice       string `json:"index_price"`
	MarkPrice        string `json:"mark_price"`
	SettlementPrice  string `json:"settlement_price"`
	LimitUp          string `json:"limit_up"`
	LimitDown        string `json:"limit_down"`
	PredictedFunding string `json:"predicted_funding"`
	Timestamp        string `json:"timestamp"`
}

type SetMarginOverrideRequest

type SetMarginOverrideRequest struct {
	PortfolioId    string `json:"portfolio"`
	MarginOverride string `json:"margin_override"`
}

type SetMarginOverrideResponse

type SetMarginOverrideResponse struct {
	MarginOverride *MarginOverride           `json:"margin_override"`
	Request        *SetMarginOverrideRequest `json:"request"`
}

type Summary

type Summary struct {
	Collateral                         string  `json:"collateral"`
	UnrealizedPnl                      string  `json:"unrealized_pnl"`
	PositionNotional                   string  `json:"position_notional"`
	OpenPositionNotional               string  `json:"open_position_notional"`
	PendingFees                        string  `json:"pending_fees"`
	Borrow                             string  `json:"borrow"`
	AccruedInterest                    string  `json:"accrued_interest"`
	RollingDebt                        string  `json:"rolling_debt"`
	Balance                            string  `json:"balance"`
	BuyingPower                        string  `json:"buying_power"`
	PortfolioCurrentMargin             float64 `json:"portfolio_current_margin"`
	PortfolioInitialMargin             float64 `json:"portfolio_initial_margin"`
	PortfolioMaintenanceMargin         float64 `json:"portfolio_maintenance_margin"`
	PortfolioCloseOutMargin            float64 `json:"portfolio_close_out_margin"`
	InLiquidation                      bool    `json:"in_liquidation"`
	PortfolioCurrentMarginNotional     float64 `json:"portfolio_current_margin_notional"`
	PortfolioInitialMarginNotional     float64 `json:"portfolio_initial_margin_notional"`
	PortfolioMaintenanceMarginNotional float64 `json:"portfolio_maintenance_margin_notional"`
	PortfolioCloseOutMarginNotional    float64 `json:"portfolio_close_out_margin_notional"`
	MarginOverride                     float64 `json:"margin_override"`
	LockupInitialMargin                float64 `json:"lockup_initial_margin"`
}

type Transfer

type Transfer struct {
	TransferUuid       string          `json:"transfer_uuid"`
	Type               string          `json:"type"`
	Amount             float64         `json:"amount"`
	Asset              string          `json:"asset"`
	Status             string          `json:"status"`
	NetworkName        string          `json:"network_name"`
	CreatedAt          string          `json:"created_at"`
	UpdatedAt          string          `json:"updated_at"`
	FromPortfolio      PortfolioSubset `json:"from_portfolio"`
	ToPortfolio        PortfolioSubset `json:"to_portfolio"`
	FromAddress        float64         `json:"from_address"`
	ToAddress          float64         `json:"to_address"`
	FromCbAccount      string          `json:"from_cb_account"`
	ToCbAccount        string          `json:"to_cb_account"`
	FromCounterpartyId string          `json:"from_counterparty_id"`
	ToCounterpartyId   string          `json:"to_counterparty_id"`
	InstrumentId       int64           `json:"instrument_id"`
	PositionId         string          `json:"position_id"`
}

type TransfersResponse

type TransfersResponse struct {
	Pagination PaginationSubset `json:"pagination"`
	Results    []Transfer       `json:"results"`
}

type UpdatePortfolioRequest

type UpdatePortfolioRequest struct {
	Name        string `json:"name"`
	PortfolioId string `json:"portfolio"`
}

type UpdatePortfolioResponse

type UpdatePortfolioResponse struct {
	Portfolio *Portfolio              `json:"portfolio"`
	Request   *UpdatePortfolioRequest `json:"request"`
}

type ValidateCounterpartyIdRequest

type ValidateCounterpartyIdRequest struct {
	CounterpartyId string `json:"counterparty_id"`
}

type ValidateCounterpartyIdResponse

type ValidateCounterpartyIdResponse struct {
	Validation *Validation                    `json:"validation"`
	Request    *ValidateCounterpartyIdRequest `json:"request"`
}

type Validation

type Validation struct {
	CounterpartyId string `json:"counterparty_id"`
	Valid          bool   `json:"valid"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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