api

package
v0.0.0-...-ec27bc9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {

	// API Services
	PrivateApi *PrivateApiService
	PublicApi  *PublicApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the MAX RESTful API List API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error)

CallAPI do the request.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

func (*APIClient) PrepareRequest

func (c *APIClient) PrepareRequest(
	ctx context.Context,
	path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams url.Values,
	fileName string,
	fileBytes []byte) (localVarRequest *http.Request, err error)

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type Account

type Account struct {

	// currency id, e.g. twd, btc, ...
	Currency string `json:"currency,omitempty"`

	// available balance
	Balance string `json:"balance,omitempty"`

	// locked funds
	Locked string `json:"locked,omitempty"`
}

type Bank

type Bank struct {

	// bank branch code
	Branch string `json:"branch,omitempty"`

	// bank account
	Account string `json:"account,omitempty"`

	// bank account state
	State string `json:"state,omitempty"`
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type Currency

type Currency struct {

	// unique currency id, check /api/v2/currencies for available currencies
	Id string `json:"id,omitempty"`

	// fixed precision of the currency
	Precision int32 `json:"precision,omitempty"`
}

get all available currencies.

type Deposit

type Deposit struct {

	// currency id
	Currency string `json:"currency,omitempty"`

	// deposit amount
	Amount string `json:"amount,omitempty"`

	// deposit fee
	Fee string `json:"fee,omitempty"`

	// unique transaction id
	Txid string `json:"txid,omitempty"`

	// received timestamp (second)
	CreatedAt int32 `json:"created_at,omitempty"`

	// confirmations for crypto currency
	Confirmations int32 `json:"confirmations,omitempty"`

	// lastest updated timestamp (second)
	UpdatedAt int32 `json:"updated_at,omitempty"`

	// current state
	State string `json:"state,omitempty"`
}

get details of a specific deposit

type Market

type Market struct {

	// unique market id, check /api/v2/markets for available markets
	Id string `json:"id,omitempty"`

	// market name
	Name string `json:"name,omitempty"`

	// base unit
	BaseUnit string `json:"base_unit,omitempty"`

	// fixed precision of base unit
	BaseUnitPrecision int32 `json:"base_unit_precision,omitempty"`

	// quote unit
	QuoteUnit string `json:"quote_unit,omitempty"`

	// fixed precision of quote unit
	QuoteUnitPrecision int32 `json:"quote_unit_precision,omitempty"`
}

get all available markets.

type Member

type Member struct {

	// unique serial number
	Sn string `json:"sn,omitempty"`

	// user name
	Name string `json:"name,omitempty"`

	// user language
	Language string `json:"language,omitempty"`

	// valid phone set
	PhoneSet bool `json:"phone_set,omitempty"`

	// phone country code
	CountryCode string `json:"country_code,omitempty"`

	// taiwanese identity number
	IdentityNumber string `json:"identity_number,omitempty"`

	// invoice carrier id
	InvoiceCarrierId string `json:"invoice_carrier_id,omitempty"`

	// invoice carrier type
	InvoiceCarrierType string `json:"invoice_carrier_type,omitempty"`

	// is deleted
	IsDeleted bool `json:"is_deleted,omitempty"`

	// is frozen
	IsFrozen bool `json:"is_frozen,omitempty"`

	// is activated
	IsActivated bool `json:"is_activated,omitempty"`

	// is user profile verified
	ProfileVerified bool `json:"profile_verified,omitempty"`

	// is kyc approved
	KycApproved bool `json:"kyc_approved,omitempty"`

	// member kyc state: unverified, verifying, profile_verifying, verified, rejected
	KycState string `json:"kyc_state,omitempty"`

	// user mobile phone number
	PhoneNumber string `json:"phone_number,omitempty"`

	// is user aggreement checked
	UserAgreementChecked bool `json:"user_agreement_checked,omitempty"`

	// which tou version user agree with
	UserAgreementVersion string `json:"user_agreement_version,omitempty"`

	Bank *Bank `json:"bank,omitempty"`

	Documents *MemberDocs `json:"documents,omitempty"`

	// user email
	Email string `json:"email,omitempty"`

	Accounts []Account `json:"accounts,omitempty"`

	// type_guest, type_coin_1, type_coin_2, type_fiat
	MemberType string `json:"member_type,omitempty"`

	// member level
	Level int32 `json:"level,omitempty"`
}

get your profile and accounts infomation

type MemberDocs

type MemberDocs struct {

	// ID photo front status
	PhotoIdFrontState string `json:"photo_id_front_state,omitempty"`

	// ID photo back status
	PhotoIdBackState string `json:"photo_id_back_state,omitempty"`

	// supplemental document status
	CellphoneBillState string `json:"cellphone_bill_state,omitempty"`

	// selfie status
	SelfieWithIdState string `json:"selfie_with_id_state,omitempty"`
}

type Order

type Order struct {

	// unique order id
	Id int32 `json:"id,omitempty"`

	// 'sell' or 'buy'
	Side string `json:"side,omitempty"`

	// 'limit', 'market', 'stop_limit', or 'stop_market'
	OrdType string `json:"ord_type,omitempty"`

	// price of a unit
	Price string `json:"price,omitempty"`

	// price to trigger a stop order
	StopPrice string `json:"stop_price,omitempty"`

	// average execution price
	AvgPrice string `json:"avg_price,omitempty"`

	// 'wait', 'done', 'cancel', or 'convert'; 'wait' means waiting for fulfillment; 'done' means fullfilled; 'cancel' means cancelled; 'convert' means the stop order is triggered
	State string `json:"state,omitempty"`

	// market id, check /api/v2/markets for available markets
	Market string `json:"market,omitempty"`

	// created timestamp (second)
	CreatedAt int32 `json:"created_at,omitempty"`

	// total amount to sell/buy, an order could be partially executed
	Volume string `json:"volume,omitempty"`

	// remaining volume
	RemainingVolume string `json:"remaining_volume,omitempty"`

	// executed volume
	ExecutedVolume string `json:"executed_volume,omitempty"`

	// trade count
	TradesCount int32 `json:"trades_count,omitempty"`
}

get a specific order.

type OrderBook

type OrderBook struct {
	Asks []Order `json:"asks,omitempty"`

	Bids []Order `json:"bids,omitempty"`
}

get the order book of a specified market

type PaymentAddress

type PaymentAddress struct {

	// currency id
	CompositeCurrency string `json:"composite_currency,omitempty"`

	// currency transfer standard, nil if only 1 version supported
	Version string `json:"version,omitempty"`

	// internal code for the currency
	Currency string `json:"currency,omitempty"`

	// deposit address, nil when generating or deposit suspended
	Address string `json:"address,omitempty"`
}

The addresses could be empty before generated, please call POST /deposit_addresses in that case

type PrivateApiService

type PrivateApiService service

func (*PrivateApiService) GetApiV2Deposit

func (a *PrivateApiService) GetApiV2Deposit(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, txid string) (Deposit, *http.Response, error)
PrivateApiService

get details of a specific deposit * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param txid unique transaction id @return Deposit

func (*PrivateApiService) GetApiV2DepositAddress

func (a *PrivateApiService) GetApiV2DepositAddress(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, localVarOptionals map[string]interface{}) ([]PaymentAddress, *http.Response, error)
PrivateApiService where to deposit

The address could be empty when a new one is generating, try again later in that case. * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string) unique currency id, check /api/v2/currencies for available currencies

@return []PaymentAddress

func (*PrivateApiService) GetApiV2DepositAddresses

func (a *PrivateApiService) GetApiV2DepositAddresses(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, localVarOptionals map[string]interface{}) ([]PaymentAddress, *http.Response, error)
PrivateApiService where to deposit

The addresses could be empty before generated, please call POST /deposit_addresses in that case * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string) unique currency id, check /api/v2/currencies for available currencies

@return []PaymentAddress

func (*PrivateApiService) GetApiV2Deposits

func (a *PrivateApiService) GetApiV2Deposits(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, localVarOptionals map[string]interface{}) ([]Deposit, *http.Response, error)
PrivateApiService

get your deposits history * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string) unique currency id, check /api/v2/currencies for available currencies
@param "from" (int32) target period start (Epoch time in seconds)
@param "to" (int32) target period end (Epoch time in seconds)
@param "state" (string)
@param "pagination" (bool) do pagination & return metadata in header (default false)
@param "page" (int32) page number, applied for pagination (default 1)
@param "limit" (int32) returned limit (1~1000, default 50)
@param "offset" (int32) records to skip, not applied for pagination (default 0)

@return []Deposit

func (*PrivateApiService) GetApiV2MembersMe

func (a *PrivateApiService) GetApiV2MembersMe(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string) (Member, *http.Response, error)
PrivateApiService

get your profile and accounts infomation * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @return Member

func (*PrivateApiService) GetApiV2Order

func (a *PrivateApiService) GetApiV2Order(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, id int32) (Order, *http.Response, error)
PrivateApiService

get a specific order. * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param id unique order id @return Order

func (*PrivateApiService) GetApiV2Orders

func (a *PrivateApiService) GetApiV2Orders(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, market string, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)
PrivateApiService

get your orders, results is paginated. * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "state" (string) filter by state, default to 'wait'
@param "orderBy" (string) order in created time, default to 'asc'.
@param "pagination" (bool) do pagination & return metadata in header (default true)
@param "page" (int32) page number, applied for pagination (default 1)
@param "limit" (int32) returned limit (1~1000, default 100)
@param "offset" (int32) records to skip, not applied for pagination (default 0)

@return []Order

func (*PrivateApiService) GetApiV2TradesMy

func (a *PrivateApiService) GetApiV2TradesMy(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, market string, localVarOptionals map[string]interface{}) ([]Trade, *http.Response, error)
PrivateApiService

get your executed trades, sorted in reverse creation order * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "timestamp" (int32) the seconds elapsed since Unix epoch, set to return trades executed before the time only
@param "from" (int32) trade id, set ot return trades created after the trade
@param "to" (int32) trade id, set to return trades created before the trade
@param "orderBy" (string) order the trades by created time, default to 'desc'
@param "pagination" (bool) do pagination & return metadata in header (default true)
@param "page" (int32) page number, applied for pagination (default 1)
@param "limit" (int32) returned limit (1~1000, default 50)
@param "offset" (int32) records to skip, not applied for pagination (default 0)

@return []Trade

func (*PrivateApiService) GetApiV2Withdrawal

func (a *PrivateApiService) GetApiV2Withdrawal(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, uuid string) (Withdrawal, *http.Response, error)
PrivateApiService

get details of a specific withdraw * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param uuid unique withdraw id @return Withdrawal

func (*PrivateApiService) GetApiV2Withdrawals

func (a *PrivateApiService) GetApiV2Withdrawals(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, localVarOptionals map[string]interface{}) ([]Withdrawal, *http.Response, error)
PrivateApiService

get your withdrawals history * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string) unique currency id, check /api/v2/currencies for available currencies
@param "from" (int32) target period start (Epoch time in seconds)
@param "to" (int32) target period end (Epoch time in seconds)
@param "state" (string)
@param "pagination" (bool) do pagination & return metadata in header (default false)
@param "page" (int32) page number, applied for pagination (default 1)
@param "limit" (int32) returned limit (1~1000, default 50)
@param "offset" (int32) records to skip, not applied for pagination (default 0)

@return []Withdrawal

func (*PrivateApiService) PostApiV2DepositAddresses

func (a *PrivateApiService) PostApiV2DepositAddresses(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, currency string) ([]PaymentAddress, *http.Response, error)
PrivateApiService create deposit addresses

Address creation is asynchronous, please call GET /deposit_addresses later to get generated addresses * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param currency unique currency id, check /api/v2/currencies for available currencies @return []PaymentAddress

func (*PrivateApiService) PostApiV2OrderDelete

func (a *PrivateApiService) PostApiV2OrderDelete(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, id int32) (Order, *http.Response, error)
PrivateApiService

cancel an order * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param id unique order id @return Order

func (*PrivateApiService) PostApiV2Orders

func (a *PrivateApiService) PostApiV2Orders(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, market string, side string, volume string, localVarOptionals map[string]interface{}) (Order, *http.Response, error)
PrivateApiService

create a sell/buy order * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param market unique market id, check /api/v2/markets for available markets @param side 'sell' or 'buy' @param volume total amount to sell/buy, an order could be partially executed @param optional (nil or map[string]interface{}) with one or more of:

@param "price" (string) price of a unit
@param "stopPrice" (string) price to trigger a stop order
@param "ordType" (string) 'limit', 'market', 'stop_limit', or 'stop_market'

@return Order

func (*PrivateApiService) PostApiV2OrdersClear

func (a *PrivateApiService) PostApiV2OrdersClear(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)
PrivateApiService

cancel all your orders with given market and side * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param optional (nil or map[string]interface{}) with one or more of:

@param "side" (string) set tp cancel only sell (asks) or buy (bids) orders
@param "market" (string) specify market like btctwd / ethbtc

@return []Order

func (*PrivateApiService) PostApiV2OrdersMulti

func (a *PrivateApiService) PostApiV2OrdersMulti(ctx context.Context, xMAXACCESSKEY string, xMAXPAYLOAD string, xMAXSIGNATURE string, market string, ordersSide []string, ordersVolume []string, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)
PrivateApiService create multiple sell/buy orders

create multiple sell/buy orders, please put your orders as an array in json body * @param ctx context.Context for authentication, logging, tracing, etc. @param xMAXACCESSKEY access key @param xMAXPAYLOAD encoded payload @param xMAXSIGNATURE encrypted signature @param market unique market id, check /api/v2/markets for available markets @param ordersSide 'sell' or 'buy' @param ordersVolume total amount to sell/buy, an order could be partially executed @param optional (nil or map[string]interface{}) with one or more of:

@param "ordersPrice" ([]string) price of a unit
@param "ordersStopPrice" ([]string) price to trigger a stop order
@param "ordersOrdType" ([]string) 'limit', 'market', 'stop_limit', or 'stop_market'

@return []Order

type PublicApiService

type PublicApiService service

func (*PublicApiService) GetApiV2Currencies

func (a *PublicApiService) GetApiV2Currencies(ctx context.Context) ([]Currency, *http.Response, error)

PublicApiService get all available currencies. * @param ctx context.Context for authentication, logging, tracing, etc. @return []Currency

func (*PublicApiService) GetApiV2Depth

func (a *PublicApiService) GetApiV2Depth(ctx context.Context, market string, localVarOptionals map[string]interface{}) (*http.Response, error)

PublicApiService get depth of a specified market, sorted from highest price to lowest * @param ctx context.Context for authentication, logging, tracing, etc. @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "limit" (int32) returned price levels limit, default to 300

@return

func (*PublicApiService) GetApiV2K

func (a *PublicApiService) GetApiV2K(ctx context.Context, market string, localVarOptionals map[string]interface{}) (*http.Response, error)

PublicApiService get OHLC(k line) of a specific market * @param ctx context.Context for authentication, logging, tracing, etc. @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "limit" (int32) returned data points limit, default to 30
@param "period" (int32) time period of K line in minute, default to 1
@param "timestamp" (int32) the seconds elapsed since Unix epoch, set to return data after the timestamp only

@return

func (*PublicApiService) GetApiV2Markets

func (a *PublicApiService) GetApiV2Markets(ctx context.Context) ([]Market, *http.Response, error)

PublicApiService get all available markets. * @param ctx context.Context for authentication, logging, tracing, etc. @return []Market

func (*PublicApiService) GetApiV2OrderBook

func (a *PublicApiService) GetApiV2OrderBook(ctx context.Context, market string, localVarOptionals map[string]interface{}) (OrderBook, *http.Response, error)

PublicApiService get the order book of a specified market * @param ctx context.Context for authentication, logging, tracing, etc. @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "asksLimit" (int32) returned sell orders limit, default to 20
@param "bidsLimit" (int32) returned buy orders limit, default to 20

@return OrderBook

func (*PublicApiService) GetApiV2Tickers

func (a *PublicApiService) GetApiV2Tickers(ctx context.Context) (Tickers, *http.Response, error)

PublicApiService get ticker of all markets * @param ctx context.Context for authentication, logging, tracing, etc. @return Tickers

func (*PublicApiService) GetApiV2TickersMarket

func (a *PublicApiService) GetApiV2TickersMarket(ctx context.Context, market string) (Ticker, *http.Response, error)

PublicApiService get ticker of specific market * @param ctx context.Context for authentication, logging, tracing, etc. @param market unique market id, check /api/v2/markets for available markets @return Ticker

func (*PublicApiService) GetApiV2Timestamp

func (a *PublicApiService) GetApiV2Timestamp(ctx context.Context) (*http.Response, error)

PublicApiService get server current time, in seconds since Unix epoch * @param ctx context.Context for authentication, logging, tracing, etc. @return

func (*PublicApiService) GetApiV2Trades

func (a *PublicApiService) GetApiV2Trades(ctx context.Context, market string, localVarOptionals map[string]interface{}) ([]Trade, *http.Response, error)

PublicApiService get recent trades on market, sorted in reverse creation order * @param ctx context.Context for authentication, logging, tracing, etc. @param market unique market id, check /api/v2/markets for available markets @param optional (nil or map[string]interface{}) with one or more of:

@param "timestamp" (int32) the seconds elapsed since Unix epoch, set to return trades executed before the time only
@param "from" (int32) trade id, set ot return trades created after the trade
@param "to" (int32) trade id, set to return trades created before the trade
@param "orderBy" (string) order the trades by created time, default to 'desc'
@param "pagination" (bool) do pagination & return metadata in header (default true)
@param "page" (int32) page number, applied for pagination (default 1)
@param "limit" (int32) returned limit (1~1000, default 50)
@param "offset" (int32) records to skip, not applied for pagination (default 0)

@return []Trade

type Ticker

type Ticker struct {

	// timestamp in seconds since Unix epoch
	At int32 `json:"at,omitempty"`

	// highest buy price
	Buy string `json:"buy,omitempty"`

	// lowest sell price
	Sell string `json:"sell,omitempty"`

	// price before 24 hours
	Open string `json:"open,omitempty"`

	// lowest price within 24 hours
	Low string `json:"low,omitempty"`

	// highest price within 24 hours
	High string `json:"high,omitempty"`

	// last traded price
	Last string `json:"last,omitempty"`

	// traded volume within 24 hours
	Vol string `json:"vol,omitempty"`
}

get ticker of specific market

type Tickers

type Tickers struct {
	Btctwd *Ticker `json:"btctwd,omitempty"`

	Ethtwd *Ticker `json:"ethtwd,omitempty"`

	Ltctwd *Ticker `json:"ltctwd,omitempty"`

	Mithtwd *Ticker `json:"mithtwd,omitempty"`

	Bchtwd *Ticker `json:"bchtwd,omitempty"`

	Usdttwd *Ticker `json:"usdttwd,omitempty"`

	Ethbtc *Ticker `json:"ethbtc,omitempty"`

	Mitheth *Ticker `json:"mitheth,omitempty"`

	Trxtwd *Ticker `json:"trxtwd,omitempty"`

	Trxbtc *Ticker `json:"trxbtc,omitempty"`

	Trxeth *Ticker `json:"trxeth,omitempty"`

	Trxusdt *Ticker `json:"trxusdt,omitempty"`

	Btcusdt *Ticker `json:"btcusdt,omitempty"`

	Ethusdt *Ticker `json:"ethusdt,omitempty"`

	Bchusdt *Ticker `json:"bchusdt,omitempty"`

	Ltcusdt *Ticker `json:"ltcusdt,omitempty"`

	Mithbtc *Ticker `json:"mithbtc,omitempty"`

	Mithusdt *Ticker `json:"mithusdt,omitempty"`

	Cccxbtc *Ticker `json:"cccxbtc,omitempty"`

	Cccxeth *Ticker `json:"cccxeth,omitempty"`

	Cccxtwd *Ticker `json:"cccxtwd,omitempty"`

	Cccxusdt *Ticker `json:"cccxusdt,omitempty"`

	Eosbtc *Ticker `json:"eosbtc,omitempty"`

	Eoseth *Ticker `json:"eoseth,omitempty"`

	Eostwd *Ticker `json:"eostwd,omitempty"`

	Eosusdt *Ticker `json:"eosusdt,omitempty"`

	Palbtc *Ticker `json:"palbtc,omitempty"`

	Paleth *Ticker `json:"paleth,omitempty"`

	Paltwd *Ticker `json:"paltwd,omitempty"`

	Batbtc *Ticker `json:"batbtc,omitempty"`

	Bateth *Ticker `json:"bateth,omitempty"`

	Battwd *Ticker `json:"battwd,omitempty"`

	Batusdt *Ticker `json:"batusdt,omitempty"`

	Zrxbtc *Ticker `json:"zrxbtc,omitempty"`

	Zrxeth *Ticker `json:"zrxeth,omitempty"`

	Zrxtwd *Ticker `json:"zrxtwd,omitempty"`

	Zrxusdt *Ticker `json:"zrxusdt,omitempty"`

	Gntbtc *Ticker `json:"gntbtc,omitempty"`

	Gnteth *Ticker `json:"gnteth,omitempty"`

	Gnttwd *Ticker `json:"gnttwd,omitempty"`

	Gntusdt *Ticker `json:"gntusdt,omitempty"`

	Omgbtc *Ticker `json:"omgbtc,omitempty"`

	Omgeth *Ticker `json:"omgeth,omitempty"`

	Omgtwd *Ticker `json:"omgtwd,omitempty"`

	Omgusdt *Ticker `json:"omgusdt,omitempty"`

	Kncbtc *Ticker `json:"kncbtc,omitempty"`

	Knceth *Ticker `json:"knceth,omitempty"`

	Knctwd *Ticker `json:"knctwd,omitempty"`

	Kncusdt *Ticker `json:"kncusdt,omitempty"`
}

get ticker of all markets

type Trade

type Trade struct {

	// trade id
	Id int32 `json:"id,omitempty"`

	// strike price
	Price string `json:"price,omitempty"`

	// traded volume
	Volume string `json:"volume,omitempty"`

	// total traded amount
	Funds string `json:"funds,omitempty"`

	// market id
	Market string `json:"market,omitempty"`

	// created timestamp (second)
	CreatedAt int32 `json:"created_at,omitempty"`

	// 'bid' or 'ask', according to maker
	Side string `json:"side,omitempty"`

	// order related to you
	OrderId int32 `json:"order_id,omitempty"`
}

get recent trades on market, sorted in reverse creation order

type Withdrawal

type Withdrawal struct {

	// unique withdraw id
	Uuid string `json:"uuid,omitempty"`

	// currency id
	Currency string `json:"currency,omitempty"`

	// withdraw amount
	Amount string `json:"amount,omitempty"`

	// withdraw fee
	Fee string `json:"fee,omitempty"`

	// transaction id
	Txid string `json:"txid,omitempty"`

	// created timestamp (second)
	CreatedAt int32 `json:"created_at,omitempty"`

	// lastest updated timestamp (second)
	UpdatedAt int32 `json:"updated_at,omitempty"`

	// current state
	State string `json:"state,omitempty"`
}

get details of a specific withdraw

Jump to

Keyboard shortcuts

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