structs

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PairPrice added in v0.1.13

type PairPrice struct {
	TokenAddress string `json:"token_address"`
	BaseAddress  string `json:"base_address"`
	Price        string `json:"price"`
}

type ParseRouterMethodAndParams added in v1.1.4

type ParseRouterMethodAndParams struct {
	Method *abi.Method   `json:"method"`
	Params []interface{} `json:"params"`
}

func GetMethodsAndParamsFromInputData added in v1.1.4

func GetMethodsAndParamsFromInputData(stringData string, routerVersion int64, swap string) (*ParseRouterMethodAndParams, error)

type PurchaseInfo added in v0.1.8

type PurchaseInfo struct {
	UserTaskId    string `json:"user_task_id"`
	TokenAddress  string `json:"token_address"`
	BaseAddress   string `json:"base_address"`
	DefiAddress   string `json:"defi_address"`
	ChainId       string `json:"chain_id"`
	PurchasePrice string `json:"purchase_price"`
	Symbol        string `json:"symbol"`
	Decimals      int64  `json:"decimals"`
	Time          int64  `json:"time"`
}

func GetUserPurchasesByTokenPair added in v0.1.11

func GetUserPurchasesByTokenPair(rdb *redis.Client, tokenAddress, baseAddress string) ([]PurchaseInfo, error)

获取某个代币对下的所有买入信息

func (*PurchaseInfo) HasPurchasedToken added in v0.1.12

func (purchase *PurchaseInfo) HasPurchasedToken(rdb *redis.Client) (bool, error)

func (*PurchaseInfo) RemovePurchaseInfoFromRedis added in v0.1.12

func (purchase *PurchaseInfo) RemovePurchaseInfoFromRedis(rdb *redis.Client) error

删除买入信息

func (*PurchaseInfo) SavePurchaseInfoToRedis added in v0.1.8

func (purchase *PurchaseInfo) SavePurchaseInfoToRedis(rdb *redis.Client) error

第一次买入,存入 redis

type ReadyTrade added in v0.1.4

type ReadyTrade struct {
	Token0      string `json:"token0"`
	Token1      string `json:"token1"`
	DefiAddress string `json:"defi_address"`
	ChainId     string `json:"chain_id"`
	Amount      string `json:"amount"`
	Account     string `json:"account"`
	IsBuy       bool   `json:"is_buy"`
	SettingId   string `json:"setting_id"`
	Type        int8   `json:"type"` // 1-正常分析(百分比买卖) 2-止盈分析(涨幅超过用户设置的全部卖出) 3-停止运行全部卖出
}

func (*ReadyTrade) Send added in v0.1.12

func (r *ReadyTrade) Send(rdb *redis.Client, ec *ethclient.Client) (*types.Transaction, error)

type TokenPair added in v0.1.10

type TokenPair struct {
	TokenAddress string
	BaseAddress  string
}

func GetAllDistinctTokenPairs added in v0.1.10

func GetAllDistinctTokenPairs(rdb *redis.Client) ([]TokenPair, error)

获取平台所有已买入的代币对

func GetAllPurchasedTokenPairsForUser added in v0.1.16

func GetAllPurchasedTokenPairsForUser(rdb *redis.Client, userBotSettingID string) ([]TokenPair, error)

获取用户的所有币对儿

type TradeSend added in v0.1.4

type TradeSend struct {
	Transaction *types.Transaction
	Token0      common.Address
	Token1      common.Address
	DefiAddress common.Address
	Price       *big.Float
	Task        *UserTask
	IsBuy       bool
	Error       error
}

type TransactionData

type TransactionData struct {
	ChainId     *big.Int
	Hash        common.Hash
	From        common.Address
	To          common.Address
	Value       *big.Int
	Gas         uint64
	GasPrice    *big.Int
	Data        string
	BlockNumber *big.Int
}

交易

func (TransactionData) MarshalJSON

func (t TransactionData) MarshalJSON() ([]byte, error)

func (*TransactionData) ToMessage

func (t *TransactionData) ToMessage() string

func (*TransactionData) UnmarshalJSON

func (t *TransactionData) UnmarshalJSON(data []byte) error

type UserTask added in v1.0.2

type UserTask struct {
	ID                     int64          `json:"id"`
	UserId                 int64          `json:"user_id"`
	Name                   string         `json:"name"`
	ChainId                *big.Int       `json:"chain_id"`
	FollowAddress          common.Address `json:"follow_address"`
	BuyType                int64          `json:"buy_type"`
	Amount                 *big.Int       `json:"amount"`
	MinAmountAction        int64          `json:"min_amount_action"`
	MinAmount              *big.Int       `json:"min_amount"`
	MaxAmountAction        int64          `json:"max_amount_action"`
	MaxAmount              *big.Int       `json:"max_amount"`
	StopWin                int64          `json:"stop_win"`
	StopWinMin             int64          `json:"stop_win_min"`
	StopLost               int64          `json:"stop_lost"`
	StopLostMin            int64          `json:"stop_lost_min"`
	StopAt                 int64          `json:"stop_at"`
	IsSellAll              int64          `json:"is_sell_all"`
	IsSell                 int64          `json:"is_sell"`
	AvoidHoneyPot          int64          `json:"avoid_honey_pot"`
	IsZero                 int64          `json:"is_zero"`
	PreventSandwichAttacks int64          `json:"prevent_sandwich_attacks"`
	PrivateKey             string         `json:"private_key"`
	IsVip                  int64          `json:"is_vip"`
}

用户配置

func GetUserTaskById added in v1.0.2

func GetUserTaskById(chainId string, id string, rds *redis.Client) (*UserTask, error)

func MapToUserTask added in v1.0.2

func MapToUserTask(setting map[string]string) (*UserTask, error)

func (*UserTask) AnalyzeTransaction added in v1.0.2

func (s *UserTask) AnalyzeTransaction(t TransactionData, client *ethclient.Client, rds *redis.Client, RouterV2Address common.Address) (*ReadyTrade, error)

分析交易

func (*UserTask) SellAllTransaction added in v1.0.2

func (s *UserTask) SellAllTransaction(defiAddress common.Address, rdb *redis.Client, client *ethclient.Client) ([]*ReadyTrade, error)

全部卖出- 停止跟单

func (*UserTask) StopWinTransaction added in v1.0.2

func (s *UserTask) StopWinTransaction(price *big.Float, purchase PurchaseInfo, token *token.Token) (*ReadyTrade, error)

止盈交易 price 现在价格 purchase 购买信息 token 要卖出的代币

func (*UserTask) UnmarshalJSON added in v1.0.2

func (ut *UserTask) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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