service

package
v0.0.0-...-6c4cad4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Future     dividendType = "future_divs"
	Historical              = "historical_divs"
)
View Source
const UpdatePriceConcurrency = 10

Variables

This section is empty.

Functions

func NewGoogleStockPriceAtDate

func NewGoogleStockPriceAtDate(ctx context.Context) *googleStockPriceAtDate

func NewMarketChameleonStockPriceVolatility

func NewMarketChameleonStockPriceVolatility(ctx context.Context, url string) *marketChameleonStockPriceVolatility

func NewStockDividendMarketChameleon

func NewStockDividendMarketChameleon(ctx context.Context, urlBuilder UrlBuilder, htmlParser HtmlParser) *stockDividendMarketChameleon

---------------------------------------------------------------------------------------------------------------------- stockDividendMarketChameleon Service ----------------------------------------------------------------------------------------------------------------------

func NewStockPriceAtDate

func NewStockPriceAtDate(ctx context.Context) *yahooStockPriceAtDate

func NewStockSummaryMarketChameleon

func NewStockSummaryMarketChameleon(ctx context.Context, url string) *stockSummaryMarketChameleon

func NewStockSummaryYahoo

func NewStockSummaryYahoo(ctx context.Context, url string) *stockSummaryYahoo

func NewYahooScrapeStockPrice

func NewYahooScrapeStockPrice(ctx context.Context, url string) *yahooScraperStockPrice

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccountService

func NewAccountService(
	walletFinder wallet.Finder,
	walletPersister wallet.Persister,
	stockFinder stock.Finder,
	ccClient *cc.Client,
	stockDividendFinder dividend.Finder,
) *Account

func (*Account) BuyStocksWallet

func (s *Account) BuyStocksWallet(
	w *wallet.Wallet,
	stksSymbol map[string]int,
	pChangeCommissions map[string]mm.Value,
	commissions map[string]AppCommissions,
) error

func (*Account) FindWalletByName

func (s *Account) FindWalletByName(name string) (*wallet.Wallet, error)

func (*Account) LoadActiveWalletItems

func (s *Account) LoadActiveWalletItems(w *wallet.Wallet) error

func (*Account) LoadWalletItem

func (s *Account) LoadWalletItem(w *wallet.Wallet, stkSymbol string) error

func (*Account) SaveAllOperations

func (s *Account) SaveAllOperations(w *wallet.Wallet) error

func (*Account) SaveAllWallets

func (s *Account) SaveAllWallets(ws []*wallet.Wallet) error

func (*Account) SellStocksWallet

func (s *Account) SellStocksWallet(
	w *wallet.Wallet,
	stksSymbol map[string]int,
	pChangeCommissions map[string]mm.Value,
	commissions map[string]AppCommissions,
) error

func (*Account) UpdateWalletsAccountingByTransfers

func (s *Account) UpdateWalletsAccountingByTransfers(ts []*transfer.Transfer) error

func (*Account) UpdateWalletsCapitalByStock

func (s *Account) UpdateWalletsCapitalByStock(stk *stock.Stock) error

func (*Account) UpdateWalletsCapitalByStocks

func (s *Account) UpdateWalletsCapitalByStocks(stks []*stock.Stock) error

type AppCommissions

type AppCommissions struct {
	Commission struct {
		Base struct {
			Amount   float64
			Currency string
		}
		Extra struct {
			Amount   float64
			Currency string
			Apply    string
		}
		Maximum struct {
			Amount   float64
			Currency string
		}
	}
	ChangeCommission struct {
		Amount   float64
		Currency string
	}
}

type Banking

type Banking struct {
	// contains filtered or unexported fields
}

func NewBankingService

func NewBankingService(bankAccountFinder bank.Finder, transferPersister transfer.Persister, accountService *Account) *Banking

func (*Banking) FindBankAccountByAlias

func (s *Banking) FindBankAccountByAlias(alias string) (*bank.Account, error)

func (*Banking) SaveAllTransfers

func (s *Banking) SaveAllTransfers(ts []*transfer.Transfer) error

type HtmlParser

type HtmlParser interface {
	Parse(url string) (*html.Node, error)
}

---------------------------------------------------------------------------------------------------------------------- HtmlParser ----------------------------------------------------------------------------------------------------------------------

func NewStockDividendMarketChameleonChromedpParser

func NewStockDividendMarketChameleonChromedpParser(ctx context.Context, cdp *chromedp.CDP) HtmlParser

func NewStockDividendMarketChameleonFileHtmlParser

func NewStockDividendMarketChameleonFileHtmlParser(ctx context.Context) HtmlParser

func NewStockDividendMarketChameleonWWWHtmlParser

func NewStockDividendMarketChameleonWWWHtmlParser(ctx context.Context) HtmlParser

---------------------------------------------------------------------------------------------------------------------- HtmlParser ----------------------------------------------------------------------------------------------------------------------

type Purchase

type Purchase struct {
	// contains filtered or unexported fields
}

func NewPurchaseService

func NewPurchaseService(
	ctx context.Context,
	stockPersister stock.Persister,
	stockFinder stock.Finder,
	stockDividendPersister dividend.Persister,
	stockDividendFinder dividend.Finder,
	marketFinder market.Finder,
	exchangeFinder exchange.Finder,
	accountService *Account,
	iexClient *iex.Client,
	stockInfoFinder stock.InfoFinder,
	stockInfoPersister stock.InfoPersister,
) *Purchase

func (*Purchase) FindExchangeBySymbol

func (s *Purchase) FindExchangeBySymbol(symbol string) (*exchange.Exchange, error)

func (*Purchase) FindMarketByName

func (s *Purchase) FindMarketByName(name string) (*market.Market, error)

func (*Purchase) FindStockByName

func (s *Purchase) FindStockByName(name string) (*stock.Stock, error)

func (*Purchase) FindStockBySymbol

func (s *Purchase) FindStockBySymbol(symbol string) (*stock.Stock, error)

func (*Purchase) FindStockInfoByValue

func (s *Purchase) FindStockInfoByValue(symbol string) (*stock.Info, error)

func (*Purchase) SaveAllStocks

func (s *Purchase) SaveAllStocks(stks []*stock.Stock) error

func (*Purchase) SaveStockInfo

func (s *Purchase) SaveStockInfo(stkInfo *stock.Info) error

func (*Purchase) Stocks

func (s *Purchase) Stocks() ([]*stock.Stock, error)

func (*Purchase) StocksByDividendAnnounceProjectYearAndMonth

func (s *Purchase) StocksByDividendAnnounceProjectYearAndMonth(year, month string) ([]*stock.Stock, error)

func (*Purchase) StocksByExchanges

func (s *Purchase) StocksByExchanges(exchanges []string) ([]*stock.Stock, error)

func (*Purchase) Update52WeekHighLowPriceStock

func (s *Purchase) Update52WeekHighLowPriceStock(stk *stock.Stock) error

func (*Purchase) Update52WeekHighLowPriceStocks

func (s *Purchase) Update52WeekHighLowPriceStocks(stks []*stock.Stock) []error

Update52WeekClosedPriceStocks update the stocks 52 week with the high - low price

func (*Purchase) UpdateLastClosedPriceStock

func (s *Purchase) UpdateLastClosedPriceStock(stk *stock.Stock) error

func (*Purchase) UpdateLastClosedPriceStocks

func (s *Purchase) UpdateLastClosedPriceStocks(stks []*stock.Stock) []error

UpdateLastClosedPriceStocks update the stocks with the last close date price

func (*Purchase) UpdateStockDividends

func (s *Purchase) UpdateStockDividends(stk *stock.Stock) error

type StockDividend

type StockDividend interface {
	NextFuture(stk *stock.Stock) (dividend.StockDividend, error)
	Future(stk *stock.Stock) ([]dividend.StockDividend, error)
	Historical(stk *stock.Stock, fromDate time.Time) ([]dividend.StockDividend, error)
}

type StockPrice

type StockPrice interface {
	Price(stk *stock.Stock) (stock.Price, error)
}

type StockPriceAtDate

type StockPriceAtDate interface {
	Price(stk *stock.Stock, date time.Time) (stock.Price, error)
}

type StockPriceVolatility

type StockPriceVolatility interface {
	PriceVolatility(stk *stock.Stock) (stock.PriceVolatility, error)
}

type StockSummary

type StockSummary interface {
	Summary(stk *stock.Stock) (stock.Summary, error)
}

type UrlBuilder

type UrlBuilder interface {
	BuildUrl(stk *stock.Stock) (string, error)
}

---------------------------------------------------------------------------------------------------------------------- UrlBuilder ----------------------------------------------------------------------------------------------------------------------

func NewStockScrapeMarketChameleonFileUrlBuilder

func NewStockScrapeMarketChameleonFileUrlBuilder(ctx context.Context, url string) UrlBuilder

---------------------------------------------------------------------------------------------------------------------- File ----------------------------------------------------------------------------------------------------------------------

func NewStockScrapeMarketChameleonWWWUrlBuilder

func NewStockScrapeMarketChameleonWWWUrlBuilder(ctx context.Context, url string) UrlBuilder

---------------------------------------------------------------------------------------------------------------------- UrlBuilder ---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------- WWW ----------------------------------------------------------------------------------------------------------------------

Jump to

Keyboard shortcuts

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