app

package
v0.0.0-...-f15baf8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMongoDB

func ConnectMongoDB(uri string) (*mongo.Client, context.Context, error)

func FindByTransactionsByTicker

func FindByTransactionsByTicker(client *mongo.Client, data ApiTrades, ticker string) *[]Trade

func MongoInit

func MongoInit(tradeData []ApiTrades)

func SaveData

func SaveData(db *mongo.Database, data ApiTrades) error

func UpdateTransactionForTicker

func UpdateTransactionForTicker(client *mongo.Client, ticker string, trade Trade) error

Types

type ApiTrades

type ApiTrades struct {
	Ticker       string  `bson:"Ticker"`
	Transactions []Trade `bson:"Transactions"`
}

type Trade

type Trade struct {
	Id     string  `bson:"Id"`
	Ticker string  `bson:"Ticker"`
	Type   string  `bson:"Type"`
	Amount float64 `bson:"Amount"`
	Isin   string  `bson:"Isin"`
	Shares int     `bson:"Shares"`
	Date   string  `bson:"Date"`
}

type Trades

type Trades struct {
	Ticker                 string
	SharesToCount          int
	SharesToCountForBuying int
	Transactions           []Trade
	Buy                    []Trade
	Sell                   []Trade
}

Jump to

Keyboard shortcuts

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