Documentation ¶
Index ¶
- Constants
- func ConnectDb()
- func DisconnectDb()
- func RemoveFile(fileName string)
- func ResetDb(root, rootPasswd string)
- func SetMongo(dbHost, dbName, dbAccount, dbPassword string)
- type PriceDAO
- type PriceDownloader
- type PriceService
- func (service *PriceService) GetDownloader(csvRoot string) *PriceDownloader
- func (service *PriceService) GetLatestDate() string
- func (service *PriceService) GetPriceByCodeDate(dateStr, code string) *StockPrice
- func (service *PriceService) GetPricesByCode(code, fromDate, toDate string, oldToNew bool) []*StockPrice
- func (service *PriceService) GetPricesByDate(dateStr string) []*StockPrice
- type StockPrice
Constants ¶
View Source
const (
STOCK_PRICE_COL = "stock_price"
)
Variables ¶
This section is empty.
Functions ¶
func RemoveFile ¶
func RemoveFile(fileName string)
Types ¶
type PriceDownloader ¶
type PriceDownloader struct {
// contains filtered or unexported fields
}
func (*PriceDownloader) DownloadStockPrice ¶
func (service *PriceDownloader) DownloadStockPrice(dateStr string) (bool, bool)
type PriceService ¶
type PriceService struct {
// contains filtered or unexported fields
}
func (*PriceService) GetDownloader ¶
func (service *PriceService) GetDownloader(csvRoot string) *PriceDownloader
Get A Downloader Instance to download stock price CSV File
func (*PriceService) GetLatestDate ¶
func (service *PriceService) GetLatestDate() string
Get latest stock price record date in mongodb
func (*PriceService) GetPriceByCodeDate ¶
func (service *PriceService) GetPriceByCodeDate(dateStr, code string) *StockPrice
func (*PriceService) GetPricesByCode ¶
func (service *PriceService) GetPricesByCode(code, fromDate, toDate string, oldToNew bool) []*StockPrice
func (*PriceService) GetPricesByDate ¶
func (service *PriceService) GetPricesByDate(dateStr string) []*StockPrice
type StockPrice ¶
type StockPrice struct { DateStr string `json:"dateStr" bson:"dateStr"` Code string `json:"code" bson:"code"` //stock code Name string `json:"name" bson:"name"` Qty int `json:"qty" bson:"qty"` //成交股數 Qty2 int `json:"qty2" bson:"qty2"` //成交筆數 Total int64 `json:"total" bson:"total"` //成交金額 StartPrice float64 `json:"startPrice" bson:"startPrice"` HighPrice float64 `json:"highPrice" bson:"highPrice"` LowPrice float64 `json:"lowPrice" bson:"lowPrice"` EndPrice float64 `json:"endPrice" bson:"endPrice"` UpDown string `json:"upDown" bson:"upDown"` //漲跌(”平, '+'漲, '-'跌, 'X'除權息) Step float64 `json:"step" bson:"step"` //漲跌價差 LastBuyPrice float64 `json:"lastBuyPrice" bson:"lastBuyPrice"` LastBuyQty int `json:"lastBuyQty" bson:"lastBuyQty"` LastSellPrice float64 `json:"lastSellPrice" bson:"lastSellPrice"` LastSellQty int `json:"lastSellQty" bson:"lastSellQty"` PeRatio float64 `json:"peRatio" bson:"peRatio"` //本益比 }
StockPrice StockPrice
Source Files ¶
Click to show internal directories.
Click to hide internal directories.