psedata

package module
v0.0.0-...-ea96674 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2015 License: MIT Imports: 4 Imported by: 0

README

PSE Data Db Tool

This is a tool for storing Philippine Stock Exchange data to a PostgreSQL db.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionInfo

type ConnectionInfo struct {
	DbName   string
	User     string
	Password string
	Host     string
	Port     int
}

ConnectionInfo represents a database connection information and credentials.

func (ConnectionInfo) ConnectString

func (info ConnectionInfo) ConnectString() string

ConnectString returns a connecction string to be used with sqlx.Open()

func (ConnectionInfo) ConnectStringTemplateDb

func (info ConnectionInfo) ConnectStringTemplateDb() string

ConnectStringTemplateDb returns a connection string to be used with sqlx.Open() that connects to tmeplate1 db which is a default db. Useful for creating databases, or inspecting a db when you're not sure if it exists.

type DailyRecord

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

func NewDailyRecord

func NewDailyRecord(symbol string, date time.Time, open float64, high float64, low float64, close float64, vol int) DailyRecord

NewDailyRecord creates a new DailyRecord from parameters

func NewDailyRecordS

func NewDailyRecordS(d dRow) DailyRecord

func (*DailyRecord) Close

func (data *DailyRecord) Close() float64

Close returns the closing price for that date

func (*DailyRecord) Date

func (data *DailyRecord) Date() time.Time

Date returns the date for the data row

func (*DailyRecord) High

func (data *DailyRecord) High() float64

High returns the highest price for that date

func (*DailyRecord) Low

func (data *DailyRecord) Low() float64

Low returns the lowest price for that date

func (*DailyRecord) Open

func (data *DailyRecord) Open() float64

Open returns the opening price for that date

func (*DailyRecord) String

func (data *DailyRecord) String() string

String returns a string representation of the DailyRecord

func (*DailyRecord) Symbol

func (data *DailyRecord) Symbol() string

Symbol returns the symbol for the data row

func (*DailyRecord) Volume

func (data *DailyRecord) Volume() int

Volume returns the trading volume for that date

type DailyRecords

type DailyRecords interface {
	Next() (*DailyRecord, error)
}

type PseDb

type PseDb interface {
	DbStore() *sqlx.DB
	Close() error
	NewData(DailyRecord) error
	DailyRecordFor(string, time.Time) (DailyRecord, error)
	AllDailyRecordFor(string) ([]DailyRecord, error)
	ImportDaylies(DailyRecords) error
}

The PseDb interface for CRUD operations and useful shortcuts for retrieving day trades data.

func CreateDb

func CreateDb(info ConnectionInfo) (PseDb, error)

CreateDb creates the underlying PostGreSQL datastore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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