coinbase

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2017 License: GPL-3.0 Imports: 9 Imported by: 2

README

Coinbase Golang API Library

Build Status GoDoc

The library was tested against coinbase.com APIv2

Installation

go get github.com/Zauberstuhl/go-coinbase

# or use gopkg for specific versions
go get gopkg.in/Zauberstuhl/go-coinbase.v1.0.0

Supported API Calls

  • Wallet Endpoints
  • Users
  • Accounts
  • Addresses
  • Transactions
  • Buys
  • Sells
  • Deposits
  • Withdrawals
  • Payment methods
  • Merchant Endpoints
  • Merchants
  • Orders
  • Checkouts
  • Data Endpoints
  • Currencies*
  • Exchange rates*
  • Prices*
  • Time*

* with unit-test coverage

Example

import "github.com/Zauberstuhl/go-coinbase"

c := coinbase.APIClient{
  Key: "123",
  Secret: "123456",
}

acc, err := c.Accounts()
if err != nil {
  fmt.Println(err)
  return
}

for i, acc := range accounts.Data {
  fmt.Printf("ID: %s\nName: %s\nType: %s\nAmount: %f\nCurrency: %s\n",
    acc.Id, acc.Name, acc.Type,
    acc.Balance.Amount, acc.Balance.Currency)
}

# sample output
ID: 1234-12-1234-1232
Name: Test Wallet
Type: BTC
Amount: 0.0
Currency: EUR
[...]

Unit Tests

Run all available unit tests via:

make test

Most of the tests require a internet connection!

Documentation

Overview

Package coinbase provides a simple user interface for API calls to coinbase.com.

Example:

c := coinbase.APIClient{
  Key: "123",
  Secret: "123456",
}
acc, err := c.Accounts()
if err != nil {
  fmt.Println(err)
  return
}
for i, acc := range accounts.Data {
  fmt.Printf("ID: %s\nName: %s\nType: %s\nAmount: %f\nCurrency: %s\n",
    acc.Id, acc.Name, acc.Type,
    acc.Balance.Amount, acc.Balance.Currency)
}
# sample output
ID: 1234-12-1234-1232
Name: Test Wallet
Type: BTC
Amount: 0.0
Currency: EUR
[...]

Index

Constants

View Source
const (
	// ENDPOINT defaults to https://api.coinbase.com
	// but can be overridden for test purposes
	ENDPOINT = "https://api.coinbase.com"
	// API_VERSION since version two you have to
	// specify a API version in your http request headers
	API_VERSION = "2016-03-08"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIAccount

type APIAccount struct {
	Data APIAccountData
}

type APIAccountData

type APIAccountData struct {
	Id             string
	Name           string
	Primary        bool
	Type           string
	Currency       string
	Balance        APIBalance
	Native_balance APIBalance
	Created_at     string
	Updated_at     string
	Resource       string
	Resource_path  string
}

Example Response:

{
  "id": "2bbf394c-193b-5b2a-9155-3b4732659ede",
  "name": "My Wallet",
  "primary": true,
  "type": "wallet",
  "currency": "BTC",
  "balance": {
      "amount": "39.59000000",
      "currency": "BTC"
  },
  "native_balance": {
      "amount": "395.90",
      "currency": "USD"
  },
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-01-31T20:49:02Z",
  "resource": "account",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede"
}

type APIAccounts

type APIAccounts struct {
	Pagination APIPagination
	Data       []APIAccountData
}

Example Response:

{
  "pagination": {
    "ending_before": null,
    "starting_after": null,
    "limit": 25,
    "order": "desc",
    "previous_uri": null,
    "next_uri": null
  },
  "data": [
    {
      "id": "58542935-67b5-56e1-a3f9-42686e07fa40",
      "name": "My Vault",
      "primary": false,
      "type": "vault",
      "currency": "BTC",
      "balance": {
        "amount": "4.00000000",
        "currency": "BTC"
      },
      "native_balance": {
        "amount": "40.00",
        "currency": "USD"
      },
      "created_at": "2015-01-31T20:49:02Z",
      "updated_at": "2015-01-31T20:49:02Z",
      "resource": "account",
      "resource_path": "/v2/accounts/58542935-67b5-56e1-a3f9-42686e07fa40",
      "ready": true
    },
[...]

type APIAddress

type APIAddress struct {
	Data APIAddressData
}

type APIAddressData

type APIAddressData struct {
	Id            string
	Address       string
	Name          string
	Created_at    string
	Updated_at    string
	Network       string
	Resource      string
	Resource_path string
}

Example Response:

{
  "id": "dd3183eb-af1d-5f5d-a90d-cbff946435ff",
  "address": "mswUGcPHp1YnkLCgF1TtoryqSc5E9Q8xFa",
  "name": "One off payment",
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-03-31T17:25:29-07:00",
  "network": "bitcoin",
  "resource": "address",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/addresses/dd3183eb-af1d-5f5d-a90d-cbff946435ff"
}

type APIAddresses

type APIAddresses struct {
	Pagination APIPagination
	Data       []APIAddressData
}

type APIBalance

type APIBalance struct {
	Amount   float64 `json:",string"`
	Currency string
}

Example Response:

"balance": {
    "amount": "39.59000000",
    "currency": "BTC"
},

type APIBalanceData

type APIBalanceData struct {
	Data APIBalance
}

TODO wrong naming convention

type APIClient

type APIClient struct {
	Key        string
	Secret     string
	Endpoint   string
	ApiVersion string
}

APIClient is the interface for most of the API calls If Endpoint or ApiVersion aren't defined the library will use the default https://api.coinbase.com

func (*APIClient) Account

func (a *APIClient) Account(id string) (account APIAccount, err error)

Account requires a account ID and returns and APIAccount struct

func (*APIClient) Accounts

func (a *APIClient) Accounts() (accounts APIAccounts, err error)

Accounts returns all known accounts as APIAccounts struct

func (*APIClient) Authenticate

func (a *APIClient) Authenticate(path string, req *http.Request) error

Authenticate works with the Fetch call and adds certain Headers to the http request. This includes the actual API key and the timestamp of the request. Also a signature which is encoded with hmac and the API secret key.

func (*APIClient) CancelRequestMoney

func (a *APIClient) CancelRequestMoney(id, transId string) (err error)

CancelRequestMoney requires an account ID, transaction ID

func (*APIClient) CommitBuy

func (a *APIClient) CommitBuy(id AccountId, bid BuyId) (buys APIWalletTransfer, err error)

CommitBuy requires an account ID, buy ID and returns an APIWalletTransfer struct

func (*APIClient) CommitDeposit

func (a *APIClient) CommitDeposit(id AccountId, did DepositId) (deposits APIWalletTransfer, err error)

CommitDeposit requires an account ID, deposit ID and returns an APIWalletTransfer struct

func (*APIClient) CommitSell

func (a *APIClient) CommitSell(id AccountId, sid SellId) (sells APIWalletTransfer, err error)

CommitSell requires an account ID, sell ID and returns an APIWalletTransfer struct

func (*APIClient) CommitWithdrawal

func (a *APIClient) CommitWithdrawal(id AccountId, wid WithdrawalId) (withdrawals APIWalletTransfer, err error)

CommitWithdrawal requires an account ID, deposit ID and returns an APIWalletTransfer struct

func (*APIClient) CompleteRequestMoney

func (a *APIClient) CompleteRequestMoney(id, transId string) (err error)

CompleteRequestMoney requires an account ID, transaction ID

func (*APIClient) CreateAccount

func (a *APIClient) CreateAccount(name string) (account APIAccount, err error)

CreateAccount requires an account name as parameter and returns an APIAccount struct

func (*APIClient) CreateAddress

func (a *APIClient) CreateAddress(id, name string) (address APIAddress, err error)

CreateAddress requires an account ID and the address Name as parameter. It will return an APIAddress struct

func (*APIClient) DeleteAccount

func (a *APIClient) DeleteAccount(id string) (account APIAccount, err error)

DeleteAccount requires an account ID and returns an APIAccount struct

func (*APIClient) DepositFunds

func (a *APIClient) DepositFunds(id AccountId, order APIWalletTransferOrder) (deposits APIWalletTransfer, err error)

DepositFunds requires an account ID, APIWalletTransferOrder and returns an APIWalletTransfer struct

func (*APIClient) Fetch

func (a *APIClient) Fetch(method, path string, body io.Reader, result interface{}) error

Fetch works as a wrapper for all kind of http requests. It requires a http method and a relative path to the API endpoint. It will try to decode all results into a single interface type which you can provide.

func (*APIClient) GetAddress

func (a *APIClient) GetAddress(id, addressId string) (address APIAddress, err error)

GetAddress requires an account ID and address ID. It will return an APIAddress struct

func (*APIClient) GetAddresses

func (a *APIClient) GetAddresses(id string) (addresses APIAddresses, err error)

GetAddresses requires an address ID and returns an APIAddresses struct

func (*APIClient) GetBuyPrice

func (a *APIClient) GetBuyPrice(c ConfigPrice) (balance APIBalanceData, err error)

GetBuyPrice requires a ConfigPrice struct as parameter and returns an APIBalanceData struct

func (*APIClient) GetCurrencies

func (a *APIClient) GetCurrencies() (curr APICurrencies, err error)

GetCurrencies will return an APICurrencies struct

func (*APIClient) GetCurrentTime

func (a *APIClient) GetCurrentTime() (time APITime, err error)

GetCurrentTime returns an APITime struct

func (*APIClient) GetCurrentUser

func (a *APIClient) GetCurrentUser() (user APIUser, err error)

GetCurrentUser returns an APIUser struct

func (*APIClient) GetCurrentUserAuth

func (a *APIClient) GetCurrentUserAuth() (auth APIUserAuth, err error)

GetCurrentUserAuth returns an APIUserAuth struct

func (*APIClient) GetExchangeRates

func (a *APIClient) GetExchangeRates(currency string) (rates APIExchangeRates, err error)

GetExchangeRates requires the currency as parameter and returns an APIExchangeRates struct

func (*APIClient) GetSellPrice

func (a *APIClient) GetSellPrice(c ConfigPrice) (balance APIBalanceData, err error)

GetSellPrice requires a ConfigPrice struct as parameter and returns an APIBalanceData struct

func (*APIClient) GetSpotPrice

func (a *APIClient) GetSpotPrice(c ConfigPrice) (balance APIBalanceData, err error)

GetSpotPrice requires a ConfigPrice struct as parameter and returns an APIBalanceData struct. If you define a date you will recieve the spot price for the given date.

func (*APIClient) GetTransaction

func (a *APIClient) GetTransaction(id, transId string) (trans APITransaction, err error)

GetTransaction requires an account ID, transaction ID and returns an APITransaction struct

func (*APIClient) GetTransactions

func (a *APIClient) GetTransactions(id string) (trans APITransactions, err error)

GetTransactions requires an account ID and returns an APITransactions struct

func (*APIClient) GetUser

func (a *APIClient) GetUser(id string) (user APIUser, err error)

GetUser requires a user ID and returns an APIUser struct

func (*APIClient) ListAddressTransactions

func (a *APIClient) ListAddressTransactions(id, address string) (trans APITransactions, err error)

ListAddressTransactions requires an account ID and address ID. It will return an APITransactions struct

func (*APIClient) ListBuys

func (a *APIClient) ListBuys(id AccountId) (buys APIWalletTransferList, err error)

ListBuys requires an account ID and returns an APIWalletTransferList struct

func (*APIClient) ListDeposits

func (a *APIClient) ListDeposits(id AccountId) (deposits APIWalletTransferList, err error)

ListDeposits requires an account ID and returns an APIWalletTransferList struct

func (*APIClient) ListPaymentMethods

func (a *APIClient) ListPaymentMethods() (methods APIPaymentMethods, err error)

ListPaymentMethods returns an APIPaymentMethods struct

func (*APIClient) ListSells

func (a *APIClient) ListSells(id AccountId) (sells APIWalletTransferList, err error)

ListSells requires an account ID and returns an APIWalletTransferList struct

func (*APIClient) ListWithdrawals

func (a *APIClient) ListWithdrawals(id AccountId) (withdrawals APIWalletTransferList, err error)

ListWithdrawals requires an account ID and returns an APIWalletTransferList struct

func (*APIClient) PlaceBuyOrder

func (a *APIClient) PlaceBuyOrder(id AccountId, order APIWalletTransferOrder) (buys APIWalletTransfer, err error)

PlaceBuyOrder requires an account ID, APIWalletTransferOrder and returns an APIWalletTransfer struct

func (*APIClient) PlaceSellOrder

func (a *APIClient) PlaceSellOrder(id AccountId, order APIWalletTransferOrder) (sells APIWalletTransfer, err error)

PlaceSellOrder requires an account ID, APIWalletTransferOrder and returns an APIWalletTransfer struct

func (*APIClient) ResendRequestMoney

func (a *APIClient) ResendRequestMoney(id, transId string) (err error)

ResendRequestMoney requires an account ID, transaction ID

func (*APIClient) SendTransferRequestMoney

func (a *APIClient) SendTransferRequestMoney(id string, send APITransactionsSend) (trans APITransaction, err error)

SendTransferRequestMoney requires an account ID, APITransactionsSend struct and returns am APITransaction struct TODO move account ID into the APITransactionsSend struct

func (*APIClient) SetPrimaryAccount

func (a *APIClient) SetPrimaryAccount(id string) (account APIAccount, err error)

SetPrimaryAccount requires an account ID and returns an APIAccount struct

func (*APIClient) ShowBuy

func (a *APIClient) ShowBuy(id AccountId, bid BuyId) (buys APIWalletTransfer, err error)

ShowBuy requires an account ID, buy ID and returns an APIWalletTransfer struct

func (*APIClient) ShowDeposit

func (a *APIClient) ShowDeposit(id AccountId, did DepositId) (deposits APIWalletTransfer, err error)

ShowDeposit requires an account ID, deposit ID and returns an APIWalletTransfer struct

func (*APIClient) ShowPaymentMethod

func (a *APIClient) ShowPaymentMethod(id PaymentMethodId) (method APIPaymentMethod, err error)

ListPaymentMethods returns an APIPaymentMethods struct

func (*APIClient) ShowSell

func (a *APIClient) ShowSell(id AccountId, sid SellId) (sells APIWalletTransfer, err error)

ShowSell requires an account ID, buy ID and returns an APIWalletTransfer struct

func (*APIClient) ShowWithdrawal

func (a *APIClient) ShowWithdrawal(id AccountId, wid WithdrawalId) (withdrawals APIWalletTransfer, err error)

ShowWithdrawal requires an account ID, withdrawal ID and returns an APIWalletTransfer struct

func (*APIClient) UpdateAccount

func (a *APIClient) UpdateAccount(id, name string) (account APIAccount, err error)

UpdateAccount requires an account ID, Name as parameter and returns an APIAccount struct

func (*APIClient) UpdateCurrentUser

func (a *APIClient) UpdateCurrentUser(name string) (user APIUser, err error)

UpdateCurrentUser requires a new username and returns an APIUser struct

func (*APIClient) WithdrawalFunds

func (a *APIClient) WithdrawalFunds(id AccountId, order APIWalletTransferOrder) (withdrawals APIWalletTransfer, err error)

WithdrawalFunds requires an account ID, APIWalletTransferOrder and returns an APIWalletTransfer struct

type APIClientEpoch

type APIClientEpoch struct {
	Data struct {
		Epoch int64
	}
}

APIClientEpoch is used for decoding json "/v2/time" responses

type APICurrencies

type APICurrencies struct {
	Data []APICurrenciesData
}

type APICurrenciesData

type APICurrenciesData struct {
	Id       string
	Name     string
	Min_size float64 `json:",string"`
}

Example Response:

{
  "data": [
    {
      "id": "AED",
      "name": "United Arab Emirates Dirham",
      "min_size": "0.01000000"
    },
    {
      "id": "AFN",
      "name": "Afghan Afghani",
      "min_size": "0.01000000"
    },
    {
      "id": "ALL",
      "name": "Albanian Lek",
      "min_size": "0.01000000"
    },
    {
      "id": "AMD",
      "name": "Armenian Dram",
      "min_size": "0.01000000"
    },
    ...
  }
}

type APIExchangeRates

type APIExchangeRates struct {
	Data APIExchangeRatesData
}

type APIExchangeRatesData

type APIExchangeRatesData struct {
	Currency string
	// using map[string]float64 `json:",string"`
	// will result into ain unmarshalling error.
	// Using json.Number gets rid of strconv!
	Rates map[string]json.Number
}

Example Response:

{
  "data": {
    "currency": "BTC",
    "rates": {
      "AED": "36.73",
      "AFN": "589.50",
      "ALL": "1258.82",
      "AMD": "4769.49",
      "ANG": "17.88",
      "AOA": "1102.76",
      "ARS": "90.37",
      "AUD": "12.93",
      "AWG": "17.93",
      "AZN": "10.48",
      "BAM": "17.38",
      ...
    }
  }
}

type APIPagination

type APIPagination struct {
	Ending_before  string
	Starting_after string
	Limit          int
	Order          string
	Previous_uri   string
	Next_uri       string
}

Example Response:

"pagination": {
  "ending_before": null,
  "starting_after": null,
  "limit": 25,
  "order": "desc",
  "previous_uri": null,
  "next_uri": null
},

type APIPaymentMethod

type APIPaymentMethod struct {
	Data APIPaymentMethodsData
}

type APIPaymentMethods

type APIPaymentMethods struct {
	Pagination APIPagination
	Data       []APIPaymentMethodsData
}

type APIPaymentMethodsData

type APIPaymentMethodsData struct {
	ID             string
	Type           string
	Name           string
	Currency       string
	Primary_buy    bool
	Primary_sell   bool
	Allow_buy      bool
	Allow_sell     bool
	Allow_deposit  bool
	Allow_withdraw bool
	Instant_buy    bool
	Instant_sell   bool
	Created_at     string
	Updated_at     string
	Resource       string
	Resource_path  string
	Limits         APIPaymentMethodsLimits
}

Example Response:

{
  "id": "83562370-3e5c-51db-87da-752af5ab9559",
  "type": "ach_bank_account",
  "name": "International Bank *****1111",
  "currency": "USD",
  "primary_buy": true,
  "primary_sell": true,
  "allow_buy": true,
  "allow_sell": true,
  "allow_deposit": true,
  "allow_withdraw": true,
  "instant_buy": false,
  "instant_sell": false,
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-02-11T16:53:57-08:00",
  "resource": "payment_method",
  "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
}

type APIPaymentMethodsLimits

type APIPaymentMethodsLimits struct {
	Buy         []APIPaymentMethodsLimitsData
	Instant_buy []APIPaymentMethodsLimitsData
	Sell        []APIPaymentMethodsLimitsData
	Deposit     []APIPaymentMethodsLimitsData
}

type APIPaymentMethodsLimitsData

type APIPaymentMethodsLimitsData struct {
	Period_in_days int
	Total          APIBalance
	Remaining      APIBalance
}

Example Response:

{
  ...
  "limits": {
    "buy": [
      {
        "period_in_days": 1,
        "total": {
          "amount": "3000.00",
          "currency": "USD"
        },
        "remaining": {
          "amount": "3000.00",
          "currency": "USD"
        }
      }
    ],
    "instant_buy": [
      {
        "period_in_days": 7,
        "total": {
          "amount": "0.00",
          "currency": "USD"
        },
        "remaining": {
          "amount": "0.00",
          "currency": "USD"
        }
      }
    ],
    "sell": [
      {
        "period_in_days": 1,
        "total": {
          "amount": "3000.00",
          "currency": "USD"
        },
        "remaining": {
          "amount": "3000.00",
          "currency": "USD"
        }
      }
    ],
    "deposit": [
      {
        "period_in_days": 1,
        "total": {
          "amount": "3000.00",
          "currency": "USD"
        },
        "remaining": {
          "amount": "3000.00",
          "currency": "USD"
        }
      }
    ]
  },
}

type APIResource

type APIResource struct {
	Id            string
	Resource      string
	Resource_path string
}

Example Response:

"to": {
  "id": "a6b4c2df-a62c-5d68-822a-dd4e2102e703",
  "resource": "user",
  "resource_path": "/v2/users/a6b4c2df-a62c-5d68-822a-dd4e2102e703"
},

type APITime

type APITime struct {
	Data APITimeData
}

type APITimeData

type APITimeData struct {
	Iso   string
	Epoch int64
}

Example Response:

{
  "data": {
    "iso": "2015-06-23T18:02:51Z",
    "epoch": 1435082571
  }
}

type APITransaction

type APITransaction struct {
	Data APITransactionsData
}

type APITransactions

type APITransactions struct {
	Pagination APIPagination
	Data       []APITransactionsData
}

type APITransactionsData

type APITransactionsData struct {
	Id               string
	Type             string
	Status           string
	Amount           APIBalance
	Native_amount    APIBalance
	Description      string
	Created_at       string
	Updated_at       string
	Resource         string
	Resource_path    string
	Network          APITransactionsDataNetwork
	To               APIResource
	Buy              APIResource
	Instant_exchange bool
	Details          APITransactionsDataDetails
}

type APITransactionsDataDetails

type APITransactionsDataDetails struct {
	Title    string
	Subtitle string
}

Example Response:

{
  "id": "57ffb4ae-0c59-5430-bcd3-3f98f797a66c",
  "type": "send",
  "status": "completed",
  "amount": {
    "amount": "-0.00100000",
    "currency": "BTC"
  },
  "native_amount": {
    "amount": "-0.01",
    "currency": "USD"
  },
  "description": null,
  "created_at": "2015-03-11T13:13:35-07:00",
  "updated_at": "2015-03-26T15:55:43-07:00",
  "resource": "transaction",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/57ffb4ae-0c59-5430-bcd3-3f98f797a66c",
  "network": {
    "status": "off_blockchain",
    "name": "bitcoin"
  },
  "to": {
    "id": "a6b4c2df-a62c-5d68-822a-dd4e2102e703",
    "resource": "user",
    "resource_path": "/v2/users/a6b4c2df-a62c-5d68-822a-dd4e2102e703"
  },
  "instant_exchange": false,
  "details": {
    "title": "Sent bitcoin",
    "subtitle": "to User 2"
  }
}

type APITransactionsDataNetwork

type APITransactionsDataNetwork struct {
	Status string
	Name   string
}

type APITransactionsSend

type APITransactionsSend struct {
	Type     string
	To       string
	Amount   float64 `json:",string"`
	Currency string
}

type APIUser

type APIUser struct {
	Data APIUserData
}

type APIUserAuth

type APIUserAuth struct {
	Data APIUserAuthData
}

type APIUserAuthData

type APIUserAuthData struct {
	Method     string
	Scopes     []string
	Oauth_meta interface{}
}

Example Response:

{
  "data": {
    "method": "oauth",
    "scopes": [
        "wallet:user:read",
        "wallet:user:email"
    ],
    "oauth_meta": {}
  }
}

type APIUserCountry

type APIUserCountry struct {
	Code string
	Name string
}

Example Response:

{
  "id": "9da7a204-544e-5fd1-9a12-61176c5d4cd8",
  "name": "User One",
  "username": "user1",
  "profile_location": null,
  "profile_bio": null,
  "profile_url": "https://coinbase.com/user1",
  "avatar_url": "https://images.coinbase.com/avatar?h=vR%2FY8igBoPwuwGren5JMwvDNGpURAY%2F0nRIOgH%2FY2Qh%2BQ6nomR3qusA%2Bh6o2%0Af9rH&s=128",
  "resource": "user",
  "resource_path": "/v2/user"
}

wallet:user:read permission

{
  ...
  "time_zone": "Pacific Time (US & Canada)",
  "native_currency": "USD",
  "bitcoin_unit": "bits",
  "country": {
    "code": "US",
    "name": "United States"
  },
  "created_at": "2015-01-31T20:49:02Z"
}

wallet:user:email permission

{
  ...
  "email": "user1@example.com"
}

type APIUserData

type APIUserData struct {
	Id               string
	Name             string
	Username         string
	Profile_location string
	Profile_bio      string
	Profile_url      string
	Avatar_url       string
	Resource         string
	Resource_path    string
	// wallet:user:read permission
	Time_zone       string
	Native_currency string
	Bitcoin_unit    string
	Country         APIUserCountry
	Created_at      string
	// wallet:user:email permission
	Email string
}

type APIWalletTransfer

type APIWalletTransfer struct {
	Data APIWalletTransferData
}

type APIWalletTransferData

type APIWalletTransferData struct {
	Id             string
	Status         string
	Payment_method APIResource
	Transaction    APIResource
	Amount         APIBalance
	Total          APIBalance
	Subtotal       APIBalance
	Created_at     string
	Updated_at     string
	Resource       string
	Resource_path  string
	Committed      bool
	Instant        bool
	Fee            APIBalance
	Payout_at      string
}

Example Response:

{
  "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
  "status": "completed",
  "payment_method": {
    "id": "83562370-3e5c-51db-87da-752af5ab9559",
    "resource": "payment_method",
    "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
  },
  "transaction": {
    "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
    "resource": "transaction",
    "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
  },
  "amount": {
    "amount": "1.00000000",
    "currency": "BTC"
  },
  "total": {
    "amount": "10.25",
    "currency": "USD"
  },
  "subtotal": {
    "amount": "10.10",
    "currency": "USD"
  },
  "created_at": "2015-01-31T20:49:02Z",
  "updated_at": "2015-02-11T16:54:02-08:00",
  "resource": "buy",
  "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/buys/67e0eaec-07d7-54c4-a72c-2e92826897df",
  "committed": true,
  "instant": false,
  "fee": {
    "amount": "0.15",
    "currency": "USD"
  },
  "payout_at": "2015-02-18T16:54:00-08:00"
}

type APIWalletTransferList

type APIWalletTransferList struct {
	Pagination APIPagination
	Data       []APIWalletTransferData
}

type APIWalletTransferOrder

type APIWalletTransferOrder struct {
	Amount                  float64 `json:",string"`
	Total                   float64 `json:",string"`
	Currency                string
	Payment_method          string
	Agree_btc_amount_varies bool
	Commit                  bool
	Quote                   bool
}

Example request:

{
  "amount": "10",
  "currency": "BTC",
  "payment_method": "83562370-3e5c-51db-87da-752af5ab9559"
}

type AccountId

type AccountId string

AccountId is a unique ID for your wallet

Example:

2bbf394c-193b-5b2a-9155-3b4732659ede

type BuyId

type BuyId string

Example:

2bbf394c-193b-5b2a-9155-3b4732659ede

type ConfigPrice

type ConfigPrice struct {
	From string
	To   string
	Date time.Time
}

type DepositId

type DepositId string

Example:

2bbf394c-193b-5b2a-9155-3b4732659ede

type PaymentMethodId

type PaymentMethodId string

Example:

83562370-3e5c-51db-87da-752af5ab9559

type SellId

type SellId string

Example:

2bbf394c-193b-5b2a-9155-3b4732659ede

type WithdrawalId

type WithdrawalId string

Example:

2bbf394c-193b-5b2a-9155-3b4732659ede

Jump to

Keyboard shortcuts

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