huobi

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LocalTimeFmt = "2006-01-02 15:04:05 -0700"

LocalTimeFmt set time format to utc+8

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Rules []Rule `mapstructure:"rules,omitempty"`
}

type Huobi

type Huobi struct {
	Statistics Statistics `json:"statistics,omitempty"`
	LineNum    int        `json:"line_num,omitempty"`
	Orders     []Order    `json:"orders,omitempty"`
}

func New

func New() *Huobi

func (*Huobi) Translate

func (h *Huobi) Translate(filename string) (*ir.IR, error)

type Order

type Order struct {
	PayTime        time.Time // 付款时间
	TxType         TxType    // 类型
	TxTypeOriginal string    // 原始类型
	Item           string    // 交易对
	Type           OrderType // 方向
	Price          float64   // 价格
	Amount         float64   // 数量
	Money          float64   // 成交额
	Commission     float64   // 手续费
	BaseUnit       string    // 基准单位
	TargetUnit     string    // 目标单位
	CommissionUnit string    // 手续费单位
}

type OrderType

type OrderType string
const (
	TypeBuy  OrderType = "买入"
	TypeSell OrderType = "卖出"
	TypeNil  OrderType = "未知"
)

type Rule

type Rule struct {
	// Peer              *string `mapstructure:"peer,omitempty"`
	Item              *string `mapstructure:"item,omitempty"`   // "BTC/USDT"
	Type              *string `mapstructure:"type,omitempty"`   // "买入"、"卖出"
	TxType            *string `mapstructure:"txType,omitempty"` // "币币交易"
	Time              *string `mapstructure:"time,omitempty"`
	TimestampRange    *string `mapstructure:"timestamp_range,omitempty"`
	Separator         *string `mapstructure:"sep,omitempty"` // default: ,
	CashAccount       *string `mapstructure:"cashAccount,omitempty"`
	PositionAccount   *string `mapstructure:"positionAccount,omitempty"`
	CommissionAccount *string `mapstructure:"commissionAccount,omitempty"`
	PnlAccount        *string `mapstructure:"pnlAccount,omitempty"`
	FullMatch         bool    `mapstructure:"fullMatch,omitempty"`
}

type Statistics

type Statistics struct {
	UserID          string    `json:"user_id,omitempty"`
	Username        string    `json:"username,omitempty"`
	ParsedItems     int       `json:"parsed_items,omitempty"`
	Start           time.Time `json:"start,omitempty"`
	End             time.Time `json:"end,omitempty"`
	TotalInRecords  int       `json:"total_in_records,omitempty"`
	TotalInMoney    float64   `json:"total_in_money,omitempty"`
	TotalOutRecords int       `json:"total_out_records,omitempty"`
	TotalOutMoney   float64   `json:"total_out_money,omitempty"`
}

type TxType

type TxType string

TxType is the type of the order.

const (
	TxTypeCoin    TxType = "币币交易"
	TxTypeUnknown TxType = "未知"
)

Jump to

Keyboard shortcuts

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