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

レスポンスのパースについて再検討 #43

Open
negi-grass opened this issue Mar 19, 2023 · 6 comments
Open

レスポンスのパースについて再検討 #43

negi-grass opened this issue Mar 19, 2023 · 6 comments
Labels
before 1.0.0 This issue should be solved before v1.0.0 breaking This issue or pull request involves a breaking change help wanted Extra attention is needed

Comments

@negi-grass
Copy link
Owner

negi-grass commented Mar 19, 2023

HTTP や WebSocket のレスポンスのパースはもっと一貫性のある洗練されたデザインができそう。

現在の方法だと #12, #37, #40 などの問題がある。

@negi-grass negi-grass added help wanted Extra attention is needed breaking This issue or pull request involves a breaking change before 1.0.0 This issue should be solved before v1.0.0 labels Mar 19, 2023
@negi-grass
Copy link
Owner Author

他のライブラリで一般的だと思うが、レスポンスクラスを作ってそこにjson()等のメソッドをつけるのがよいか。

@negi-grass
Copy link
Owner Author

レスポンスクラスに必要なもの

  • fn text()
  • fn json()
  • fn json_value()
  • fn status()
  • fn headers()

それぞれの取引所向けのデータパース等

  • ?

@negi-grass
Copy link
Owner Author

エラーコード等を統一的に扱いたいが、どうするべきか。

@negi-grass
Copy link
Owner Author

Bybit:

{
    "retCode": 0,
    "retMsg": "OK",
    "result": {
    },
    "retExtInfo": {},
    "time": 1671017382656
}

Binance (エラー時):

{
  "code":-1121,
  "msg":"Invalid symbol."
}

bitFlyer (エラー時、ドキュメントに記載なし):

{
  "status":-100,
  "error_message":"Invalid product",
  "data":null
}

coincheck(エラー時、ドキュメントに記載なし):

{
  "success":false,
  "error":"invalid authentication"
}

@negi-grass
Copy link
Owner Author

現在の generic-api-client は、v0.2 以前のそれぞれの取引所の実装が独立していたときの名残なので、削除しても問題ない。

@negi-grass
Copy link
Owner Author

現在の構造ありきではなく、ユーザーの視点からライブラリの構造を考え直したほうがいいかもしれない。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before 1.0.0 This issue should be solved before v1.0.0 breaking This issue or pull request involves a breaking change help wanted Extra attention is needed
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant