Documentation ¶
Index ¶
- Constants
- type Account
- type AccountActivity
- type AccountService
- type Accounts
- type Balance
- type Broker
- type BrokerImpl
- type BrokerService
- type Buys
- type Client
- type Data
- type Dispatcher
- type Environment
- type GenericAccount
- type GenericBuy
- type GenericSell
- type Message
- type Pagination
- type Req
- type Sells
- type Sig
- type Signer
- type Task
- type WorkerPool
Constants ¶
View Source
const ( GET_ACCOUNTS_PATH = "/v2/accounts" BASE_URL = "https://api.coinbase.com" )
View Source
const ( BUY int = 0 SELL int = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountActivity ¶
type AccountActivity struct { //Transactions []GenericTransaction Wallet GenericAccount ActiveWallet bool BuyOrders []GenericBuy Type int SellOrders []GenericSell }
type AccountService ¶
type AccountService struct { }
type Accounts ¶
type Accounts struct { Pagination Pagination `json:"pagination"` Data []Data `json:"data"` }
type Broker ¶
type Broker interface { GetAccounts() ([]GenericAccount, error) GetAccountActivity(ctx context.Context, acc []GenericAccount) (t []AccountActivity) GetTransactions(nextUrl string) }
type BrokerImpl ¶
type BrokerImpl struct {
AccountService Account
}
func (*BrokerImpl) GetAccountActivity ¶
func (b *BrokerImpl) GetAccountActivity(ctx context.Context, acc []GenericAccount) (t []AccountActivity)
func (*BrokerImpl) GetAccounts ¶
func (b *BrokerImpl) GetAccounts() (uAcc []GenericAccount, err error)
type BrokerService ¶
type BrokerService struct {
Client Broker
}
func NewBrokerService ¶
func NewBrokerService(apiKey, apiSecret string) *BrokerService
type Buys ¶
type Buys struct { Pagination struct { EndingBefore interface{} `json:"ending_before"` StartingAfter interface{} `json:"starting_after"` Limit int `json:"limit"` Order string `json:"order"` PreviousURI interface{} `json:"previous_uri"` NextURI interface{} `json:"next_uri"` } `json:"pagination"` Data []struct { ID string `json:"id"` Status string `json:"status"` PaymentMethod struct { ID string `json:"id"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` } `json:"payment_method"` Transaction struct { ID string `json:"id"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` } `json:"transaction"` Amount struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"amount"` Total struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"total"` Subtotal struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"subtotal"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` Committed bool `json:"committed"` Instant bool `json:"instant"` Fee struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"fee"` PayoutAt string `json:"payout_at"` } `json:"data"` }
type Client ¶
type Client struct { Signer Signer Sender Dispatcher }
type Data ¶
type Data struct { ID string `json:"id"` Name string `json:"name"` Primary bool `json:"primary"` Type string `json:"type"` Currency string `json:"currency"` Balance Balance `json:"balance"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` Ready bool `json:"ready,omitempty"` }
type Dispatcher ¶
type Environment ¶
type GenericAccount ¶
type GenericBuy ¶
type GenericSell ¶
type Pagination ¶
type Sells ¶
type Sells struct { Pagination struct { EndingBefore interface{} `json:"ending_before"` StartingAfter interface{} `json:"starting_after"` Limit int `json:"limit"` Order string `json:"order"` PreviousURI interface{} `json:"previous_uri"` NextURI interface{} `json:"next_uri"` } `json:"pagination"` Data []struct { ID string `json:"id"` Status string `json:"status"` PaymentMethod struct { ID string `json:"id"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` } `json:"payment_method"` Transaction struct { ID string `json:"id"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` } `json:"transaction"` Amount struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"amount"` Total struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"total"` Subtotal struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"subtotal"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Resource string `json:"resource"` ResourcePath string `json:"resource_path"` Committed bool `json:"committed"` Instant bool `json:"instant"` Fee struct { Amount string `json:"amount"` Currency string `json:"currency"` } `json:"fee"` PayoutAt string `json:"payout_at"` } `json:"data"` }
type Sig ¶
type Sig string
func (Sig) GenerateHMAC ¶
Hash-based message authentication code
func (Sig) GenerateSignature ¶
type Task ¶
type Task struct { Err error ExecFn func(ctx context.Context, acc GenericAccount) (AccountActivity, error) Account GenericAccount }
func NewTask ¶
func NewTask(f func(ctx context.Context, acc GenericAccount) (AccountActivity, error), account GenericAccount) *Task
func (*Task) Run ¶
func (t *Task) Run(ctx context.Context, acc GenericAccount) (AccountActivity, error)
type WorkerPool ¶
type WorkerPool struct { Done chan struct{} // contains filtered or unexported fields }
func NewWorkerPool ¶
func NewWorkerPool(concurrency int) WorkerPool
func (WorkerPool) GenerateFrom ¶
func (wp WorkerPool) GenerateFrom(tasks []*Task)
func (WorkerPool) ResultSet ¶
func (wp WorkerPool) ResultSet() <-chan AccountActivity
func (*WorkerPool) Run ¶
func (wp *WorkerPool) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.