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

REFACTOR: [okx] refactor kline api #1507

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

bailantaotao
Copy link
Collaborator

No description provided.

@bbgokarma-bot
Copy link

Welcome back! @bailantaotao, This pull request may get 877 BBG.

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 58 lines in your changes are missing coverage. Please review.

Comparison is base (bfbf415) 21.79% compared to head (d2b45f5) 21.82%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1507      +/-   ##
==========================================
+ Coverage   21.79%   21.82%   +0.02%     
==========================================
  Files         602      603       +1     
  Lines       43914    43799     -115     
==========================================
- Hits         9569     9557      -12     
+ Misses      33650    33560      -90     
+ Partials      695      682      -13     
Files Coverage Δ
pkg/exchange/okex/okexapi/market.go 0.00% <ø> (ø)
pkg/exchange/okex/parse.go 82.46% <100.00%> (+11.47%) ⬆️
pkg/exchange/okex/stream.go 0.00% <0.00%> (ø)
pkg/exchange/okex/exchange.go 0.00% <0.00%> (ø)
pkg/exchange/okex/okexapi/get_candles_request.go 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfbf415...d2b45f5. Read the comment docs.

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 901 BBG

@CLAassistant
Copy link

CLAassistant commented Jan 24, 2024

CLA assistant check
All committers have signed the CLA.

@@ -54,7 +55,8 @@ var ErrSymbolRequired = errors.New("symbol is a required parameter")
type Exchange struct {
key, secret, passphrase string

client *okexapi.RestClient
client *okexapi.RestClient
bizClient *okexapi.RestClient
Copy link
Owner

Choose a reason for hiding this comment

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

what's bizClient? this is not used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh no! You found it.

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 927 BBG

return nil, fmt.Errorf("unexpected kline length: %d, data: %q", len(raw), raw)
}
var kline KLine
if err = json.Unmarshal(raw[0], &kline.StartTime); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

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

I found you can actually use []fixedpoint.Value to unmarshal it? since all the fields are numbers in string format?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, all the types are strings.

{
    "code":"0",
    "msg":"",
    "data":[
     [
        "1597026383085",
        "3.721",
        "3.743",
        "3.677",
        "3.708",
        "8422410",
        "22698348.04828491",
        "12698348.04828491",
        "0"
    ],
    [
        "1597026383085",
        "3.731",
        "3.799",
        "3.494",
        "3.72",
        "24912403",
        "67632347.24399722",
        "37632347.24399722",
        "1"
    ]
    ]
}

https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks

// VolumeInCurrencyQuote Trading volume, the value is the quantity in quote currency
// e.g. The unit is USDT for BTC-USDT and BTC-USDT-SWAP;
// The unit is USD for BTC-USD-SWAP
VolumeInCurrencyQuote fixedpoint.Value
Copy link
Owner

Choose a reason for hiding this comment

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

this field could overflow, maybe use float64 for now?

Copy link
Owner

Choose a reason for hiding this comment

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

or maybe not now :p

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, i will skip it

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 973 BBG

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 988 BBG

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 993 BBG

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 998 BBG

@bailantaotao bailantaotao merged commit 2d3f8fb into main Jan 30, 2024
4 of 5 checks passed
@bailantaotao bailantaotao deleted the edwin/okx/refactor-kline-api branch January 30, 2024 01:33
@bbgokarma-bot
Copy link

Hi @bailantaotao,

Well done! 1003 BBG has been sent to your polygon wallet. Please check the following tx:

https://polygonscan.com/tx/0x0cc2f38919153b2d6cf5b70d2e628d3be58b1e4625e64fc2af9a8a7bcdc60336

Thank you for your contribution!

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