order

package
v2.0.0-...-b3d4e52 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuyCMD = &cobra.Command{
	Use:   "buy",
	Short: "Buy order",
	Run: func(cmd *cobra.Command, args []string) {
		symbol, _ := cmd.Flags().GetString("symbol")
		quantity, _ := cmd.Flags().GetString("quantity")
		price, _ := cmd.Flags().GetString("price")

		order, err := order.Buy(context.Background(), symbol, quantity, price)
		if err != nil {
			fmt.Print(err)
		}
		utils.OPrint(order)
	},
}

listCmd represents the list command

View Source
var GetCmd = &cobra.Command{
	Use:   "get",
	Short: "Get order details",
	Run: func(cmd *cobra.Command, args []string) {
		symbol, _ := cmd.Flags().GetString("symbol")
		orderId, _ := cmd.Flags().GetInt64("orderId")
		order, err := order.Get(context.Background(), symbol, orderId)
		if err != nil {
			fmt.Print(err)
		}
		utils.OPrint(order)
	},
}

listCmd represents the list command

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List orders",
	Run: func(cmd *cobra.Command, args []string) {
		symbol, _ := cmd.Flags().GetString("symbol")
		all, _ := cmd.Flags().GetBool("all")
		var orders []*binance.Order
		var err error
		if all == true {
			orders, err = order.List(context.Background(), symbol)
		} else {
			orders, err = order.ListOpen(context.Background(), symbol)
		}
		if err != nil {
			fmt.Print(err)
		}
		utils.OPrint(orders)
	},
}

listCmd represents the list command

View Source
var OrderCmd = &cobra.Command{
	Use:   "order",
	Short: "Orders operations",
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Help()
	},
}

listCmd represents the list command

View Source
var SellCMD = &cobra.Command{
	Use:   "sell",
	Short: "Sell order",
	Run: func(cmd *cobra.Command, args []string) {
		symbol, _ := cmd.Flags().GetString("symbol")
		quantity, _ := cmd.Flags().GetString("quantity")
		price, _ := cmd.Flags().GetString("price")

		order, err := order.Sell(context.Background(), symbol, quantity, price)
		if err != nil {
			fmt.Print(err)
		}
		utils.OPrint(order)
	},
}

listCmd represents the list command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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