db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

TODO - read / write Max | Min. Here and repo

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • Copyright 2021 M1K *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTradingHours

func IsTradingHours() bool

Types

type Alert

type Alert interface {
	GetPctGain(closing float32) float32
}

type Crypto

type Crypto struct {
	CryptoAlertID  string `bun:",pk"`
	CryptoGuildID  string
	CryptoCoin     string
	CryptoStarting float32
	CryptoSPt      float32
	CryptoEPt      float32
	CryptoExpiry   int64
	CryptoHighest  float32
	CryptoStop     float32
	CryptoPoI      float32
	ChannelType    int
	Caller         string
	CryptoPOIHit   bool
	CryptoCallTime time.Time
}

func (Crypto) GetPctGain

func (c Crypto) GetPctGain(highest float32) float32

type DB

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

func InitDBConnection

func InitDBConnection(guildID string) *DB

func (*DB) CreateCrypto

func (d *DB) CreateCrypto(coin, author string, spt, ept, poi, stop float32, channelType int, guildID string, starting float32) (chan bool, bool, error)

func (*DB) CreateOption

func (d *DB) CreateOption(guildID, author string, channelType int, ticker, contractType, day, month, year string, price, starting, pt, poi, stop, underStart float32) (chan bool, string, bool, error)

func (*DB) CreateShort

func (d *DB) CreateShort(stock, author string, channelType int, spt, ept, poi, stop float32, expiry int64, guildID string, starting float32) (chan bool, bool, error)

func (*DB) CreateStock

func (d *DB) CreateStock(stock, author string, channelType int, spt, ept, poi, stop float32, expiry int64, guildID string, starting float32) (chan bool, bool, error)

func (*DB) CryptoPOIHit

func (d *DB) CryptoPOIHit(guildID, coin string) error

func (*DB) CryptoSetNewHigh

func (d *DB) CryptoSetNewHigh(guildID, coin string, price float32) error

func (*DB) GetCrypto

func (d *DB) GetCrypto(guildID, coin string) (*Crypto, error)

func (*DB) GetExitChan

func (d *DB) GetExitChan(guildid, index string) chan bool

func (*DB) GetOption

func (d *DB) GetOption(guildID, oID string) (*Option, error)

func (*DB) GetShort

func (d *DB) GetShort(guildID, stock string) (*Short, error)

func (*DB) GetStock

func (d *DB) GetStock(guildID, stock string) (*Stock, error)

func (*DB) OptionPOIHit

func (d *DB) OptionPOIHit(guildID, oID string) error

func (*DB) OptionSetNewHigh

func (d *DB) OptionSetNewHigh(guildID, uid string, price float32) error

func (*DB) RefreshFromDB

func (d *DB) RefreshFromDB(guildID string) ([]*Stock, []*Short, []*Option, []*Crypto, error)

func (*DB) RemoveCrypto

func (d *DB) RemoveCrypto(guildID, coin string) error

func (*DB) RemoveOption

func (d *DB) RemoveOption(guildID, ticker, contractType, day, month, year string, price float32) error

func (*DB) RemoveOptionByCode

func (d *DB) RemoveOptionByCode(guildID, oID string) error

func (*DB) RemoveShort

func (d *DB) RemoveShort(guildID, stock string) error

func (*DB) RemoveStock

func (d *DB) RemoveStock(guildID, stock string) error

func (*DB) RmAll

func (d *DB) RmAll(guildID string) error

func (*DB) SetAndReturnNewExitChan

func (d *DB) SetAndReturnNewExitChan(guildid, index string, exitChan chan bool) chan bool

func (*DB) ShortPOIHit

func (d *DB) ShortPOIHit(guildID, ticker string) error

func (*DB) ShortSetNewHigh

func (d *DB) ShortSetNewHigh(guildID, uid string, price float32) error

func (*DB) ShowAll

func (d *DB) ShowAll(guildID string) []string

func (*DB) StockPOIHit

func (d *DB) StockPOIHit(guildID, ticker string) error

func (*DB) StockSetNewHigh

func (d *DB) StockSetNewHigh(guildID, uid string, price float32) error

type Option

type Option struct {
	OptionAlertID            string `bun:",pk"`
	OptionGuildID            string
	OptionTicker             string
	OptionUid                string
	OptionContractType       string
	OptionDay                string
	OptionMonth              string
	OptionYear               string
	OptionStrike             float32
	OptionStarting           float32
	OptionHighest            float32
	OptionUnderlyingPoI      float32
	OptionUnderlyingStop     float32
	OptionUnderlyingStarting float32
	ChannelType              int
	Caller                   string
	OptionUnderlyingPOIHit   bool
	OptionCallTime           time.Time
}

func (Option) GetPctGain

func (o Option) GetPctGain(highest float32) float32

type Short

type Short struct {
	ShortAlertID  string `bun:",pk"`
	ShortGuildID  string
	ShortTicker   string
	ShortStarting float32
	ShortSPt      float32
	ShortEPt      float32
	ShortExpiry   int64
	ShortLowest   float32
	ShortPoI      float32
	ShortStop     float32
	ChannelType   int
	Caller        string
	ShortPOIHit   bool
	ShortCallTime time.Time
}

func (Short) GetPctGain

func (s Short) GetPctGain(highest float32) float32

type Stock

type Stock struct {
	StockAlertID  string `bun:",pk"`
	StockGuildID  string
	StockTicker   string
	StockStarting float32
	StockEPt      float32
	StockSPt      float32
	StockExpiry   int64
	StockHighest  float32
	StockPoI      float32
	StockStop     float32
	ChannelType   int
	Caller        string
	StockPOIHit   bool
	StockCallTime time.Time
}

func (Stock) GetPctGain

func (s Stock) GetPctGain(highest float32) float32

Jump to

Keyboard shortcuts

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