engine/gRPC: Add update account info to grpc interface (#602)

* Add update account info to grpc interface

* Fix lbank tests

* Review corrections

* Review corrections

* Fix linter
This commit is contained in:
Mikhail Shogin
2020-11-30 01:29:31 +01:00
committed by GitHub
parent b7d99f741d
commit ba4ac4f3d6
13 changed files with 416 additions and 100 deletions

View File

@@ -831,6 +831,55 @@ func getAccountInfoStream(c *cli.Context) error {
}
}
var updateAccountInfoCommand = cli.Command{
Name: "updateaccountinfo",
Usage: "updates the exchange account balance info",
ArgsUsage: "<exchange>",
Action: updateAccountInfo,
Flags: []cli.Flag{
cli.StringFlag{
Name: "exchange",
Usage: "the exchange to get the account info for",
},
},
}
func updateAccountInfo(c *cli.Context) error {
if c.NArg() == 0 && c.NumFlags() == 0 {
return cli.ShowCommandHelp(c, "updateaccountinfo")
}
var exchange string
if c.IsSet("exchange") {
exchange = c.String("exchange")
} else {
exchange = c.Args().First()
}
if !validExchange(exchange) {
return errInvalidExchange
}
conn, err := setupClient()
if err != nil {
return err
}
defer conn.Close()
client := gctrpc.NewGoCryptoTraderClient(conn)
result, err := client.UpdateAccountInfo(context.Background(),
&gctrpc.GetAccountInfoRequest{
Exchange: exchange,
},
)
if err != nil {
return err
}
jsonOutput(result)
return nil
}
var getConfigCommand = cli.Command{
Name: "getconfig",
Usage: "gets the config",

View File

@@ -109,6 +109,7 @@ func main() {
getOrderbooksCommand,
getAccountInfoCommand,
getAccountInfoStreamCommand,
updateAccountInfoCommand,
getConfigCommand,
getPortfolioCommand,
getPortfolioSummaryCommand,