trader

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelOrder

func CancelOrder(orderId int) error

CancelOrder 撤单

func PlaceOrder

func PlaceOrder(direction Direction, model models.Strategy, securityCode string, price float64, volume int) (int, error)

PlaceOrder 下委托订单

Types

type AccountDetail

type AccountDetail struct {
	TotalAsset  float64 `name:"总金额" json:"total_asset"`
	Cash        float64 `name:"可用" json:"cash"`
	MarketValue float64 `name:"市值" json:"market_value"`
	FrozenCash  float64 `name:"冻结" json:"frozen_cash"`
}

AccountDetail 账户信息

func QueryAccount

func QueryAccount() (*AccountDetail, error)

QueryAccount 查询账户信息

type Direction

type Direction string

Direction 交易方向

const (
	BUY  Direction = "buy"  // 买入
	SELL Direction = "sell" // 卖出
)

func (Direction) String

func (d Direction) String() string

type OrderDetail

type OrderDetail struct {
	StockCode    string  `json:"stock_code"`
	OrderVolume  int     `json:"order_volume"`
	TradedVolume int     `json:"traded_volume"`
	Price        float64 `json:"price"`
	OrderType    int     `json:"order_type"`
	OrderStatus  int     `json:"order_status"`
	OrderId      int     `json:"order_id"`
	OrderSysid   string  `json:"order_sysid"`
	OrderTime    string  `json:"order_time"`
}

OrderDetail 委托订单

func QueryOrders

func QueryOrders() ([]OrderDetail, error)

QueryOrders 查询当日委托

type OrderResult

type OrderResult struct {
	ProxyResult
	OrderId int `json:"order_id"`
}

OrderResult 结果

type PositionDetail

type PositionDetail struct {
	StockCode    string  `name:"证券代码" json:"stock_code"`
	Volume       int     `name:"持仓量" json:"volume"`
	CanUseVolume int     `name:"可卖" json:"can_use_volume"`
	OpenPrice    float64 `name:"成本价" json:"open_price"`
	MarketValue  float64 `name:"市值" json:"market_value"`
}

PositionDetail 持仓信息

func QueryHolding

func QueryHolding() ([]PositionDetail, error)

QueryHolding 查询持仓

type ProxyResult

type ProxyResult struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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