Skip to content
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

[R4R] add levels parameter to depth ABCI query #639

Merged
merged 1 commit into from
Aug 12, 2019
Merged

Conversation

ackratos
Copy link
Contributor

@ackratos ackratos commented Aug 4, 2019

Description

add levels parameter to depth ABCI query
@guagualvcha should change http-ap, but this change is compatible with current http-ap if he doesn't :)
WebSocket change: https://github.com/binance-chain/websocket-ap/pull/100

Rationale

websocket needs to snapshot more levels

Example

N/A

Changes

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • integration tests passed (make integration_test)
  • manual transaction test passed (cli invoke)

Already reviewed by

...

Related issues

N/A

Pressure test: @ackratos @zjubfd see the results of depth api using larger limit, https://docs.google.com/spreadsheets/d/147NYJa38FRvXgMnKrUHIfarmg8FYylOmhpCPG9E3MCk/edit?usp=sharing

@ackratos ackratos self-assigned this Aug 4, 2019
@ackratos ackratos changed the title add levels parameter to depth ABCI query [R4R] add levels parameter to depth ABCI query Aug 4, 2019
@unclezoro
Copy link
Collaborator

get it. Go-sdk and http-ap will have change too.

@@ -13,7 +13,7 @@ import (
"github.com/binance-chain/node/wire"
)

const allowedLimits = "5,10,20,50,100"
const allowedLimits = "5,10,20,50,100,500,1000" // consistent with mainsite: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#market-data-endpoints
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the comment

done

@@ -13,7 +13,7 @@ import (
"github.com/binance-chain/node/wire"
)

const allowedLimits = "5,10,20,50,100"
const allowedLimits = "5,10,20,50,100,500,1000" // consistent with mainsite: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#market-data-endpoints
const defaultLimit = "100"

// DepthReqHandler creates an http request handler to show market depth data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

help fix the allowedLimitsA check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

help fix the allowedLimitsA check

okay okay

levelLimit := DefaultDepthLevels
if len(path) == 4 {
levelLimit, err := strconv.Atoi(path[3])
if err != nil || levelLimit > MaxDepthLevels {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

levelLimit should be larger than 0.

we should return err in the Log if the err is not nil.

@@ -114,8 +115,9 @@ func showOrderBookCmd(cdc *wire.Codec) *cobra.Command {
if err != nil {
return err
}
levelsLimit := viper.GetInt(flagLevels)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better check levelLimit here as well.

@ackratos ackratos force-pushed the max_depth branch 2 times, most recently from 9300411 to a3271b9 Compare August 12, 2019 03:40
@ackratos ackratos merged commit 52adabd into develop Aug 12, 2019
This was referenced Aug 12, 2019
@unclezoro unclezoro deleted the max_depth branch May 10, 2022 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants