Skip to content

Commit

Permalink
docs: add usage examples to quickstart docs [#3]
Browse files Browse the repository at this point in the history
  • Loading branch information
nickatnight committed Nov 24, 2024
1 parent be7beb6 commit ec6c163
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</p>

## Features
- 🪙 **BirdEye** Only supports [standard](https://docs.birdeye.so/docs/data-accessibility-by-packages#1-standard-package) subscription api urls (package is still in active development)
- 🪙 **BirdEye** Supports all BirdEye data services [apis](https://docs.birdeye.so/docs/overview).
- ♻️ **Retry Strategy** Sensible defaults to reliably retry/back-off fetching data from the api
- ✏️ **Code Formatting** Fully typed with [mypy](https://mypy-lang.org/) and code formatters [black](https://github.com/psf/black) / [isort](https://pycqa.github.io/isort/)
- ⚒️ **Modern tooling** using [uv](https://docs.astral.sh/uv/), [ruff](https://docs.astral.sh/ruff/), and [pre-commit](https://pre-commit.com/)
Expand Down
2 changes: 1 addition & 1 deletion birdeyepy/resources/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def trending(

def list_all_v2(self) -> dict:
"""This endpoint facilitates the retrieval of a list of tokens on a specified blockchain network. This upgraded version is exclusive to business and enterprise packages. By simply including the header for the requested blockchain without any query parameters, business and enterprise users can get the full list of tokens on the specified blockchain in the URL returned in the response. This removes the need for the limit response of the previous version and reduces the workload of making multiple calls."""
response = self.http.send(path=BirdEyeApiUrls.TOKEN_LIST_V2)
response = self.http.send(path=BirdEyeApiUrls.TOKEN_LIST_V2, method="POST")

return cast(dict, response)

Expand Down
54 changes: 51 additions & 3 deletions docs/source/getting_started/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Get the price of a token on the Solana blockchain
# DEFI
# https://public-api.birdeye.so/defi/price
# https://docs.birdeye.so/reference/get_defi-price
client.defi.price() # defaults to So11111111111111111111111111111111111111112
client.defi.price(
address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ",
include_liquidity=True, # can also use strings 'true' or 'false'
)
# https://public-api.birdeye.so/defi/history_price
# https://docs.birdeye.so/reference/get_defi-history-price
client.defi.history(time_from=1732398942, time_to=1732398961) # defaults to So11111111111111111111111111111111111111112
client.defi.history(
Expand All @@ -32,9 +32,57 @@ Get the price of a token on the Solana blockchain
# TOKEN
# https://public-api.birdeye.so/defi/tokenlist
# https://docs.birdeye.so/reference/get_defi-tokenlist
client.token.list_all()
# https://docs.birdeye.so/reference/get_defi-token-security
client.token.security(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-token-overview
client.token.overview(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-token-creation-info
client.token.creation_info(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-token-trending
client.token.trending()
# https://docs.birdeye.so/reference/post_defi-v2-tokens-all
client.token.list_all_v2()
# https://docs.birdeye.so/reference/get_defi-v2-tokens-new-listing
client.token.new_listing(
time_to=1732398961,
meme_platform_enabled=True, # can also use strings 'true' or 'false'
)
# https://docs.birdeye.so/reference/get_defi-v2-tokens-top-traders
client.token.top_traders(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-v2-markets
client.token.all_markets(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-v3-token-meta-data-single
client.token.market_metadata_single(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-v3-token-meta-data-multiple
client.token.market_metadata_multiple(
addresses=["Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ", "AGQZRtz7hZtz3VJ1CoXRMNMyh2ZMZ1g6pv4aGMUSpump"],
) # can also use comma separated strings 'Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ,AGQZRtz7hZtz3VJ1CoXRMNMyh2ZMZ1g6pv4aGMUSpump'
# https://docs.birdeye.so/reference/get_defi-v3-token-market-data
client.token.market_data(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-v3-token-trade-data-single
client.token.trade_data_single(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_defi-v3-token-trade-data-multiple
client.token.trade_data_multiple(
addresses=["Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ", "AGQZRtz7hZtz3VJ1CoXRMNMyh2ZMZ1g6pv4aGMUSpump"],
) # can also use comma separated strings 'Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ,AGQZRtz7hZtz3VJ1CoXRMNMyh2ZMZ1g6pv4aGMUSpump'
# https://docs.birdeye.so/reference/get_defi-v3-token-holder
client.token.holder(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
Get the price of a token on the Ethereum blockchain

Expand Down
1 change: 1 addition & 0 deletions tests/unit/resources/test_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_token_list_all_v2_api_called_with_expected_args() -> None:

# Assert
mock_http.send.assert_called_once_with(
method="POST",
path=BirdEyeApiUrls.TOKEN_LIST_V2,
)

Expand Down

0 comments on commit ec6c163

Please sign in to comment.