Skip to content

Commit 7144521

Browse files
feat(api): api update
1 parent e819ca9 commit 7144521

90 files changed

Lines changed: 1184 additions & 839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 84
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/coingecko%2Fcoingecko-eb98e136b67fc13d5c247829bb39e6ca26343d39801258f26f92ea25d3f4e3ef.yml
3-
openapi_spec_hash: 04a096ec27eeb369d224c00bccc3bb9b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/coingecko%2Fcoingecko-e88de4e81cdb0547e40a951e747c95e7a9647577d8bee0ce5c5b4643a939ed3f.yml
3+
openapi_spec_hash: d3b574a0f909b96fd93f1f46a2f8efde
44
config_hash: f101f417dba7f9352f7573639dd5938f

CONTRIBUTING.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ $ pip install ./path-to-wheel-file.whl
8585

8686
## Running tests
8787

88-
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
89-
90-
```sh
91-
# you will need npm installed
92-
$ npx prism mock path/to/your/openapi.yml
93-
```
94-
9588
```sh
9689
$ ./scripts/test
9790
```

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ from coingecko_sdk.types import (
714714

715715
Methods:
716716

717-
- <code title="get /{entity}/public_treasury/{coin_id}">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_coin_id</a>(coin_id, \*, entity) -> <a href="./src/coingecko_sdk/types/public_treasury_get_coin_id_response.py">PublicTreasuryGetCoinIDResponse</a></code>
718-
- <code title="get /public_treasury/{entity_id}">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_entity_id</a>(entity_id) -> <a href="./src/coingecko_sdk/types/public_treasury_get_entity_id_response.py">PublicTreasuryGetEntityIDResponse</a></code>
717+
- <code title="get /{entity}/public_treasury/{coin_id}">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_coin_id</a>(coin_id, \*, entity, \*\*<a href="src/coingecko_sdk/types/public_treasury_get_coin_id_params.py">params</a>) -> <a href="./src/coingecko_sdk/types/public_treasury_get_coin_id_response.py">PublicTreasuryGetCoinIDResponse</a></code>
718+
- <code title="get /public_treasury/{entity_id}">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_entity_id</a>(entity_id, \*\*<a href="src/coingecko_sdk/types/public_treasury_get_entity_id_params.py">params</a>) -> <a href="./src/coingecko_sdk/types/public_treasury_get_entity_id_response.py">PublicTreasuryGetEntityIDResponse</a></code>
719719
- <code title="get /public_treasury/{entity_id}/{coin_id}/holding_chart">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_holding_chart</a>(coin_id, \*, entity_id, \*\*<a href="src/coingecko_sdk/types/public_treasury_get_holding_chart_params.py">params</a>) -> <a href="./src/coingecko_sdk/types/public_treasury_get_holding_chart_response.py">PublicTreasuryGetHoldingChartResponse</a></code>
720720
- <code title="get /public_treasury/{entity_id}/transaction_history">client.public_treasury.<a href="./src/coingecko_sdk/resources/public_treasury.py">get_transaction_history</a>(entity_id, \*\*<a href="src/coingecko_sdk/types/public_treasury_get_transaction_history_params.py">params</a>) -> <a href="./src/coingecko_sdk/types/public_treasury_get_transaction_history_response.py">PublicTreasuryGetTransactionHistoryResponse</a></code>
721721

scripts/mock

Lines changed: 0 additions & 41 deletions
This file was deleted.

scripts/test

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,7 @@ set -e
44

55
cd "$(dirname "$0")/.."
66

7-
RED='\033[0;31m'
8-
GREEN='\033[0;32m'
9-
YELLOW='\033[0;33m'
10-
NC='\033[0m' # No Color
117

12-
function prism_is_running() {
13-
curl --silent "http://localhost:4010" >/dev/null 2>&1
14-
}
15-
16-
kill_server_on_port() {
17-
pids=$(lsof -t -i tcp:"$1" || echo "")
18-
if [ "$pids" != "" ]; then
19-
kill "$pids"
20-
echo "Stopped $pids."
21-
fi
22-
}
23-
24-
function is_overriding_api_base_url() {
25-
[ -n "$TEST_API_BASE_URL" ]
26-
}
27-
28-
if ! is_overriding_api_base_url && ! prism_is_running ; then
29-
# When we exit this script, make sure to kill the background mock server process
30-
trap 'kill_server_on_port 4010' EXIT
31-
32-
# Start the dev server
33-
./scripts/mock --daemon
34-
fi
35-
36-
if is_overriding_api_base_url ; then
37-
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
38-
echo
39-
elif ! prism_is_running ; then
40-
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
41-
echo -e "running against your OpenAPI spec."
42-
echo
43-
echo -e "To run the server, pass in the path or url of your OpenAPI"
44-
echo -e "spec to the prism command:"
45-
echo
46-
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
47-
echo
48-
49-
exit 1
50-
else
51-
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
52-
echo
53-
fi
548

559
export DEFER_PYDANTIC_BUILD=false
5610

src/coingecko_sdk/_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
152152
),
153153
response=self.http_response,
154154
client=cast(Any, self._client),
155+
options=self._options,
155156
),
156157
)
157158

@@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
162163
cast_to=extract_stream_chunk_type(self._stream_cls),
163164
response=self.http_response,
164165
client=cast(Any, self._client),
166+
options=self._options,
165167
),
166168
)
167169

@@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
175177
cast_to=cast_to,
176178
response=self.http_response,
177179
client=cast(Any, self._client),
180+
options=self._options,
178181
),
179182
)
180183

src/coingecko_sdk/_streaming.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55
import inspect
66
from types import TracebackType
7-
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast
7+
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
88
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable
99

1010
import httpx
@@ -13,6 +13,7 @@
1313

1414
if TYPE_CHECKING:
1515
from ._client import Coingecko, AsyncCoingecko
16+
from ._models import FinalRequestOptions
1617

1718

1819
_T = TypeVar("_T")
@@ -22,7 +23,7 @@ class Stream(Generic[_T]):
2223
"""Provides the core interface to iterate over a synchronous stream response."""
2324

2425
response: httpx.Response
25-
26+
_options: Optional[FinalRequestOptions] = None
2627
_decoder: SSEBytesDecoder
2728

2829
def __init__(
@@ -31,10 +32,12 @@ def __init__(
3132
cast_to: type[_T],
3233
response: httpx.Response,
3334
client: Coingecko,
35+
options: Optional[FinalRequestOptions] = None,
3436
) -> None:
3537
self.response = response
3638
self._cast_to = cast_to
3739
self._client = client
40+
self._options = options
3841
self._decoder = client._make_sse_decoder()
3942
self._iterator = self.__stream__()
4043

@@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]):
8588
"""Provides the core interface to iterate over an asynchronous stream response."""
8689

8790
response: httpx.Response
88-
91+
_options: Optional[FinalRequestOptions] = None
8992
_decoder: SSEDecoder | SSEBytesDecoder
9093

9194
def __init__(
@@ -94,10 +97,12 @@ def __init__(
9497
cast_to: type[_T],
9598
response: httpx.Response,
9699
client: AsyncCoingecko,
100+
options: Optional[FinalRequestOptions] = None,
97101
) -> None:
98102
self.response = response
99103
self._cast_to = cast_to
100104
self._client = client
105+
self._options = options
101106
self._decoder = client._make_sse_decoder()
102107
self._iterator = self.__stream__()
103108

src/coingecko_sdk/resources/coins/markets.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get(
4949
vs_currency: str,
5050
category: str | Omit = omit,
5151
ids: str | Omit = omit,
52+
include_rehypothecated: bool | Omit = omit,
5253
include_tokens: Literal["top", "all"] | Omit = omit,
5354
locale: Literal[
5455
"ar",
@@ -139,6 +140,9 @@ def get(
139140
ids: coins' IDs, comma-separated if querying more than 1 coin. \\**refers to
140141
[`/coins/list`](/reference/coins-list).
141142
143+
include_rehypothecated: include rehypothecated tokens in results, default: false When true, returns
144+
`market_cap_rank_with_rehypothecated` field
145+
142146
include_tokens: for `symbols` lookups, specify `all` to include all matching tokens Default
143147
`top` returns top-ranked tokens (by market cap or volume)
144148
@@ -181,6 +185,7 @@ def get(
181185
"vs_currency": vs_currency,
182186
"category": category,
183187
"ids": ids,
188+
"include_rehypothecated": include_rehypothecated,
184189
"include_tokens": include_tokens,
185190
"locale": locale,
186191
"names": names,
@@ -225,6 +230,7 @@ async def get(
225230
vs_currency: str,
226231
category: str | Omit = omit,
227232
ids: str | Omit = omit,
233+
include_rehypothecated: bool | Omit = omit,
228234
include_tokens: Literal["top", "all"] | Omit = omit,
229235
locale: Literal[
230236
"ar",
@@ -315,6 +321,9 @@ async def get(
315321
ids: coins' IDs, comma-separated if querying more than 1 coin. \\**refers to
316322
[`/coins/list`](/reference/coins-list).
317323
324+
include_rehypothecated: include rehypothecated tokens in results, default: false When true, returns
325+
`market_cap_rank_with_rehypothecated` field
326+
318327
include_tokens: for `symbols` lookups, specify `all` to include all matching tokens Default
319328
`top` returns top-ranked tokens (by market cap or volume)
320329
@@ -357,6 +366,7 @@ async def get(
357366
"vs_currency": vs_currency,
358367
"category": category,
359368
"ids": ids,
369+
"include_rehypothecated": include_rehypothecated,
360370
"include_tokens": include_tokens,
361371
"locale": locale,
362372
"names": names,

src/coingecko_sdk/resources/onchain/networks/tokens/pools.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get(
4949
*,
5050
network: str,
5151
include: str | Omit = omit,
52+
include_gt_community_data: bool | Omit = omit,
5253
include_inactive_source: bool | Omit = omit,
5354
page: int | Omit = omit,
5455
sort: Literal["h24_volume_usd_liquidity_desc", "h24_tx_count_desc", "h24_volume_usd_desc"] | Omit = omit,
@@ -67,6 +68,9 @@ def get(
6768
include: attributes to include, comma-separated if more than one to include Available
6869
values: `base_token`, `quote_token`, `dex`
6970
71+
include_gt_community_data: include GeckoTerminal community data (Sentiment votes, Suspicious reports)
72+
Default value: false
73+
7074
include_inactive_source: include tokens from inactive pools using the most recent swap, default: false
7175
7276
page: page through results Default value: 1
@@ -95,6 +99,7 @@ def get(
9599
query=maybe_transform(
96100
{
97101
"include": include,
102+
"include_gt_community_data": include_gt_community_data,
98103
"include_inactive_source": include_inactive_source,
99104
"page": page,
100105
"sort": sort,
@@ -132,6 +137,7 @@ async def get(
132137
*,
133138
network: str,
134139
include: str | Omit = omit,
140+
include_gt_community_data: bool | Omit = omit,
135141
include_inactive_source: bool | Omit = omit,
136142
page: int | Omit = omit,
137143
sort: Literal["h24_volume_usd_liquidity_desc", "h24_tx_count_desc", "h24_volume_usd_desc"] | Omit = omit,
@@ -150,6 +156,9 @@ async def get(
150156
include: attributes to include, comma-separated if more than one to include Available
151157
values: `base_token`, `quote_token`, `dex`
152158
159+
include_gt_community_data: include GeckoTerminal community data (Sentiment votes, Suspicious reports)
160+
Default value: false
161+
153162
include_inactive_source: include tokens from inactive pools using the most recent swap, default: false
154163
155164
page: page through results Default value: 1
@@ -178,6 +187,7 @@ async def get(
178187
query=await async_maybe_transform(
179188
{
180189
"include": include,
190+
"include_gt_community_data": include_gt_community_data,
181191
"include_inactive_source": include_inactive_source,
182192
"page": page,
183193
"sort": sort,

src/coingecko_sdk/resources/onchain/networks/tokens/top_holders.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def get(
4747
*,
4848
network: str,
4949
holders: str | Omit = omit,
50+
include_pnl_details: bool | Omit = omit,
5051
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5152
# The extra values given here take precedence over values defined on the client or passed to this method.
5253
extra_headers: Headers | None = None,
@@ -62,6 +63,8 @@ def get(
6263
holders: number of top token holders to return, you may use any integer or `max` Default
6364
value: 10
6465
66+
include_pnl_details: include PnL details for token holders, default: false
67+
6568
extra_headers: Send extra headers
6669
6770
extra_query: Add additional query parameters to the request
@@ -81,7 +84,13 @@ def get(
8184
extra_query=extra_query,
8285
extra_body=extra_body,
8386
timeout=timeout,
84-
query=maybe_transform({"holders": holders}, top_holder_get_params.TopHolderGetParams),
87+
query=maybe_transform(
88+
{
89+
"holders": holders,
90+
"include_pnl_details": include_pnl_details,
91+
},
92+
top_holder_get_params.TopHolderGetParams,
93+
),
8594
),
8695
cast_to=TopHolderGetResponse,
8796
)
@@ -113,6 +122,7 @@ async def get(
113122
*,
114123
network: str,
115124
holders: str | Omit = omit,
125+
include_pnl_details: bool | Omit = omit,
116126
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
117127
# The extra values given here take precedence over values defined on the client or passed to this method.
118128
extra_headers: Headers | None = None,
@@ -128,6 +138,8 @@ async def get(
128138
holders: number of top token holders to return, you may use any integer or `max` Default
129139
value: 10
130140
141+
include_pnl_details: include PnL details for token holders, default: false
142+
131143
extra_headers: Send extra headers
132144
133145
extra_query: Add additional query parameters to the request
@@ -147,7 +159,13 @@ async def get(
147159
extra_query=extra_query,
148160
extra_body=extra_body,
149161
timeout=timeout,
150-
query=await async_maybe_transform({"holders": holders}, top_holder_get_params.TopHolderGetParams),
162+
query=await async_maybe_transform(
163+
{
164+
"holders": holders,
165+
"include_pnl_details": include_pnl_details,
166+
},
167+
top_holder_get_params.TopHolderGetParams,
168+
),
151169
),
152170
cast_to=TopHolderGetResponse,
153171
)

0 commit comments

Comments
 (0)