Minor fixes

1) Fixes go fmt issue
2) Removes TO-DO item for supported asset pairs for GetExchangeInfo API
3) Fixes useless select used for testing
This commit is contained in:
Adrian Gallagher
2019-09-03 10:32:17 +10:00
parent 939953211d
commit 2307834fb6
6 changed files with 497 additions and 471 deletions

View File

@@ -138,8 +138,6 @@ func StartRPCRESTProxy() {
}()
log.Debugln(log.GRPCSys, "gRPC proxy server started!")
select {}
}
// GetInfo returns info about the current GoCryptoTrader session
@@ -252,23 +250,26 @@ func (s *RPCServer) GetExchangeInfo(ctx context.Context, r *gctrpc.GenericExchan
return nil, err
}
return &gctrpc.GetExchangeInfoResponse{
Name: exchCfg.Name,
Enabled: exchCfg.Enabled,
Verbose: exchCfg.Verbose,
UsingSandbox: exchCfg.UseSandbox,
HttpTimeout: exchCfg.HTTPTimeout.String(),
HttpUseragent: exchCfg.HTTPUserAgent,
HttpProxy: exchCfg.ProxyAddress,
BaseCurrencies: strings.Join(exchCfg.BaseCurrencies.Strings(), ","),
SupportedAssets: exchCfg.CurrencyPairs.AssetTypes.JoinToString(","),
resp := &gctrpc.GetExchangeInfoResponse{
Name: exchCfg.Name,
Enabled: exchCfg.Enabled,
Verbose: exchCfg.Verbose,
UsingSandbox: exchCfg.UseSandbox,
HttpTimeout: exchCfg.HTTPTimeout.String(),
HttpUseragent: exchCfg.HTTPUserAgent,
HttpProxy: exchCfg.ProxyAddress,
BaseCurrencies: strings.Join(exchCfg.BaseCurrencies.Strings(), ","),
}
// TO-DO fix pairs
//EnabledPairs: strings.Join(
// exchCfg.CurrencyPairs.Pairs.GetPairs().Enabled.Strings(), ","),
//AvailablePairs: strings.Join(
// exchCfg.CurrencyPairs.Spot.Available.Strings(), ","),
}, nil
resp.SupportedAssets = make(map[string]*gctrpc.PairsSupported)
for x := range exchCfg.CurrencyPairs.AssetTypes {
a := exchCfg.CurrencyPairs.AssetTypes[x]
resp.SupportedAssets[a.String()] = &gctrpc.PairsSupported{
EnabledPairs: exchCfg.CurrencyPairs.Get(a).Enabled.Join(),
AvailablePairs: exchCfg.CurrencyPairs.Get(a).Available.Join(),
}
}
return resp, nil
}
// GetTicker returns the ticker for a specified exchange, currency pair and