mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
cmd/order: add margin-side-effect option
This commit is contained in:
parent
33fdcefba3
commit
90b633158a
|
@ -334,6 +334,11 @@ var submitOrderCmd = &cobra.Command{
|
|||
return fmt.Errorf("can not get quantity: %w", err)
|
||||
}
|
||||
|
||||
marginOrderSideEffect, err := cmd.Flags().GetString("margin-side-effect")
|
||||
if err != nil {
|
||||
return fmt.Errorf("can not get quantity: %w", err)
|
||||
}
|
||||
|
||||
environ := bbgo.NewEnvironment()
|
||||
if err := environ.ConfigureExchangeSessions(userConfig); err != nil {
|
||||
return err
|
||||
|
@ -361,6 +366,7 @@ var submitOrderCmd = &cobra.Command{
|
|||
Price: fixedpoint.MustNewFromString(price),
|
||||
Market: market,
|
||||
TimeInForce: "GTC",
|
||||
MarginSideEffect: types.MarginOrderSideEffectType(marginOrderSideEffect),
|
||||
}
|
||||
|
||||
co, err := session.Exchange.SubmitOrders(ctx, so)
|
||||
|
@ -386,6 +392,7 @@ func init() {
|
|||
submitOrderCmd.Flags().String("side", "", "the trading side: buy or sell")
|
||||
submitOrderCmd.Flags().String("price", "", "the trading price")
|
||||
submitOrderCmd.Flags().String("quantity", "", "the trading quantity")
|
||||
submitOrderCmd.Flags().String("margin-side-effect", "", "margin order side effect")
|
||||
|
||||
executeOrderCmd.Flags().String("session", "", "the exchange session name for sync")
|
||||
executeOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
|
||||
|
|
Loading…
Reference in New Issue
Block a user