(eName string, s accounts.SubAccounts)
| 638 | } |
| 639 | |
| 640 | func accountBalanceResp(eName string, s accounts.SubAccounts) *gctrpc.GetAccountBalancesResponse { |
| 641 | subAccts := make([]*gctrpc.Account, len(s)) |
| 642 | for i, sa := range s { |
| 643 | subAccts[i] = &gctrpc.Account{ |
| 644 | Id: sa.ID, |
| 645 | } |
| 646 | for curr, bal := range sa.Balances { |
| 647 | subAccts[i].Currencies = append(subAccts[i].Currencies, &gctrpc.AccountCurrencyInfo{ |
| 648 | Currency: curr.String(), |
| 649 | TotalValue: bal.Total, |
| 650 | Hold: bal.Hold, |
| 651 | Free: bal.Free, |
| 652 | FreeWithoutBorrow: bal.AvailableWithoutBorrow, |
| 653 | Borrowed: bal.Borrowed, |
| 654 | UpdatedAt: timestamppb.New(bal.UpdatedAt), |
| 655 | }) |
| 656 | } |
| 657 | } |
| 658 | return &gctrpc.GetAccountBalancesResponse{ |
| 659 | Exchange: eName, |
| 660 | Accounts: subAccts, |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | // GetAccountBalancesStream streams an account balance for a specific exchange |
| 665 | func (s *RPCServer) GetAccountBalancesStream(r *gctrpc.GetAccountBalancesRequest, stream gctrpc.GoCryptoTraderService_GetAccountBalancesStreamServer) error { |
no test coverage detected