Conversation
8ball030
commented
Oct 1, 2025
- feat:enabled-other-test
- test:poll-rfqs
- tests: test_create_quote
- feat: create_quote
- added-endpoints-and-tests
- feat:rfq-examples
- feat:rfq-stuff
- feat:websocket-examples
| [tool.poetry.dependencies] | ||
| python = ">=3.10,<=3.12" | ||
| python = ">=3.11,<=3.13" |
There was a problem hiding this comment.
you have, presumably accidentally, deleted the poetry.lock file
| private_key = os.environ["ETH_PRIVATE_KEY"] | ||
| wallet = os.environ["DERIVE_WALLET"] | ||
| env = os.environ["DERIVE_ENV"] | ||
| subaccount_id = os.environ.get( | ||
| "SUBACCOUNT_ID", | ||
| ) |
There was a problem hiding this comment.
might be nice to introduce this as a constant
class ENVVAR(StrEnum):
DERIVE_SESSION_PRIVATE_KEY = "DERIVE_SESSION_PRIVATE_KEY"
DERIVE_WALLET = "DERIVE_WALLET"
DERIVE_SUBACCOUNT = "DERIVE_SUBACCOUNT"
DERIVE_ENV = "DERIVE_ENV"or better
class EnvVars(BaseModel):
session_private_key: str
wallet: str
subaccount: str
env: str
@ classmethod
def load(cls):
load_dotenv()
return cls(...)or even better (separate library, pydantic docs here)
from pydantic import Field, SecretStr
from pydantic_settings import BaseSettings
from functools import lru_cache
from dotenv import load_dotenv
class Settings(BaseSettings):
session_private_key: SecretStr = Field(..., env="DERIVE_SESSION_PRIVATE_KEY")
wallet: str = Field(..., env="DERIVE_WALLET")
subaccount_id: str | None = Field(None, env="DERIVE_SUBACCOUNT_ID")
env: str = Field("dev", env="DERIVE_ENV")
model_config = {
"env_file": ".env",
"env_file_encoding": "utf-8",
}
@lru_cache(maxsize=1)
def get_settings() -> Settings:
load_dotenv()
return Settings()| leg_tickers = {i['instrument_name']: derive_client.fetch_ticker(i['instrument_name']) for i in rfq['legs']} | ||
|
|
||
| premium_per_rfq = 0.01 # 1% premium on top of index price | ||
| premium_per_rfq = 0.0 # 1% premium on top of index price |
There was a problem hiding this comment.
comment doesn't match the code
examples/rfqs/create_rfq.py
Outdated
| leg_price = float(leg['price']) | ||
| leg_amount = float(leg['amount']) |
There was a problem hiding this comment.
more of a general comment: I think we should be using Decimal instead of float anywhere we are dealing with price data. Goes for entire repo. Perhaps worth opening an issue on this for future reference
| class TxStatus(Enum): | ||
| """Transaction status enum.""" | ||
|
|
||
| PENDING = 'pending' | ||
| REVERTED = 'reverted' | ||
| REQUESTED = 'requested' |
There was a problem hiding this comment.
This should exist in the autogenerated models
either this one here
class TxStatus(str, Enum):
requested = 'requested'
pending = 'pending'
settled = 'settled'
reverted = 'reverted'
ignored = 'ignored'
timed_out = 'timed_out'class TxStatus5(str, Enum):
settled = 'settled'
reverted = 'reverted'
timed_out = 'timed_out'| def rfq_max_fee(client, legs: list[Leg], is_taker: bool = True) -> float: | ||
| """ | ||
| Max fee ($ for the full trade). | ||
| Request will be rejected if the supplied max fee is below the estimated fee for this trade. | ||
| DeriveJSONRPCException: Derive RPC 11023: Max fee order param is too low | ||
| """ |
There was a problem hiding this comment.
this code was drafted by myself and never finished. Either we need to finish this or remove it
examples/rfq_trading_flow.py
Outdated
| def setup_clients(): | ||
| """Setup separate clients for maker and taker roles""" | ||
|
|
||
| maker_client = DeriveClient(wallet=TEST_WALLET, private_key=TEST_PRIVATE_KEY, env=Environment.TEST) | ||
| taker_client = DeriveClient(wallet=TEST_WALLET, private_key=TEST_PRIVATE_KEY, env=Environment.TEST) | ||
|
|
||
| maker_client.subaccount_id = maker_client.subaccount_ids[0] | ||
| taker_client.subaccount_id = taker_client.subaccount_ids[1] | ||
|
|
||
| return maker_client, taker_client |
There was a problem hiding this comment.
same here, this script is unfinished: either need to finish it or remove it
derive_client/clients/ws_client.py
Outdated
| @dataclass | ||
| class Position: |
There was a problem hiding this comment.
this model should also exist in the generated models as PositionResponseSchema