Skip to content

Conversation

@8ball030
Copy link
Owner

@8ball030 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

Comment on lines 9 to 10
[tool.poetry.dependencies]
python = ">=3.10,<=3.12"
python = ">=3.11,<=3.13"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have, presumably accidentally, deleted the poetry.lock file

Comment on lines 165 to 183
private_key = os.environ["ETH_PRIVATE_KEY"]
wallet = os.environ["DERIVE_WALLET"]
env = os.environ["DERIVE_ENV"]
subaccount_id = os.environ.get(
"SUBACCOUNT_ID",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment doesn't match the code

Comment on lines 193 to 194
leg_price = float(leg['price'])
leg_amount = float(leg['amount'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 22 to 27
class TxStatus(Enum):
"""Transaction status enum."""

PENDING = 'pending'
REVERTED = 'reverted'
REQUESTED = 'requested'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

or this one here

class TxStatus5(str, Enum):
    settled = 'settled'
    reverted = 'reverted'
    timed_out = 'timed_out'

Comment on lines 81 to 86
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
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code was drafted by myself and never finished. Either we need to finish this or remove it

Comment on lines 18 to 27
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, this script is unfinished: either need to finish it or remove it

Comment on lines 54 to 55
@dataclass
class Position:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this model should also exist in the generated models as PositionResponseSchema

@8ball030 8ball030 changed the base branch from main to feat/_clients October 26, 2025 22:39
@8ball030 8ball030 changed the base branch from feat/_clients to main October 26, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants