position

package
v1.0.73 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertPosition

func InsertPosition(position Position) (int, error)

func InsertPositions

func InsertPositions(positions []Position) error

func RemoveAllPositionByAccount

func RemoveAllPositionByAccount(accountID int) error

func RemovePosition

func RemovePosition(positionID int) error

func RemovePositionByDateRangeAndAccount

func RemovePositionByDateRangeAndAccount(startDate, endDate time.Time, accountID int) error

func UpdatePosition

func UpdatePosition(position Position) error

Types

type Position

type Position struct {
	ID            *int      `json:"id"`
	UUID          string    `json:"uuid"`
	Name          string    `json:"name"`
	AlternateName string    `json:"alternateName"`
	AccountID     *int      `json:"accountId"`
	PortfolioID   *int      `json:"portfolioId"`
	FrequnecyID   *int      `json:"frequencyId"`
	StartDate     time.Time `json:"startDate"`
	EndDate       time.Time `json:"endDate"`
	BaseAssetID   *int      `json:"baseAssetId"`
	QuoteAssetID  *int      `json:"quoteAssetId"`
	Quantity      *float64  `json:"quantity"`
	CostBasis     *float64  `json:"costBasis"`
	Profit        *float64  `json:"profit"`
	TotalAmount   *float64  `json:"totalAmount"`
	Description   string    `json:"description"`
	CreatedBy     string    `json:"createdBy"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedBy     string    `json:"updatedBy"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

Position

func GetPosition

func GetPosition(positionID int) (*Position, error)

func GetPositionBetweenDatesAndAccountAllCurrentAssets

func GetPositionBetweenDatesAndAccountAllCurrentAssets(startDate, endDate time.Time, frequencyID int, quoteAssetID int, accountID *int) ([]Position, error)

func GetPositionByDates

func GetPositionByDates(startDate, endDate time.Time, frequencyID int, baseAssetID int, quoteAssetID int) (*Position, error)

func GetPositionByDatesAccountsForAllTradeableAssets

func GetPositionByDatesAccountsForAllTradeableAssets(startDate, endDate time.Time, frequencyID int, quoteAssetID int, accountID *int) ([]Position, error)

func GetPositionByDatesAndAccount

func GetPositionByDatesAndAccount(startDate, endDate time.Time, frequencyID int, baseAssetID int, quoteAssetID int, accountID *int) (*Position, error)

func GetPositions

func GetPositions(ids []int) ([]Position, error)

func QueryPositions

func QueryPositions(positionQuery *PositionQuery) ([]Position, error)

type PositionQuery

type PositionQuery struct {
	AccountID   *int       `schema:"accountId"`
	PortfolioID *int       `schema:"portfolioId"`
	FrequencyID *int       `schema:"frequencyId"`
	StartDate   *time.Time `schema:"startDate"`
	EndDate     *time.Time `schema:"endDate"`
	BaseAssetID *int       `schema:"baseAssetId"`
}

Jump to

Keyboard shortcuts

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