Documentation ¶
Overview ¶
Package postgresql Some PostgreSQL using functions
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql Some PostgreSQL using functions ¶
Package postgresql - Some PostgreSQL using functions ¶
Package postgresql - Some PostgreSQL using functions
Index ¶
- func AddEmptyPortfolio(name string)
- func AddPortfolio(name string, tr, pr float64)
- func AddSymbol(symbol, name, wkn, isin, sector, lookType, quoteCurrency string)
- func AddSymbolWithWarrant(symbol, name, wkn, isin, lookType, quoteCurrency, basesym, optionend string)
- func AddWatchlist(name string)
- func CloseConnection()
- func FindAllLookupRows(whereClause string) pgx.Rows
- func FindAllTradeRows(whereClause string) pgx.Rows
- func FindAllTransRows(whereClause string) pgx.Rows
- func FindLookup(symbol string) pgx.Rows
- func FindTrade(portID int64) pgx.Rows
- func GetAllCountries() (countries []string)
- func GetAllIsoCodes() (fields []string)
- func GetClose(quotes []Quote) (closeVal []float64)
- func GetCurrencyXSymbol(src, dest string) (symbol string)
- func GetLastQuoteDate(symbol string) (tmpDate string)
- func GetRiskValuesForCountry(country string) (MRP, RFR float64)
- func NewDBConnection(user, host, password, port, dbname, appName, sslMode string) (err error)
- func UpdateQuoteLoop(allLookup []Lookup)
- func UpsertQuotes(secu string, quotes []Quote)
- type CurrSymbCross
- type Currencies
- type Lookup
- func FindAllCurrentLookup() []Lookup
- func FindAllCurrentLookupOrdered(column, direction string) []Lookup
- func FindAllHistoricLookup() []Lookup
- func FindAllHistoricLookupOrdered(column, direction string) []Lookup
- func FindAllLookup() []Lookup
- func FindAllLookupOrdered(column, direction string) []Lookup
- func GetNextLookupRow(rows pgx.Rows) Lookup
- func GetSingleIsinLookup(isin string) Lookup
- func GetSingleLookup(symbol string) Lookup
- func NewLookup() Lookup
- type Portfolio
- type Quote
- func FindQuotes(symbol, order string) (tmpQuote []Quote)
- func GetLastQuote(symbol string) (quote Quote)
- func GetPeriodQuotes(security, period string) (quotes []Quote)
- func MonthlyQuotes(values []Quote) []Quote
- func NewQuote() Quote
- func UpdateAriva(symbol string) (outLookup []Quote)
- func UpdateStooq(symbol string) (outArr []Quote)
- func UpdateSwisscanto(symbol string) (outArr []Quote)
- func UpdateYahoo(symbol string) (outArr []Quote)
- func WeeklyQuotes(values []Quote) []Quote
- func YearlyQuotes(values []Quote) []Quote
- type Risk
- type Trade
- type Transaction
- type Warrant
- type Watchlist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEmptyPortfolio ¶ added in v0.0.3
func AddEmptyPortfolio(name string)
AddEmptyPortfolio will add a new, empty portfolio
func AddPortfolio ¶
AddPortfolio will add a new portfolio with given values
func AddSymbol ¶ added in v0.0.9
func AddSymbol(symbol, name, wkn, isin, sector, lookType, quoteCurrency string)
AddSymbol will add a new symbol. If it already exists, nothing is done.
func AddSymbolWithWarrant ¶ added in v0.0.9
func AddSymbolWithWarrant(symbol, name, wkn, isin, lookType, quoteCurrency, basesym, optionend string)
AddSymbolWithWarrant will add a new symbol for a warrant. If it already exists, nothing is done. The warrant information is also added to its table.
func AddWatchlist ¶ added in v0.0.9
func AddWatchlist(name string)
AddWatchlist will add a new watchlist. If it already exists, nothing is done.
func FindAllLookupRows ¶
func FindAllLookupRows(whereClause string) pgx.Rows
FindAllLookupRows finds all lookup values.
func FindAllTradeRows ¶
func FindAllTradeRows(whereClause string) pgx.Rows
FindAllTradeRows finds all trade values.
func FindAllTransRows ¶ added in v0.0.9
func FindAllTransRows(whereClause string) pgx.Rows
FindAllTransRows finds all transaction values.
func FindLookup ¶
func FindLookup(symbol string) pgx.Rows
FindLookup finds the row in the lookup table for a given symbol.
func FindTrade ¶
func FindTrade(portID int64) pgx.Rows
FindTrade finds the row in the trades table for a given portfolio id.
func GetAllCountries ¶ added in v0.0.13
func GetAllCountries() (countries []string)
GetAllCountries returns all known countries with risk values.
func GetAllIsoCodes ¶ added in v0.0.13
func GetAllIsoCodes() (fields []string)
GetAllIsoCodes returns all iso codes.
func GetCurrencyXSymbol ¶ added in v0.0.13
GetCurrencyXSymbol returns symbol for given currency pair.
func GetLastQuoteDate ¶
GetLastQuoteDate returns the last quote date for given symbol
func GetRiskValuesForCountry ¶ added in v0.0.13
GetRiskValuesForCountry returns risk values for given country.
func NewDBConnection ¶
NewDBConnection Creates the database handler and checks the connection. allowed sslmode values are: disable, allow, prefer, require, verify-ca and verify-full
func UpdateQuoteLoop ¶ added in v0.0.4
func UpdateQuoteLoop(allLookup []Lookup)
func UpsertQuotes ¶
UpsertQuotes inserts given quotes values into the database or updates open, high, low, close and volume if we already have a row
Types ¶
type CurrSymbCross ¶ added in v0.0.13
CurrSymbCross contains the structure of a curr_symb_cross row
func NewCurrSymbCross ¶ added in v0.0.13
func NewCurrSymbCross() CurrSymbCross
NewCurrSymbCross returns an empty curr_symb_cross row
type Currencies ¶ added in v0.0.9
Currencies contains the structure of a currencies sentence
func GetAllCurrencies ¶ added in v0.0.9
func GetAllCurrencies() (curArr []Currencies)
GetAllCurrencies gets all existing currencies
func GetCurrencySymbol ¶ added in v0.0.9
func GetCurrencySymbol(iso string) (currencies Currencies)
GetCurrencySymbol gets the symbol for given ISO code If ISO code is not found an empty currency value is returned
func GetNextCurrencyRow ¶ added in v0.0.9
func GetNextCurrencyRow(rows pgx.Rows) (currencies Currencies)
GetNextCurrencyRow returns the next currency row.
func NewCurrency ¶ added in v0.0.9
func NewCurrency() Currencies
NewCurrency returns an empty currency row
type Lookup ¶
type Lookup struct { Symbol string Name string WKN string ISIN string LookType string QuoteCurrency string IsHistory bool }
Lookup contains the structure of a lookup sentence
func FindAllCurrentLookup ¶
func FindAllCurrentLookup() []Lookup
FindAllCurrentLookup finds all lookup values which are not test indices and not historic.
func FindAllCurrentLookupOrdered ¶ added in v0.0.9
FindAllCurrentLookupOrdered finds all lookup values which are not test indices and not historic ordered by column and direction.
func FindAllHistoricLookup ¶ added in v0.0.9
func FindAllHistoricLookup() []Lookup
FindAllHistoricLookup finds all lookup values which are not test indices and not historic.
func FindAllHistoricLookupOrdered ¶ added in v0.0.9
FindAllHistoricLookupOrdered finds all lookup values which are not test indices and is historic ordered by column and direction.
func FindAllLookupOrdered ¶ added in v0.0.9
FindAllLookupOrdered finds all lookup values ordered by column and direction.
func GetNextLookupRow ¶
func GetNextLookupRow(rows pgx.Rows) Lookup
GetNextLookupRow returns the next lookup row.
func GetSingleIsinLookup ¶
GetSingleIsinLookup gets one row in the lookup table for a given ISIN. If ISIN is not found an empty lookup value is returned
func GetSingleLookup ¶
GetSingleLookup gets one row in the lookup table for a given symbol.
type Portfolio ¶
type Portfolio struct { PortfolioID uint64 // portfolio_id Name string // name TradeRisk float64 // trade_risk PortRisk float64 // port_risk }
Portfolio is the structure of a portfolio.
func FindAllPortfolios ¶ added in v0.0.4
FindAllPortfolios returns all portfolios in the portfolio table.
func FindSpecificPortfolio ¶
FindSpecificPortfolio returns portofilo with given name and error status
func GetNextPortfolioRow ¶
GetNextPortfolioRow returns the next portfolio row.
type Quote ¶
type Quote struct { Symbol string // symbol QuoteDate time.Time // quote_date Open float64 // open High float64 // high Low float64 // low Close float64 // close Volume int64 // volume }
Quote is the structure of a quote.
func FindQuotes ¶
FindQuotes selects all rows in the quotes table for a given symbol, sorted by quote_date and given sort order.
func GetLastQuote ¶
GetLastQuote returns the last quote for given symbol
func GetPeriodQuotes ¶ added in v0.0.11
func MonthlyQuotes ¶
MonthlyQuotes analyzes all the given daily values and returns the monthly values accordingly The highest and lowest prices in the monthly trading sessions become the high and low for the monthly marker The open of the first day becomes the open of the month The close of the last day becomes the close of the month
func UpdateAriva ¶
UpdateAriva reads values from ariva.de and returns a slice of quotes symbol should be in the format "ariva::<secu>.<boerse_id>"
func UpdateStooq ¶ added in v0.0.13
UpdateStooq reads values from stooq.com and returns a slice of quotes symbol should be in the format "stooq::<symbol>"
func UpdateSwisscanto ¶
UpdateSwisscanto reads values from cash.ch or www.swissfunddata.ch and returns a slice of quotes symbol should be in the format "swisscanto::<fundid>"
func UpdateYahoo ¶ added in v0.0.13
UpdateYahoo reads values from query1.finance.yahoo.com and returns a slice of quotes symbol should be in the format "yahoo::<symbol>"
func WeeklyQuotes ¶
WeeklyQuotes analyzes all the given daily values and returns the weekly values accordingly The highest and lowest prices in the five weekly trading sessions become the high and low for the weekly marker The open of the first day becomes the open of the week The close of the last day becomes the close of the week
func YearlyQuotes ¶
YearlyQuotes analyzes all the given daily values and returns the yearly values accordingly The highest and lowest prices in the yearly trading sessions become the high and low for the yearly marker The open of the first day becomes the open of the year The close of the last day becomes the close of the year
type Risk ¶ added in v0.0.13
Risk contains the structure of a risk row
func GetAllRisks ¶ added in v0.0.13
func GetAllRisks() (riskArr []Risk)
GetAllRisk gets all existing risk values
func GetNextRiskRow ¶ added in v0.0.13
func GetNextRiskRow(rows pgx.Rows) (risk Risk)
GetNextRiskRow returns the next risk row.
type Trade ¶
type Trade struct { TradeID uint64 PortfolioID uint64 Symbol string Comment string CheckLevelValue float64 StopLossType string StopLossValue float64 }
Trade contains the structure of a trades sentence
func FindAllTrades ¶
FindAllTrades finds all trade values.
func FindPortfolioTrades ¶
FindPortfolioTrades finds all trades for given portfolio_id.
func GetNextTradeRow ¶
GetNextTradeRow returns the next trade row.
type Transaction ¶ added in v0.0.9
type Transaction struct { TransactionID uint64 TradeID uint64 PortfolioID uint64 Symbol string TransDate time.Time Action string Price float64 Quantity float64 Brokerage float64 Slippage float64 }
Transaction contains the structure of a transaction row
func FindPortTradeTransactions ¶ added in v0.0.9
func FindPortTradeTransactions(portID, tradeID uint64) (tmpTrans []Transaction, err error)
FindPortTradeTransactions finds all Transactions for given portfolio_id and trade_id
func GetNextTransRow ¶ added in v0.0.9
func GetNextTransRow(rows pgx.Rows) (trans Transaction, err error)
GetNextTransRow returns the next transaction row.
func NewTransaction ¶ added in v0.0.9
func NewTransaction() Transaction
NewTransaction returns an empty transaction
type Warrant ¶ added in v0.0.9
Warrant is the structure of a warrant.
func FindSpecificWarrant ¶ added in v0.0.9
FindSpecificWarrant returns warrant with given symbol
func GetNextWarrantRow ¶ added in v0.0.9
GetNextWarrantRow returns the next warrant row.
type Watchlist ¶ added in v0.0.9
Watchlist is the structure of a watchlist.
func FindAllWatchlists ¶ added in v0.0.9
FindAllWatchlists returns all watchlists.
func GetNextWatchlistRow ¶ added in v0.0.9
GetNextWatchlistRow returns the next watchlist row.