structs

package
v0.0.0-...-5a29284 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KOSPI market
	KOSPI = "kospi"
	// KOSDAQ market
	KOSDAQ = "kosdaq"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Invitation

type Invitation struct {
	Guestname string
	PublicKey string `db:",size:1000"`
}

Invitation is a struct for describing invitation

func NewInvitation

func NewInvitation(guestname string, publicKey *rsa.PublicKey) Invitation

NewInvitation returns a new Invitation struct

func (Invitation) GetDBRegisterForm

func (iv Invitation) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

func (Invitation) GetPublicKey

func (iv Invitation) GetPublicKey() rsa.PublicKey

GetPublicKey provides a convenience to parse jsonified rsa.PublicKey struct

type Market

type Market string

Market is an enum type representing the type of the stock market

type Stock

type Stock struct {
	Name       string
	StockID    string
	MarketType Market
}

Stock is a struct describing each stock item

func (Stock) GetDBRegisterForm

func (s Stock) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

type StockPrice

type StockPrice struct {
	StockID   string
	Timestamp int64
	Open      int
	Close     int
	High      int
	Low       int
	Volume    float64
}

StockPrice is a struct describing price of the stock

func (StockPrice) GetDBRegisterForm

func (s StockPrice) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

type User

type User struct {
	UserID    int64 // same as telegram id
	Superuser bool
}

User is a struct for describing users

func AllUsers

func AllUsers(client *database.DBClient) []User

AllUsers returns all users

func UserFromID

func UserFromID(client *database.DBClient, token int64) (User, error)

UserFromID finds user by user ID

func (User) GetDBRegisterForm

func (s User) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

type UserStock

type UserStock struct {
	UserID    int64
	StockID   string
	Strategy  string
	OrderSide int
	Repeat    bool `db:"RepeatStrategy"`
}

UserStock is a struct describing the users' stock strategy

func AllStrategies

func AllStrategies(client *database.DBClient) []UserStock

AllStrategies returns all strategies

func (UserStock) GetDBRegisterForm

func (s UserStock) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

type WatchingStock

type WatchingStock struct {
	StockID            string
	IsWatching         bool
	LastPriceTimestamp int64
}

WatchingStock is a struct for describing if the stock item is being watched or not.

func (WatchingStock) GetDBRegisterForm

func (s WatchingStock) GetDBRegisterForm() database.DBRegisterForm

GetDBRegisterForm is just an implementation

Jump to

Keyboard shortcuts

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