service

package
v0.0.0-...-378a548 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FundLimitPerUserId int64 = 3

Functions

func Buy

func Buy(ctx context.Context, securities *Securities) error

func FundWithInitAccount

func FundWithInitAccount(ctx context.Context, aliasName, userId string, openingCash decimal.Decimal) error

func FundWithModifyAliasName

func FundWithModifyAliasName(ctx context.Context, aliasName string, fundNo string) error

func Sell

func Sell(ctx context.Context, securities *Securities) error

Types

type Account

type Account struct {
	AliasName        string          `json:"alias_name"`
	UserId           string          `json:"user_id"`
	FundNo           string          `json:"fund_no"`
	OpeningCash      decimal.Decimal `json:"opening_cash"`
	EndCash          decimal.Decimal `json:"end_cash"`
	YesterdayEndCash decimal.Decimal `json:"yesterday_end_cash"`
	Status           int8            `json:"status"`
	InitDatetime     time.Time       `json:"init_datetime"`
}

func FundWithListByUserId

func FundWithListByUserId(ctx context.Context, userId string) ([]*Account, error)

func FundWithOneByFundNo

func FundWithOneByFundNo(ctx context.Context, fundNo string) (*Account, error)

type AccountStatus

type AccountStatus int8
const (
	NORMAL AccountStatus = 0
	FREEZE
)

type Assets

type Assets struct {
	UserId           string          `json:"user_id"`
	FundNo           string          `json:"fund_no"`
	Type             int8            `json:"type"`
	CashPosition     decimal.Decimal `json:"cash_position"`
	Code             string          `json:"code"`
	Name             string          `json:"name"`
	OpenInterest     int64           `json:"open_interest"`
	OpenId           string          `json:"open_id"`
	FirstBuyDatetime time.Time       `json:"first_buy_datetime"`
}

func AssetsWithFindManyByFundNo

func AssetsWithFindManyByFundNo(ctx context.Context, fundNo string) ([]*Assets, error)

func AssetsWithFindManyByUserId

func AssetsWithFindManyByUserId(ctx context.Context, userId string) ([]*Assets, error)

func AssetsWithFindOneByUserIdFundNoCode

func AssetsWithFindOneByUserIdFundNoCode(ctx context.Context, userId, fundNo, code string) (*Assets, error)

type Securities

type Securities struct {
	UserId string
	FundNo string

	Type       SecuritiesType
	Code       string
	Name       string
	Volumn     int64
	ClosePrice float64
}

type SecuritiesType

type SecuritiesType int8
const (
	STOCK SecuritiesType = iota
	ETF
)

type Stock

type Stock struct {
	Code string
	Name string
}

func StockWithGetOne

func StockWithGetOne(ctx context.Context, code string) (*Stock, error)

type TransactionRecordType

type TransactionRecordType int8
const (
	OPENING TransactionRecordType = iota
	BUY
	SELL
	CLEAR
)

Jump to

Keyboard shortcuts

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