Conversation
📝 WalkthroughWalkthroughThis PR introduces spot trade bust functionality to the SDK. New models Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
|
🤖 SDK Version Check ✅ Version check passed
|
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sdk/open_api/__init__.py (1)
10-17:⚠️ Potential issue | 🟡 MinorBump
sdk.open_api.__version__with this 2.1.5 regen.The module docstring now reports 2.1.5, but Line 17 still exposes
2.1.4.0. That leaves runtime version reporting out of sync with the generated models and endpoints shipped by this PR.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@sdk/open_api/__init__.py` around lines 10 - 17, Update the module-level __version__ constant to match the regenerated OpenAPI document version; change __version__ in sdk.open_api.__init__ from "2.1.4.0" to the regenerated version "2.1.5" (update the __version__ symbol so runtime version reporting matches the docstring and generated models/endpoints).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@sdk/async_api/market_spot_trade_bust_update_payload.py`:
- Around line 2-10: Replace the typing.List usage with Python 3.12 built-in
generics and clean up unused typing imports: change the type annotation for
MarketSpotTradeBustUpdatePayload.data from List[SpotTradeBust] to
list[SpotTradeBust], remove the now-unused List (and any other unused imports
like Any/Dict/Optional) from the top-of-file imports, and keep the rest of the
model (fields type names and Field(...) usage) unchanged.
In `@sdk/async_api/spot_trade_bust.py`:
- Around line 3-15: The SpotTradeBust Pydantic model exposes snake_case
attributes but lacks a Pydantic v2 config to allow construction using those
names; add a model_config = {"populate_by_name": True} to the SpotTradeBust
class so callers can instantiate with account_id, counterparty_account_id,
transaction_hash (and existing alias fields still function). This change should
be made on the SpotTradeBust class (the BaseModel subclass) alongside the
existing fields (symbol, account_id/accountId alias,
counterparty_account_id/counterpartyAccountId alias,
transaction_hash/transactionHash alias).
- Around line 29-47: The pre-validator unwrap_additional_properties assumes
non-dict inputs implement model_dump and that additional_properties is a dict;
guard by first checking if data is a dict and if not, only try to call
data.model_dump() when hasattr(data, "model_dump"), otherwise return data
unchanged so scalars/None/lists bypass this unwrapping; then ensure
additional_properties = data.get('additional_properties') and if it's None or
not isinstance(additional_properties, dict) set it to {} before merging unknown
keys; also prefer Python "in" checks (e.g., if obj_key not in
known_json_properties) when iterating unknown_object_properties in
unwrap_additional_properties.
In `@sdk/async_api/wallet_spot_trade_bust_update_payload.py`:
- Around line 2-10: The payload model WalletSpotTradeBustUpdatePayload is using
typing.List which triggers UP035; change the data field to use the built-in
generic list[SpotTradeBust] instead of List[SpotTradeBust], update the import
list to remove List (keep Any, Dict, Optional only if used) and ensure the Field
declaration for data remains the same; this replaces the typing generic with
Python 3.12+ built-in generics while leaving the class name, type annotations
(type, timestamp, channel), and SpotTradeBust reference unchanged.
In `@sdk/open_api/api/market_data_api.py`:
- Around line 1218-1225: The generated endpoint stub uses old-style typing
(Union[...]) for the parameter _request_timeout in market_data_api.py; update
the OpenAPI generator template or add a post-processing step so generated
signatures use Python 3.10+ union syntax (e.g., replace Union[...] with the pipe
operator) and stop emitting typing_extensions/typing.List style imports—ensure
the generator produces annotations like None | float | tuple[float, float] for
_request_timeout and that model imports target built-in typing for Python 3.12
compatibility rather than typing_extensions.
In `@sdk/open_api/configuration.py`:
- Around line 496-500: The debug report return currently hard-codes "SDK Package
Version: 2.1.4.0" and uses implicit multi-line string concatenation; update the
return expression in configuration.py to use the canonical
sdk.open_api.__version__ value instead of the literal and collapse the
multi-line strings into a single parenthesized string expression (e.g., return
("Python SDK Debug Report:\nOS: {env}\nPython Version: {pyversion}\nVersion of
the API: 2.1.5\nSDK Package Version: " + sdk.open_api.__version__)). Ensure you
import or reference sdk.open_api.__version__ where this return is defined so the
debug report always reflects the package metadata and removes the Ruff ISC002
warning.
In `@sdk/reya_rest_api/client.py`:
- Around line 708-722: The get_spot_trade_busts wrapper currently hardcodes the
call and prevents callers from using the wallet endpoint's pagination/time
filters; update ReyaTradingClient.get_spot_trade_busts to accept optional
parameters (e.g., start_time, end_time, page, page_size) and forward them to
self.wallet.get_wallet_spot_trade_busts(address=wallet, start_time=start_time,
end_time=end_time, page=page, page_size=page_size), preserving existing behavior
when arguments are None and validating wallet via self.owner_wallet_address as
before.
---
Outside diff comments:
In `@sdk/open_api/__init__.py`:
- Around line 10-17: Update the module-level __version__ constant to match the
regenerated OpenAPI document version; change __version__ in
sdk.open_api.__init__ from "2.1.4.0" to the regenerated version "2.1.5" (update
the __version__ symbol so runtime version reporting matches the docstring and
generated models/endpoints).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4fa2a381-7d42-493b-85c0-159c1f9c5d7a
📒 Files selected for processing (58)
.openapi-generator/FILESsdk/async_api/market_spot_trade_bust_update_payload.pysdk/async_api/spot_trade_bust.pysdk/async_api/wallet_spot_trade_bust_update_payload.pysdk/open_api/__init__.pysdk/open_api/api/market_data_api.pysdk/open_api/api/order_entry_api.pysdk/open_api/api/reference_data_api.pysdk/open_api/api/specs_api.pysdk/open_api/api/wallet_data_api.pysdk/open_api/api_client.pysdk/open_api/configuration.pysdk/open_api/exceptions.pysdk/open_api/models/__init__.pysdk/open_api/models/account.pysdk/open_api/models/account_balance.pysdk/open_api/models/account_type.pysdk/open_api/models/asset_definition.pysdk/open_api/models/cancel_order_request.pysdk/open_api/models/cancel_order_response.pysdk/open_api/models/candle_history_data.pysdk/open_api/models/create_order_request.pysdk/open_api/models/create_order_response.pysdk/open_api/models/depth.pysdk/open_api/models/depth_type.pysdk/open_api/models/execution_type.pysdk/open_api/models/fee_tier_parameters.pysdk/open_api/models/global_fee_parameters.pysdk/open_api/models/level.pysdk/open_api/models/liquidity_parameters.pysdk/open_api/models/market_definition.pysdk/open_api/models/market_summary.pysdk/open_api/models/mass_cancel_request.pysdk/open_api/models/mass_cancel_response.pysdk/open_api/models/order.pysdk/open_api/models/order_status.pysdk/open_api/models/order_type.pysdk/open_api/models/pagination_meta.pysdk/open_api/models/perp_execution.pysdk/open_api/models/perp_execution_list.pysdk/open_api/models/position.pysdk/open_api/models/price.pysdk/open_api/models/request_error.pysdk/open_api/models/request_error_code.pysdk/open_api/models/server_error.pysdk/open_api/models/server_error_code.pysdk/open_api/models/side.pysdk/open_api/models/spot_execution.pysdk/open_api/models/spot_execution_list.pysdk/open_api/models/spot_market_definition.pysdk/open_api/models/spot_trade_bust.pysdk/open_api/models/spot_trade_bust_list.pysdk/open_api/models/tier_type.pysdk/open_api/models/time_in_force.pysdk/open_api/models/wallet_configuration.pysdk/open_api/rest.pysdk/reya_rest_api/client.pyspecs
| from typing import Any, List, Dict, Optional | ||
| from pydantic import BaseModel, Field | ||
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | ||
| from sdk.async_api.spot_trade_bust import SpotTradeBust | ||
| class MarketSpotTradeBustUpdatePayload(BaseModel): | ||
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | ||
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | ||
| channel: str = Field(description='''Channel pattern for market spot trade busts''') | ||
| data: List[SpotTradeBust] = Field() |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Use built-in generics in this new payload model.
Ruff is already flagging UP035 here. With the repo's Python 3.12 baseline, list[SpotTradeBust] should replace List[SpotTradeBust] in new code.
♻️ Minimal cleanup
-from typing import Any, List, Dict, Optional
from pydantic import BaseModel, Field
from sdk.async_api.channel_data_message_type import ChannelDataMessageType
from sdk.async_api.spot_trade_bust import SpotTradeBust
class MarketSpotTradeBustUpdatePayload(BaseModel):
type: ChannelDataMessageType = Field(description='''Message type for channel data updates''')
timestamp: float = Field(description='''Update timestamp (milliseconds)''')
channel: str = Field(description='''Channel pattern for market spot trade busts''')
- data: List[SpotTradeBust] = Field()
+ data: list[SpotTradeBust] = Field()As per coding guidelines, "Require Python 3.12+ for runtime and Python 3.10 for type checking with strict mypy configuration".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| from typing import Any, List, Dict, Optional | |
| from pydantic import BaseModel, Field | |
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | |
| from sdk.async_api.spot_trade_bust import SpotTradeBust | |
| class MarketSpotTradeBustUpdatePayload(BaseModel): | |
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | |
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | |
| channel: str = Field(description='''Channel pattern for market spot trade busts''') | |
| data: List[SpotTradeBust] = Field() | |
| from pydantic import BaseModel, Field | |
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | |
| from sdk.async_api.spot_trade_bust import SpotTradeBust | |
| class MarketSpotTradeBustUpdatePayload(BaseModel): | |
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | |
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | |
| channel: str = Field(description='''Channel pattern for market spot trade busts''') | |
| data: list[SpotTradeBust] = Field() |
🧰 Tools
🪛 Ruff (0.15.5)
[warning] 2-2: typing.List is deprecated, use list instead
(UP035)
[warning] 2-2: typing.Dict is deprecated, use dict instead
(UP035)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/async_api/market_spot_trade_bust_update_payload.py` around lines 2 - 10,
Replace the typing.List usage with Python 3.12 built-in generics and clean up
unused typing imports: change the type annotation for
MarketSpotTradeBustUpdatePayload.data from List[SpotTradeBust] to
list[SpotTradeBust], remove the now-unused List (and any other unused imports
like Any/Dict/Optional) from the top-of-file imports, and keep the rest of the
model (fields type names and Field(...) usage) unchanged.
| from pydantic import model_serializer, model_validator, BaseModel, Field | ||
| from sdk.async_api.side import Side | ||
| class SpotTradeBust(BaseModel): | ||
| symbol: str = Field(description='''Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)''') | ||
| account_id: int = Field(alias='''accountId''') | ||
| counterparty_account_id: int = Field(alias='''counterpartyAccountId''') | ||
| qty: str = Field() | ||
| side: Side = Field(description='''Order side (B = Buy/Bid, A = Ask/Sell)''') | ||
| price: str = Field() | ||
| reason: str = Field(description='''Hex-encoded revert reason bytes''') | ||
| timestamp: int = Field() | ||
| transaction_hash: str = Field(description='''Transaction hash''', alias='''transactionHash''') | ||
| additional_properties: Optional[dict[str, Any]] = Field(default=None, exclude=True) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's locate and examine the async spot trade bust file
find . -name "spot_trade_bust.py" -type fRepository: Reya-Labs/reya-python-sdk
Length of output: 144
🏁 Script executed:
# Now let's examine the async model file to see lines 3-15 and the full file
cat -n sdk/async_api/spot_trade_bust.py | head -50Repository: Reya-Labs/reya-python-sdk
Length of output: 2819
🏁 Script executed:
# Let's check the OpenAPI counterpart for comparison
cat -n sdk/open_api/models/spot_trade_bust.py | head -80Repository: Reya-Labs/reya-python-sdk
Length of output: 3737
🏁 Script executed:
# Check if model_config is used elsewhere in the async_api directory
rg "model_config\s*=" sdk/async_api/ -A 2Repository: Reya-Labs/reya-python-sdk
Length of output: 51
🏁 Script executed:
# Let's verify Pydantic v2 behavior with aliases and populate_by_name
python3 << 'EOF'
from pydantic import BaseModel, Field, ConfigDict
# Test case 1: Without populate_by_name (like the async model)
class ModelWithoutPopulate(BaseModel):
account_id: int = Field(alias='accountId')
# Test case 2: With populate_by_name (like the OpenAPI model)
class ModelWithPopulate(BaseModel):
model_config = ConfigDict(populate_by_name=True)
account_id: int = Field(alias='accountId')
print("Test 1: Without populate_by_name")
try:
m1 = ModelWithoutPopulate(account_id=123)
print(f" Success: {m1}")
except Exception as e:
print(f" Failed: {type(e).__name__}: {e}")
try:
m1 = ModelWithoutPopulate(accountId=123)
print(f" Success with alias: {m1}")
except Exception as e:
print(f" Failed with alias: {type(e).__name__}: {e}")
print("\nTest 2: With populate_by_name")
try:
m2 = ModelWithPopulate(account_id=123)
print(f" Success: {m2}")
except Exception as e:
print(f" Failed: {type(e).__name__}: {e}")
try:
m2 = ModelWithPopulate(accountId=123)
print(f" Success with alias: {m2}")
except Exception as e:
print(f" Failed with alias: {type(e).__name__}: {e}")
EOFRepository: Reya-Labs/reya-python-sdk
Length of output: 472
🏁 Script executed:
# Check if there are any existing usages of SpotTradeBust in async_api that might reveal the issue
rg "SpotTradeBust" sdk/async_api/ -B 2 -A 5Repository: Reya-Labs/reya-python-sdk
Length of output: 2707
🏁 Script executed:
# Check line length to verify it complies with the 120 character limit
python3 << 'EOF'
with open('sdk/async_api/spot_trade_bust.py', 'r') as f:
lines = f.readlines()
for i, line in enumerate(lines[2:16], start=3): # lines 3-15
line_len = len(line.rstrip('\n'))
status = "OK" if line_len <= 120 else "EXCEEDS"
print(f"Line {i}: {line_len:3d} chars {status}")
if line_len > 120:
print(f" Content: {line.rstrip()}")
EOFRepository: Reya-Labs/reya-python-sdk
Length of output: 369
Add populate_by_name=True to enable snake_case field construction.
This model has aliased fields (accountId, counterpartyAccountId, transactionHash) but lacks populate_by_name in its config, so SpotTradeBust(account_id=..., transaction_hash=...) will fail even though the class exposes snake_case attributes. The OpenAPI counterpart already enables this, creating an inconsistency.
🔧 Suggested fix
-from pydantic import model_serializer, model_validator, BaseModel, Field
+from pydantic import ConfigDict, model_serializer, model_validator, BaseModel, Field
from sdk.async_api.side import Side
class SpotTradeBust(BaseModel):
+ model_config = ConfigDict(populate_by_name=True)
symbol: str = Field(description='''Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)''')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/async_api/spot_trade_bust.py` around lines 3 - 15, The SpotTradeBust
Pydantic model exposes snake_case attributes but lacks a Pydantic v2 config to
allow construction using those names; add a model_config = {"populate_by_name":
True} to the SpotTradeBust class so callers can instantiate with account_id,
counterparty_account_id, transaction_hash (and existing alias fields still
function). This change should be made on the SpotTradeBust class (the BaseModel
subclass) alongside the existing fields (symbol, account_id/accountId alias,
counterparty_account_id/counterpartyAccountId alias,
transaction_hash/transactionHash alias).
| @model_validator(mode='before') | ||
| @classmethod | ||
| def unwrap_additional_properties(cls, data): | ||
| if not isinstance(data, dict): | ||
| data = data.model_dump() | ||
| json_properties = list(data.keys()) | ||
| known_object_properties = ['symbol', 'account_id', 'counterparty_account_id', 'qty', 'side', 'price', 'reason', 'timestamp', 'transaction_hash', 'additional_properties'] | ||
| unknown_object_properties = [element for element in json_properties if element not in known_object_properties] | ||
| # Ignore attempts that validate regular models, only when unknown input is used we add unwrap extensions | ||
| if len(unknown_object_properties) == 0: | ||
| return data | ||
|
|
||
| known_json_properties = ['symbol', 'accountId', 'counterpartyAccountId', 'qty', 'side', 'price', 'reason', 'timestamp', 'transactionHash', 'additionalProperties'] | ||
| additional_properties = data.get('additional_properties', {}) | ||
| for obj_key in unknown_object_properties: | ||
| if not known_json_properties.__contains__(obj_key): | ||
| additional_properties[obj_key] = data.pop(obj_key, None) | ||
| data['additional_properties'] = additional_properties | ||
| return data |
There was a problem hiding this comment.
Guard the pre-validator against non-model inputs.
unwrap_additional_properties currently assumes every non-dict input has model_dump(). None, scalars, or lists will raise AttributeError, and additional_properties=None will raise TypeError as soon as an unknown key is merged, so malformed payloads bypass normal validation errors.
🔧 Suggested fix
`@model_validator`(mode='before')
`@classmethod`
- def unwrap_additional_properties(cls, data):
- if not isinstance(data, dict):
- data = data.model_dump()
+ def unwrap_additional_properties(cls, data: Any) -> Any:
+ if isinstance(data, BaseModel):
+ data = data.model_dump()
+ elif not isinstance(data, dict):
+ return data
json_properties = list(data.keys())
known_object_properties = ['symbol', 'account_id', 'counterparty_account_id', 'qty', 'side', 'price', 'reason', 'timestamp', 'transaction_hash', 'additional_properties']
unknown_object_properties = [element for element in json_properties if element not in known_object_properties]
# Ignore attempts that validate regular models, only when unknown input is used we add unwrap extensions
if len(unknown_object_properties) == 0:
return data
known_json_properties = ['symbol', 'accountId', 'counterpartyAccountId', 'qty', 'side', 'price', 'reason', 'timestamp', 'transactionHash', 'additionalProperties']
- additional_properties = data.get('additional_properties', {})
+ additional_properties = data.get('additional_properties') or {}🧰 Tools
🪛 Ruff (0.15.5)
[warning] 31-31: Missing return type annotation for classmethod unwrap_additional_properties
(ANN206)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/async_api/spot_trade_bust.py` around lines 29 - 47, The pre-validator
unwrap_additional_properties assumes non-dict inputs implement model_dump and
that additional_properties is a dict; guard by first checking if data is a dict
and if not, only try to call data.model_dump() when hasattr(data, "model_dump"),
otherwise return data unchanged so scalars/None/lists bypass this unwrapping;
then ensure additional_properties = data.get('additional_properties') and if
it's None or not isinstance(additional_properties, dict) set it to {} before
merging unknown keys; also prefer Python "in" checks (e.g., if obj_key not in
known_json_properties) when iterating unknown_object_properties in
unwrap_additional_properties.
| from typing import Any, List, Dict, Optional | ||
| from pydantic import BaseModel, Field | ||
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | ||
| from sdk.async_api.spot_trade_bust import SpotTradeBust | ||
| class WalletSpotTradeBustUpdatePayload(BaseModel): | ||
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | ||
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | ||
| channel: str = Field(description='''Channel pattern for wallet spot trade busts''') | ||
| data: List[SpotTradeBust] = Field() |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Use built-in generics in this new payload model.
Ruff is already flagging UP035 here. With the repo's Python 3.12 baseline, list[SpotTradeBust] should replace List[SpotTradeBust] in new code.
♻️ Minimal cleanup
-from typing import Any, List, Dict, Optional
from pydantic import BaseModel, Field
from sdk.async_api.channel_data_message_type import ChannelDataMessageType
from sdk.async_api.spot_trade_bust import SpotTradeBust
class WalletSpotTradeBustUpdatePayload(BaseModel):
type: ChannelDataMessageType = Field(description='''Message type for channel data updates''')
timestamp: float = Field(description='''Update timestamp (milliseconds)''')
channel: str = Field(description='''Channel pattern for wallet spot trade busts''')
- data: List[SpotTradeBust] = Field()
+ data: list[SpotTradeBust] = Field()As per coding guidelines, "Require Python 3.12+ for runtime and Python 3.10 for type checking with strict mypy configuration".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| from typing import Any, List, Dict, Optional | |
| from pydantic import BaseModel, Field | |
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | |
| from sdk.async_api.spot_trade_bust import SpotTradeBust | |
| class WalletSpotTradeBustUpdatePayload(BaseModel): | |
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | |
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | |
| channel: str = Field(description='''Channel pattern for wallet spot trade busts''') | |
| data: List[SpotTradeBust] = Field() | |
| from typing import Any, Dict, Optional | |
| from pydantic import BaseModel, Field | |
| from sdk.async_api.channel_data_message_type import ChannelDataMessageType | |
| from sdk.async_api.spot_trade_bust import SpotTradeBust | |
| class WalletSpotTradeBustUpdatePayload(BaseModel): | |
| type: ChannelDataMessageType = Field(description='''Message type for channel data updates''') | |
| timestamp: float = Field(description='''Update timestamp (milliseconds)''') | |
| channel: str = Field(description='''Channel pattern for wallet spot trade busts''') | |
| data: list[SpotTradeBust] = Field() |
🧰 Tools
🪛 Ruff (0.15.5)
[warning] 2-2: typing.List is deprecated, use list instead
(UP035)
[warning] 2-2: typing.Dict is deprecated, use dict instead
(UP035)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/async_api/wallet_spot_trade_bust_update_payload.py` around lines 2 - 10,
The payload model WalletSpotTradeBustUpdatePayload is using typing.List which
triggers UP035; change the data field to use the built-in generic
list[SpotTradeBust] instead of List[SpotTradeBust], update the import list to
remove List (keep Any, Dict, Optional only if used) and ensure the Field
declaration for data remains the same; this replaces the typing generic with
Python 3.12+ built-in generics while leaving the class name, type annotations
(type, timestamp, channel), and SpotTradeBust reference unchanged.
| _request_timeout: Union[ | ||
| None, | ||
| Annotated[StrictFloat, Field(gt=0)], | ||
| Tuple[ | ||
| Annotated[StrictFloat, Field(gt=0)], | ||
| Annotated[StrictFloat, Field(gt=0)] | ||
| ] | ||
| ] = None, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Regenerate these stubs with Python 3.10+ annotations.
The new OpenAPI output is still emitting Union[...] here, and the same generation pass is adding typing_extensions / typing.List-style imports in the new models. In a Python 3.12-targeted repo this just keeps adding avoidable lint debt, so please fix the generator template or post-processing step instead of hand-editing each endpoint.
As per coding guidelines, "Require Python 3.12+ for runtime and Python 3.10 for type checking with strict mypy configuration".
🧰 Tools
🪛 Ruff (0.15.5)
[warning] 1218-1225: Use X | Y for type annotations
Convert to X | Y
(UP007)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/open_api/api/market_data_api.py` around lines 1218 - 1225, The generated
endpoint stub uses old-style typing (Union[...]) for the parameter
_request_timeout in market_data_api.py; update the OpenAPI generator template or
add a post-processing step so generated signatures use Python 3.10+ union syntax
(e.g., replace Union[...] with the pipe operator) and stop emitting
typing_extensions/typing.List style imports—ensure the generator produces
annotations like None | float | tuple[float, float] for _request_timeout and
that model imports target built-in typing for Python 3.12 compatibility rather
than typing_extensions.
| return "Python SDK Debug Report:\n"\ | ||
| "OS: {env}\n"\ | ||
| "Python Version: {pyversion}\n"\ | ||
| "Version of the API: 2.1.4\n"\ | ||
| "Version of the API: 2.1.5\n"\ | ||
| "SDK Package Version: 2.1.4.0".\ |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'SDK Package Version|__version__|^version\s*=|2\.1\.4\.0|2\.1\.5'Repository: Reya-Labs/reya-python-sdk
Length of output: 8741
Source SDK version from package metadata instead of hard-coding.
Line 500 hard-codes the SDK version as 2.1.4.0, but sdk.open_api.__version__ already provides this as a single source of truth. When the SDK version is bumped in a future release, this debug report will silently report stale version information unless the hard-coded value is updated. Additionally, while touching this block, collapse the multi-line string into a parenthesized expression to clear the Ruff ISC002 implicit string concatenation warning.
🧰 Tools
🪛 Ruff (0.15.5)
[warning] 496-497: Implicitly concatenated string literals over multiple lines
(ISC002)
[warning] 496-501: Use f-string instead of format call
Convert to f-string
(UP032)
[warning] 497-498: Implicitly concatenated string literals over multiple lines
(ISC002)
[warning] 498-499: Implicitly concatenated string literals over multiple lines
(ISC002)
[warning] 499-500: Implicitly concatenated string literals over multiple lines
(ISC002)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/open_api/configuration.py` around lines 496 - 500, The debug report
return currently hard-codes "SDK Package Version: 2.1.4.0" and uses implicit
multi-line string concatenation; update the return expression in
configuration.py to use the canonical sdk.open_api.__version__ value instead of
the literal and collapse the multi-line strings into a single parenthesized
string expression (e.g., return ("Python SDK Debug Report:\nOS: {env}\nPython
Version: {pyversion}\nVersion of the API: 2.1.5\nSDK Package Version: " +
sdk.open_api.__version__)). Ensure you import or reference
sdk.open_api.__version__ where this return is defined so the debug report always
reflects the package metadata and removes the Ruff ISC002 warning.
| async def get_spot_trade_busts(self) -> SpotTradeBustList: | ||
| """ | ||
| Get spot trade busts (failed spot fills) for the owner wallet asynchronously. | ||
|
|
||
| Returns: | ||
| Spot trade busts | ||
|
|
||
| Raises: | ||
| ValueError: If no wallet address is available or API returns an error | ||
| """ | ||
| wallet = self.owner_wallet_address | ||
| if not wallet: | ||
| raise ValueError("No wallet address available. Private key must be provided.") | ||
|
|
||
| return await self.wallet.get_wallet_spot_trade_busts(address=wallet) |
There was a problem hiding this comment.
Expose the wallet endpoint's pagination filters here.
sdk/open_api/api/wallet_data_api.py, Lines 1973-2046 already cap this endpoint at 100 results and accept start_time / end_time. This wrapper hardcodes the default page, so callers cannot retrieve older busts through ReyaTradingClient.
🧭 Suggested pass-through
- async def get_spot_trade_busts(self) -> SpotTradeBustList:
+ async def get_spot_trade_busts(
+ self,
+ start_time: Optional[int] = None,
+ end_time: Optional[int] = None,
+ ) -> SpotTradeBustList:
"""
Get spot trade busts (failed spot fills) for the owner wallet asynchronously.
+ Args:
+ start_time: Optional lower bound for pagination.
+ end_time: Optional upper bound for pagination.
+
Returns:
Spot trade busts
Raises:
ValueError: If no wallet address is available or API returns an error
@@
- return await self.wallet.get_wallet_spot_trade_busts(address=wallet)
+ return await self.wallet.get_wallet_spot_trade_busts(
+ address=wallet,
+ start_time=start_time,
+ end_time=end_time,
+ )🧰 Tools
🪛 Ruff (0.15.5)
[warning] 720-720: Avoid specifying long messages outside the exception class
(TRY003)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@sdk/reya_rest_api/client.py` around lines 708 - 722, The get_spot_trade_busts
wrapper currently hardcodes the call and prevents callers from using the wallet
endpoint's pagination/time filters; update
ReyaTradingClient.get_spot_trade_busts to accept optional parameters (e.g.,
start_time, end_time, page, page_size) and forward them to
self.wallet.get_wallet_spot_trade_busts(address=wallet, start_time=start_time,
end_time=end_time, page=page, page_size=page_size), preserving existing behavior
when arguments are None and validating wallet via self.owner_wallet_address as
before.
Summary by CodeRabbit
Release Notes
New Features
Version Updates