ir

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account string

Account is the key for account names

const (
	CashAccount       Account = "CashAccount"
	PositionAccount   Account = "PositionAccount"
	CommissionAccount Account = "CommissionAccount"
	PnlAccount        Account = "PnlAccount"
	PlusAccount       Account = "PlusAccount"
	MinusAccount      Account = "MinusAccount"
)

type IR

type IR struct {
	// TODO(gaocegege): Refactor it to be general.
	Orders []Order
}

IR is the intermediate representation for the double-entry bookkeeping.

func New

func New() *IR

New creates a new IR.

type Order

type Order struct {
	OrderType       OrderType
	Peer            string
	Item            string
	Category        string
	MerchantOrderID *string
	OrderID         *string
	Money           float64
	Note            string
	PayTime         time.Time
	Type            Type // 方向,一般为 收/支
	TypeOriginal    string
	TxTypeOriginal  string // 交易类型
	Method          string
	Amount          float64
	Price           float64
	Commission      float64 // 手续费/服务费
	Units           map[Unit]string
	ExtraAccounts   map[Account]string
	MinusAccount    string
	PlusAccount     string
	Metadata        map[string]string
	Tags            []string
}

Order is the intermediate representation for the order.

type OrderType

type OrderType string // 为 IR 设置的交易类别
const (
	OrderTypeNormal          OrderType = "Normal"          // 流水交易
	OrderTypeHuobiTrade      OrderType = "HuobiTrade"      //  火币交易
	OrderTypeSecuritiesTrade OrderType = "SecuritiesTrade" // 证券交易
)

type Type added in v1.7.0

type Type string

Type is transaction type defined by alipay.

const (
	TypeSend    Type = "Send"
	TypeRecv    Type = "Recv"
	TypeUnknown Type = "Unknwon"
)

type Unit

type Unit string

Unit is the key commodity names

const (
	BaseUnit       Unit = "BaseUnit"
	TargetUnit     Unit = "TargetUnit"
	CommissionUnit Unit = "CommissionUnit"
)

Jump to

Keyboard shortcuts

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