Skip to content

Conversation

@pcriadoperez
Copy link
Collaborator

@pcriadoperez pcriadoperez commented Dec 25, 2024

This PR looks to create a script that scrapes the changelog of binance for all exisitng endpoints, and generates the code in python-binance for those missing endpoints.

  • Searches latest docs changelog for existing endpoints
  • Adds to Endpoints.md
  • Checks if endpoint already exists if not it adds function to client.py and async_client.py
  • Adds docs specifying an autogenerated function
  • Once functions are created they can be edited and changed and won't autogenerate again.

Known issues:

  • Assumes all endpoints are private.
  • I tried for each endpoint to find the website to autogenerate the docs using openAI and to see if it's a signed or not, however I removed the feature as for a lot of the endpoints that show in the changelog there is no spec or doc available.
  • Missing /futures prefix, I will add in a future PR as larger change is needed to admit prefix.

Alternative considered:

Instead of trying to search if the current function exists with a different name, it might be an interesting alternative to autogenerate all endpoints with default name for consistency.

Logs:

Found 4 deprecated endpoints in the docs.
Found 587 unique endpoints in the docs.
Filtered out 8 endpoints that don't match known prefixes
Remaining endpoints: 579
Added 431 endpoints to Endpoints.md
284 endpoints were added out of 579 scrapped in client.py
285 endpoints were added out of 579 scrapped in async_client.py

@pcriadoperez pcriadoperez marked this pull request as ready for review December 26, 2024 00:59
@pcriadoperez pcriadoperez self-assigned this Dec 26, 2024
@coveralls
Copy link

coveralls commented Dec 26, 2024

Coverage Status

coverage: 66.573% (-2.4%) from 68.96%
when pulling 47396b8 on pcriadoperez:generated-endpoints
into d8e2ce1 on sammchardy:master.

@carlosmiei
Copy link
Collaborator

Known issues:
Assumes all endpoints are private.

Hum this is problematic 🤔

@pcriadoperez
Copy link
Collaborator Author

pcriadoperez commented Feb 16, 2025

Known issues:
Assumes all endpoints are private.

Hum this is problematic 🤔

@carlosmiei
I added a check that for GET functions it calls the endpoint to see if it's public or not.
I believe this was able to catch most of the endpoints and assign as public those available. It also helped to clean some deprecated endpoints.

Here are the logs

Found 18 deprecated endpoints in the docs.
Found 574 unique endpoints in the docs.
Filtered out 8 endpoints that don't match known prefixes
Remaining endpoints: 566
Added 417 endpoints to Endpoints.md
271 endpoints were added out of 566 scrapped in client.py
Error calling endpoint _request_api - uiKlines - v3 - {'data': {'symbol': 'BTCUSDT'}}
Error calling endpoint _request_options_api - openInterest - None - {}
Error calling endpoint _request_margin_api - broker/subAccount/deposit - 1 - {}
Error calling endpoint _request_margin_api - mining/hash-transfer/config/details - 1 - {}
Error calling endpoint _request_api - uiKlines - v3 - {'data': {'symbol': 'BTCUSDT'}}
Error calling endpoint _request_options_api - openInterest - None - {}
Error calling endpoint _request_margin_api - broker/subAccount/deposit - 1 - {}
Error calling endpoint _request_margin_api - mining/hash-transfer/config/details - 1 - {}
290 endpoints were added out of 566 scrapped in async_client.py

The erros were for 2 reasons:

@pcriadoperez pcriadoperez reopened this Feb 21, 2025
@carlosmiei carlosmiei merged commit b02989d into sammchardy:master Feb 24, 2025
17 of 23 checks passed
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.

3 participants