account

package
v0.0.0-...-c17c338 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(h *Holdings) error

Process processes new account holdings updates

func SubscribeToExchangeAccount

func SubscribeToExchangeAccount(exchange string) (dispatch.Pipe, error)

SubscribeToExchangeAccount subcribes to your exchange account

Types

type Account

type Account struct {
	ID uuid.UUID
	// contains filtered or unexported fields
}

Account holds a stream ID and a pointer to the exchange holdings

type Balance

type Balance struct {
	CurrencyName currency.Code
	TotalValue   float64
	Hold         float64
}

Balance is a sub type to store currency name and individual totals

func (Balance) Available

func (b Balance) Available() float64

Available returns the amount you can use immediately. E.g. if you have $100, but $20 are held (locked) because of a limit buy order, your available balance is $80.

type Change

type Change struct {
	Exchange string
	Currency currency.Code
	Asset    asset.Item
	Amount   float64
	Account  string
}

Change defines incoming balance change on currency holdings

type Holdings

type Holdings struct {
	Exchange string
	Accounts []SubAccount
}

Holdings is a generic type to hold each exchange's holdings for all enabled currencies

func GetHoldings

func GetHoldings(exch string, assetType asset.Item) (Holdings, error)

GetHoldings returns full holdings for an exchange

type Service

type Service struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Service holds ticker information for each individual exchange

func (*Service) Update

func (s *Service) Update(a *Holdings) error

Update updates holdings with new account info

type SubAccount

type SubAccount struct {
	ID         string
	AssetType  asset.Item
	Currencies []Balance
}

SubAccount defines a singular account type with asocciated currency balances

Jump to

Keyboard shortcuts

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