mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 15:10:03 +00:00
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:
@@ -26,9 +26,9 @@ type TickerResponse struct {
|
||||
// MarketDepthResponse stores arrays for asks, bids and a timestamp for a currecy pair
|
||||
type MarketDepthResponse struct {
|
||||
ErrCapture `json:",omitempty"`
|
||||
Asks [][]float64 `json:"asks"`
|
||||
Bids [][]float64 `json:"bids"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Asks [][]string `json:"asks"`
|
||||
Bids [][]string `json:"bids"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// TradeResponse stores date_ms, amount, price, type, tid for a currency pair
|
||||
|
||||
@@ -248,19 +248,38 @@ func (l *Lbank) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbo
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a, err := l.GetMarketDepths(fpair.String(), "60", "1")
|
||||
if err != nil {
|
||||
return orderBook, err
|
||||
}
|
||||
for i := range a.Asks {
|
||||
price, convErr := strconv.ParseFloat(a.Asks[i][0], 64)
|
||||
if convErr != nil {
|
||||
return orderBook, convErr
|
||||
}
|
||||
amount, convErr := strconv.ParseFloat(a.Asks[i][1], 64)
|
||||
if convErr != nil {
|
||||
return orderBook, convErr
|
||||
}
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.Item{
|
||||
Price: a.Asks[i][0],
|
||||
Amount: a.Asks[i][1]})
|
||||
Price: price,
|
||||
Amount: amount,
|
||||
})
|
||||
}
|
||||
for i := range a.Bids {
|
||||
price, convErr := strconv.ParseFloat(a.Bids[i][0], 64)
|
||||
if convErr != nil {
|
||||
return orderBook, convErr
|
||||
}
|
||||
amount, convErr := strconv.ParseFloat(a.Bids[i][1], 64)
|
||||
if convErr != nil {
|
||||
return orderBook, convErr
|
||||
}
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.Item{
|
||||
Price: a.Bids[i][0],
|
||||
Amount: a.Bids[i][1]})
|
||||
Price: price,
|
||||
Amount: amount,
|
||||
})
|
||||
}
|
||||
orderBook.Pair = p
|
||||
orderBook.ExchangeName = l.Name
|
||||
|
||||
Reference in New Issue
Block a user