From 471e0a4c45a8a0f3084aa06c6b6d0bb524fb1160 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 28 Apr 2021 19:48:17 +0800 Subject: [PATCH] pass string format quantity and price --- pkg/cmd/orders.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkg/cmd/orders.go b/pkg/cmd/orders.go index e7a9adc19..6ab606e35 100644 --- a/pkg/cmd/orders.go +++ b/pkg/cmd/orders.go @@ -163,24 +163,28 @@ var placeOrderCmd = &cobra.Command{ if err != nil { return fmt.Errorf("can't get side: %w", err) } + price, err := cmd.Flags().GetString("price") if err != nil { return fmt.Errorf("can't get price: %w", err) } + quantity, err := cmd.Flags().GetString("quantity") if err != nil { return fmt.Errorf("can't get quantity: %w", err) } so := types.SubmitOrder{ - ClientOrderID: uuid.New().String(), - Symbol: symbol, - Side: types.SideType(ftx.TrimUpperString(side)), - Type: types.OrderTypeLimit, - Quantity: util.MustParseFloat(quantity), - Price: util.MustParseFloat(price), - Market: types.Market{Symbol: symbol}, - TimeInForce: "GTC", + ClientOrderID: uuid.New().String(), + Symbol: symbol, + Side: types.SideType(ftx.TrimUpperString(side)), + Type: types.OrderTypeLimit, + Quantity: util.MustParseFloat(quantity), + QuantityString: quantity, + Price: util.MustParseFloat(price), + PriceString: price, + Market: types.Market{Symbol: symbol}, + TimeInForce: "GTC", } co, err := session.Exchange.SubmitOrders(ctx, so) if err != nil {