Skip to content

Commit

Permalink
chore: clean up [#2]
Browse files Browse the repository at this point in the history
  • Loading branch information
nickatnight committed Nov 25, 2024
1 parent 2ba87dc commit 235bcf8
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 63 deletions.
2 changes: 0 additions & 2 deletions birdeyepy/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from .defi import DeFi
from .token import Token
from .trader import Trader
from .wallet import Wallet


RESOURCE_MAP = {
"defi": DeFi,
"token": Token,
"trader": Trader,
"wallet": Wallet,
}
60 changes: 51 additions & 9 deletions docs/source/code_overview/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BirdEye Client
resources/defi
resources/token
resources/trader
resources/wallet


.. note::
Expand All @@ -25,19 +26,19 @@ APIs
from birdeyepy import BirdEye
client = BirdEye(api_key="your-api-key")
client = BirdEye(api_key="your-api-key") # 'x-chain' header defaults to solana
# 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 @@ -50,13 +51,54 @@ APIs
# TOKEN
# https://public-api.birdeye.so/defi/tokenlist
# https://docs.birdeye.so/reference/get_defi-tokenlist
client.token.list_all()
# TRADER
# https://docs.birdeye.so/reference/get_defi-token-security
client.token.security(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://docs.birdeye.so/reference/get_trader-gainers-losers
client.trader.gainers_losers()
# https://docs.birdeye.so/reference/get_defi-token-overview
client.token.overview(address="Gr11mosZNZjwpqnemXNnWs9E2Bnv7R6vzaKwJTdjo8zQ")
# https://public-api.birdeye.so/trader/txs/seek_by_time
client.trader.seek_by_time(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")
8 changes: 8 additions & 0 deletions docs/source/code_overview/resources/wallet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Wallet (Beta)
=============

.. note::
This API is still in beta according to the BirdEye API documentation. It is not available on the BirdEye client, so you will have to import it manually.

.. autoclass:: birdeyepy.resources.wallet.Wallet
:members:
51 changes: 1 addition & 50 deletions docs/source/getting_started/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Get the price of a token on the Solana blockchain
from birdeyepy import BirdEye
client = BirdEye(api_key="your-api-key") # 'x-chain' header defaults to solana
client = BirdEye(api_key="your-api-key") # 'x-chain' header defaults to solana
# DEFI
Expand Down Expand Up @@ -35,55 +35,6 @@ Get the price of a token on the Solana blockchain
# 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

.. code-block:: python
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/resources/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def test_wallet_transaction_history_api_called_with_expected_args() -> None:

# Act
client = Wallet(http=mock_http)
client.transaction_history(wallet="test")
client.transaction_history(wallet="test", before="test")

# Assert
mock_http.send.assert_called_once_with(
path=BirdEyeApiUrls.WALLET_TRANSACTION_HISTORY,
params={"wallet": "test", "limit": 100},
params={"wallet": "test", "before": "test", "limit": 100},
)


Expand Down

0 comments on commit 235bcf8

Please sign in to comment.