mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
move and fix binance exchange api examples
This commit is contained in:
parent
90f077b78b
commit
68064bfe44
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
"github.com/c9s/bbgo/pkg/cmd/cmdutil"
|
||||
"github.com/c9s/bbgo/pkg/exchange/binance"
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
)
|
||||
|
||||
|
@ -70,7 +71,7 @@ var rootCmd = &cobra.Command{
|
|||
return fmt.Errorf("market %s is not defined", symbol)
|
||||
}
|
||||
|
||||
marginAccount, err := exchange.QueryMarginAccount(ctx)
|
||||
marginAccount, err := exchange.QueryCrossMarginAccount(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -98,8 +99,8 @@ var rootCmd = &cobra.Command{
|
|||
Market: market,
|
||||
Side: types.SideTypeBuy,
|
||||
Type: types.OrderTypeLimit,
|
||||
Price: price,
|
||||
Quantity: quantity,
|
||||
Price: fixedpoint.NewFromFloat(price),
|
||||
Quantity: fixedpoint.NewFromFloat(quantity),
|
||||
MarginSideEffect: types.SideEffectTypeMarginBuy,
|
||||
TimeInForce: "GTC",
|
||||
})
|
|
@ -374,7 +374,7 @@ func (e *Exchange) transferCrossMarginAccountAsset(ctx context.Context, asset st
|
|||
return err
|
||||
}
|
||||
|
||||
func (e *Exchange) queryCrossMarginAccount(ctx context.Context) (*types.Account, error) {
|
||||
func (e *Exchange) QueryCrossMarginAccount(ctx context.Context) (*types.Account, error) {
|
||||
marginAccount, err := e.client.NewGetMarginAccountService().Do(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -406,7 +406,7 @@ func (e *Exchange) queryCrossMarginAccount(ctx context.Context) (*types.Account,
|
|||
return a, nil
|
||||
}
|
||||
|
||||
func (e *Exchange) queryIsolatedMarginAccount(ctx context.Context) (*types.Account, error) {
|
||||
func (e *Exchange) QueryIsolatedMarginAccount(ctx context.Context) (*types.Account, error) {
|
||||
req := e.client.NewGetIsolatedMarginAccountService()
|
||||
req.Symbols(e.IsolatedMarginSymbol)
|
||||
|
||||
|
@ -677,9 +677,9 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
|
|||
if e.IsFutures {
|
||||
account, err = e.QueryFuturesAccount(ctx)
|
||||
} else if e.IsIsolatedMargin {
|
||||
account, err = e.queryIsolatedMarginAccount(ctx)
|
||||
account, err = e.QueryIsolatedMarginAccount(ctx)
|
||||
} else if e.IsMargin {
|
||||
account, err = e.queryCrossMarginAccount(ctx)
|
||||
account, err = e.QueryCrossMarginAccount(ctx)
|
||||
} else {
|
||||
account, err = e.QuerySpotAccount(ctx)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user