Documentation
¶
Index ¶
- type APIAuthResponse
- type APIAuthResultContainer
- type APIBalanceResponse
- type APIBookValueResponse
- type APICurrenciesListResponse
- type APIOperationsHistoryResponse
- type APIOrdersHistoryResponse
- type APIOrdersResponse
- type APIPairsData
- type APIPairsResponse
- type APIPlainResponse
- type APISessionData
- type APITradeData
- type APITradeHistoryResponse
- type APITradeResponse
- type BalanceData
- type BalanceResponse
- type BookValueData
- type BookValueDataContainer
- type Client
- func (c *Client) Auth(cred Credentials) (*APIAuthResultContainer, error)
- func (c *Client) Buy(pairSymbol string, amount, price float64) (int64, error)
- func (c *Client) Cancel(orderID int64) error
- func (c *Client) GetBalance() ([]BalanceData, error)
- func (c *Client) GetMarketCurrenciesList(pairSymbol string) (*CurrenciesListData, error)
- func (c *Client) GetOrderBook(pairSymbol string) (*BookValueDataContainer, error)
- func (c *Client) GetOrderHistory(orderID string) (*OrdersHistoryDataContainer, error)
- func (c *Client) GetPairPrice(pairCode string) (PairPriceData, error)
- func (c *Client) GetPairs() ([]PairsDataContainer, error)
- func (c *Client) GetTradeHistory(pairSymbol string) (*TradeHistoryDataContainer, error)
- func (c *Client) Hold(orderID int64) error
- func (c *Client) Logout() error
- func (c *Client) NewGetAccountHistoryService(requestType string) *GetAccountHistoryService
- func (c *Client) NewGetOrdersService() *GetOrdersService
- func (c *Client) Sell(pairSymbol string, amount, price float64) (int64, error)
- type Credentials
- type CurrenciesListData
- type CurrencyData
- type GetAccountHistoryService
- func (s *GetAccountHistoryService) Do() (*OperationsHistoryDataContainer, error)
- func (s *GetAccountHistoryService) SetCurrency(newCurrency string) *GetAccountHistoryService
- func (s *GetAccountHistoryService) SetFromID(newID string) *GetAccountHistoryService
- func (s *GetAccountHistoryService) SetRecordType(newRecordType string) *GetAccountHistoryService
- func (s *GetAccountHistoryService) SetRequestType(newRequestType string) *GetAccountHistoryService
- type GetOrdersService
- type MarketDataContainer
- type OperationsHistoryDataContainer
- type OrderData
- type OrdersDataContainer
- type OrdersHistoryDataContainer
- type OrdersHistoryPairData
- type PaginationData
- type PairData
- type PairPriceData
- type PairsDataContainer
- type TradeHistoryData
- type TradeHistoryDataContainer
- type UserData
- type UserSessionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIAuthResponse ¶
type APIAuthResponse struct { Success bool `json:"success"` Error string `json:"text"` Result APIAuthResultContainer `json:"result"` }
APIAuthResponse - ..
type APIAuthResultContainer ¶
type APIAuthResultContainer struct { UserSession UserSessionData `json:"user_session"` AuthToken string `json:"auth_token"` }
APIAuthResultContainer - ..
type APIBalanceResponse ¶
type APIBalanceResponse struct { Success bool `json:"success"` Error string `json:"text"` // srly? text? oh my god, crp.is developers... Result BalanceResponse `json:"result"` }
APIBalanceResponse - ..
type APIBookValueResponse ¶
type APIBookValueResponse struct { Success bool `json:"success"` Error string `json:"text"` Result BookValueDataContainer `json:"result"` }
APIBookValueResponse - ..
type APICurrenciesListResponse ¶
type APICurrenciesListResponse struct { Success bool `json:"success"` Error string `json:"text"` Result CurrenciesListData `json:"result"` }
APICurrenciesListResponse - ..
type APIOperationsHistoryResponse ¶
type APIOperationsHistoryResponse struct { Success bool `json:"success"` Error string `json:"text"` Result OperationsHistoryDataContainer `json:"result"` }
APIOperationsHistoryResponse - ..
type APIOrdersHistoryResponse ¶
type APIOrdersHistoryResponse struct { Success bool `json:"success"` Error string `json:"text"` Result OrdersHistoryDataContainer `json:"result"` }
APIOrdersHistoryResponse - ..
type APIOrdersResponse ¶
type APIOrdersResponse struct { Success bool `json:"success"` Error string `json:"text"` Result OrdersDataContainer `json:"result"` }
APIOrdersResponse - response from get orders list
type APIPairsData ¶ added in v1.3.0
type APIPairsData struct {
Pairs []PairsDataContainer `json:"pairs"`
}
APIPairsData - ..
type APIPairsResponse ¶
type APIPairsResponse struct { Success bool `json:"success"` Error string `json:"text"` Result APIPairsData `json:"result"` }
APIPairsResponse - ..
type APIPlainResponse ¶
type APIPlainResponse struct { Success bool `json:"success"` Error string `json:"text"` Result string `json:"result"` }
APIPlainResponse - ..
type APISessionData ¶
type APISessionData struct {
ID string `json:"id"` // session ID -- UUID format
}
APISessionData - ..
type APITradeData ¶
APITradeData - ..
type APITradeHistoryResponse ¶
type APITradeHistoryResponse struct { Success bool `json:"success"` Error string `json:"text"` Result TradeHistoryDataContainer `json:"result"` }
APITradeHistoryResponse - ..
type APITradeResponse ¶
type APITradeResponse struct { Success bool `json:"success"` Error string `json:"text"` Result APITradeData `json:"result"` }
APITradeResponse - ..
type BalanceData ¶
type BalanceData struct { ID int `json:"id"` Currency CurrencyData `json:"currency"` Reserve float64 `json:"reserve"` Balance float64 `json:"balance"` }
BalanceData - ..
type BalanceResponse ¶
type BalanceResponse struct { AllBalance []BalanceData `json:"allbalance"` UserID string `json:"user_id"` }
BalanceResponse - ..
type BookValueData ¶
type BookValueData struct { Price float64 `json:"price"` // example: 0.1752 Amount float64 `json:"amount"` // example: 1555 Value float64 `json:"value"` // example: 272.436 }
BookValueData - ..
type BookValueDataContainer ¶
type BookValueDataContainer struct { Sell []BookValueData `json:"book_sell"` Buy []BookValueData `json:"book_buy"` }
BookValueDataContainer - ..
type Client ¶
type Client struct { APICredentials Credentials `json:"credentials"` AuthToken string `json:"authToken"` }
Client - ..
func (*Client) Auth ¶
func (c *Client) Auth(cred Credentials) (*APIAuthResultContainer, error)
Auth client
func (*Client) GetBalance ¶
func (c *Client) GetBalance() ([]BalanceData, error)
GetBalance - get balance data for all coins
func (*Client) GetMarketCurrenciesList ¶
func (c *Client) GetMarketCurrenciesList(pairSymbol string) (*CurrenciesListData, error)
GetMarketCurrenciesList - get exchange currencies list
func (*Client) GetOrderBook ¶
func (c *Client) GetOrderBook(pairSymbol string) (*BookValueDataContainer, error)
GetOrderBook by trade pair
func (*Client) GetOrderHistory ¶
func (c *Client) GetOrderHistory(orderID string) (*OrdersHistoryDataContainer, error)
GetOrderHistory - get orders history
func (*Client) GetPairPrice ¶ added in v1.3.3
func (c *Client) GetPairPrice(pairCode string) (PairPriceData, error)
func (*Client) GetPairs ¶
func (c *Client) GetPairs() ([]PairsDataContainer, error)
GetPairs - get trading pairs list
func (*Client) GetTradeHistory ¶
func (c *Client) GetTradeHistory(pairSymbol string) (*TradeHistoryDataContainer, error)
GetTradeHistory - get trading history by pairs
func (*Client) NewGetAccountHistoryService ¶
func (c *Client) NewGetAccountHistoryService(requestType string) *GetAccountHistoryService
NewGetAccountHistoryService - create new get account history service
func (*Client) NewGetOrdersService ¶
func (c *Client) NewGetOrdersService() *GetOrdersService
NewGetOrdersService - create new get orders service
type Credentials ¶
type Credentials struct { AccountPublicKey string `json:"PublicKey"` // Utopia Account public key Password string `json:"password"` // Exchange User password TwoFACode string `json:"2fa_pin"` // 2-factor-authorization code. optional }
Credentials - ..
type CurrencyData ¶
type CurrencyData struct { ID int64 `json:"id"` Name string `json:"name"` // example: crp FullName string `json:"fullname"` // example: Utopia Crypton AppName string `json:"appname"` // example: crypton Icon string `json:"icon"` // example: crp Round int `json:"round"` // round precision, example: 8 DepositFee float64 `json:"deposit_fee"` // example: 0 DepositFeePRO float64 `json:"withdraw_fee_pro"` // example: 0.1 MinWithdraw float64 `json:"withdraw_min"` // example: 5 AddressSize int `json:"address_size"` // example: 64 MinFee float64 `json:"min_fee"` // example: 0.00000001 Enable bool `json:"enable"` // example: true Visible bool `json:"show"` // example: true }
CurrencyData - ..
type GetAccountHistoryService ¶
type GetAccountHistoryService struct { // required ExchangeClient *Client RequestType string // history type: profile/trade/billing // optional FromID string // pagination offset: uuid RecordType string // billing operation type (only for billing): payment/comission/withdraw or combined Currency string // currency (only for billing type) }
GetAccountHistoryService - get operations history service
func (*GetAccountHistoryService) Do ¶
func (s *GetAccountHistoryService) Do() (*OperationsHistoryDataContainer, error)
Do request
func (*GetAccountHistoryService) SetCurrency ¶
func (s *GetAccountHistoryService) SetCurrency(newCurrency string) *GetAccountHistoryService
SetCurrency - set currency for request: currency (only for billing type)
func (*GetAccountHistoryService) SetFromID ¶
func (s *GetAccountHistoryService) SetFromID(newID string) *GetAccountHistoryService
SetFromID - set form ID for request: pagination offset: uuid
func (*GetAccountHistoryService) SetRecordType ¶
func (s *GetAccountHistoryService) SetRecordType(newRecordType string) *GetAccountHistoryService
SetRecordType - set record type for request: billing operation type (only for billing): payment/comission/withdraw or combined
func (*GetAccountHistoryService) SetRequestType ¶
func (s *GetAccountHistoryService) SetRequestType(newRequestType string) *GetAccountHistoryService
SetRequestType - set request type for request
type GetOrdersService ¶
type GetOrdersService struct { ExchangeClient *Client OrderType string // order type: open/close/cancel/hold TaskType string // task type: buy/sell }
GetOrdersService - get orders service with optional params
func (*GetOrdersService) Do ¶
func (s *GetOrdersService) Do() (*OrdersDataContainer, error)
Do request
func (*GetOrdersService) SetOrderType ¶
func (s *GetOrdersService) SetOrderType(newType string) *GetOrdersService
SetOrderType - set order type: open/close/cancel/hold
func (*GetOrdersService) SetTaskType ¶
func (s *GetOrdersService) SetTaskType(taskType string) *GetOrdersService
SetTaskType - set task type: buy/sell
type MarketDataContainer ¶
type MarketDataContainer struct { Open float64 `json:"open"` // example: 0.1744 Close float64 `json:"close"` // example: 0.1752 High float64 `json:"high"` // example: 0.1766 Low float64 `json:"low"` // example: 0.1553 Volume float64 `json:"volume"` // example: 67044.815 VolumeUSD float64 `json:"volume_usd"` // example: 1174.6252 Value float64 `json:"value"` // example: 11346.6402207 Rate float64 `json:"rate"` // example: 0.46 DateNow int64 `json:"date_now"` // example: 1634566376377 }
MarketDataContainer - ..
type OperationsHistoryDataContainer ¶
type OperationsHistoryDataContainer struct {
Items []TradeHistoryData `json:"items"`
}
OperationsHistoryDataContainer - ..
type OrderData ¶
type OrderData struct { OrderID int64 `json:"order_id"` // example: 3747944 Amount float64 `json:"amount"` // example: 1 Price float64 `json:"price"` // example: 3 Value float64 `json:"value"` // example: 3 OriginalValue float64 `json:"orig_value"` // example: 3 OriginalAmount float64 `json:"orig_amount"` // example: 1 OrderRegistrationDate int64 `json:"date_reg"` // example: 1527883807109 TaskType string `json:"task"` // example: sell Status string `json:"status"` // example: open BaseTicker string `json:"cur"` // example: crp QuoteTicker string `json:"ecur"` // example: usdt ExecutedPrice float64 `json:"price_executed"` // example: 0 ExecutedValue float64 `json:"value_executed"` // example: 0 }
OrderData - ..
type OrdersDataContainer ¶
type OrdersDataContainer struct { AllOrders []OrderData `json:"allorders"` Pagination PaginationData `json:"paginator"` Filters []string `json:"filters"` MyOrdersCount int `json:"my_order_count"` }
OrdersDataContainer - orders response data
type OrdersHistoryDataContainer ¶
type OrdersHistoryDataContainer struct { Order OrderData `json:"order"` History []OrderData `json:"history"` Pair OrdersHistoryPairData `json:"pair"` }
OrdersHistoryDataContainer - ..
type OrdersHistoryPairData ¶
type OrdersHistoryPairData struct { BaseTicker string `json:"cur"` QuoteTicker string `json:"ecur"` }
OrdersHistoryPairData - ..
type PaginationData ¶
type PaginationData struct { Count int `json:"count"` Page int `json:"page"` Limit int `json:"limit"` }
PaginationData - ..
type PairData ¶
type PairData struct { ID int64 `json:"pair_id"` // example: 25 PairCode string `json:"pair"` // example: crp_usdt PairTitle string `json:"pair_show"` // example: CRP / USDT CoinsGroup string `json:"group"` // example: crp Visible bool `json:"visible"` // example: true Enabled bool `json:"enable"` // example: true RoundDealAmount int `json:"round_deal_amount"` // example: 3 RoundDealPrice int `json:"round_deal_price"` // example: 4 MinAmount float64 `json:"min_amount"` // 1 MinPrice float64 `json:"min_price"` // 0.001 MaxPrice float64 `json:"max_price"` // 100 }
PairData - ..
type PairPriceData ¶ added in v1.3.3
type PairsDataContainer ¶
type PairsDataContainer struct { Pair PairData `json:"pair"` MarketData MarketDataContainer `json:"data_market"` }
PairsDataContainer - ..
type TradeHistoryData ¶
type TradeHistoryData struct { RecordID string `json:"record_id"` // UUID format, example: f914ea5d-32ae-4eac-a5e0-e94d55f7b4a7 RecordType string `json:"record_type"` // example: buy Price float64 `json:"price"` // example: 0.1752 Amount float64 `json:"amount"` // example: 1 Value float64 `json:"value"` // 0.1752 CreatedAt int64 `json:"created_at"` // date, example: 1634566302532 }
TradeHistoryData - ..
type TradeHistoryDataContainer ¶
type TradeHistoryDataContainer struct { Items []TradeHistoryData `json:"items"` Pair OrdersHistoryPairData `json:"pair"` }
TradeHistoryDataContainer - ..
type UserData ¶
type UserData struct { ID string `json:"id"` // exchange user ID -- UUID format Name string `json:"name"` // username Status string `json:"status"` // example: active Lang string `json:"lang"` // user language }
UserData - ..
type UserSessionData ¶
type UserSessionData struct { User UserData `json:"user"` APISession APISessionData `json:"session"` }
UserSessionData - ..