-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
engine/gRPC: Add update account info to grpc interface #602
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice update 👍
I have tested exchanges I have keys on:
- Binance
- Kraken
- Bitfinex
- Bitmex
- Coinut
- HitBTC
- Okcoin
- Okex
Found some Out Of Scope Issues:
- Appending to currency list without any balance is very verbose console side from GRPC
- go run ./... updateaccountinfo coinut
2020/11/26 15:39:06 rpc error: code = Unknown desc = COINUT websocket connection: timeout waiting for response with signature: 4868563
exit status 1 - {
"currency": "XRP",
"total_value": 1234.1234 // Think this needs to change to amount in okex and okcoin.
}
Thank you very much for opening this PR 🎉
engine/rpcserver_test.go
Outdated
|
||
r, err := s.GetAccountInfo(context.Background(), &gctrpc.GetAccountInfoRequest{Exchange: fakePassExchange}) | ||
if err != nil { | ||
t.Errorf("TestGetAccountInfo: Failed to get account info: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do t.Fatalf saves you doing return afterward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced
engine/rpcserver_test.go
Outdated
|
||
func cmpAccounts(t *testing.T, exp []account.SubAccount, act []*gctrpc.Account) { | ||
if len(act) != len(exp) { | ||
t.Errorf("TestGetAccountInfo: Unexpected number of accouns in the response: exp=%d, act=%d", len(exp), len(act)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accouns -> accounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you mshogin for contributing to the project! Thank you for filling in some missing RPC functionality. Thank you as well for patching up LBank. I've tested it and it works. I've just got a few comments.
Sweet, thanks for making those changes so quickly! One more thing I've noticed that our build is having linter issues: |
sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK! Thanks for making those changes and thank you for your contribution @mshogin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested couple of exchanges n works just fine!! tACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK - Thanks! 🎉 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK, thanks @mshogin for this new feature plus also for resolving the lbank OB issue!
./gctcli updateaccountinfo --exchange=binance
{
"exchange": "Binance",
"accounts": [
{
"currencies": [
{
"currency": "BTC",
"total_value": xxx
...
Thank you |
PR Description
This patch add support of UpdateAccountInfo to the GRPC server.
It is useful to have actual account state for the preliminary validation of the bid request.
Without such possibility we have to send requests to the exchange and either use completed orders for keeping account up to date or handle error messages from the exchange.
Type of change
How has this been tested
Added tests to the engine/rpcserver_test.go
Checklist