Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
12b582b
feat: added private endpoints in base_client.py
Aviksaikat Aug 22, 2025
e09a34f
feat: cli method updated to support transfer_position & positions end…
Aviksaikat Aug 23, 2025
06fe0d8
fix: made the suggested changes
Aviksaikat Aug 26, 2025
9e528f0
fix: removed the check for position_amount
Aviksaikat Aug 26, 2025
0d604b0
feat: examples & tests added for the new transfer_position/s endpoints
Aviksaikat Aug 27, 2025
40cd3cf
fix: merged conflicts fixed
Aviksaikat Aug 27, 2025
bc66d52
fix: fixed flake8 errors
Aviksaikat Aug 27, 2025
f76fa8d
feat: Update position_setup fixture to dynamically fetch instruments …
Aviksaikat Aug 28, 2025
3a2865e
fix: proper tests added to first open a position, transfer it then tr…
Aviksaikat Aug 28, 2025
8429e83
fix: fixed the tranfer_position & positions methods. Earlier they wer…
Aviksaikat Aug 29, 2025
91f25b3
feat: new fixtures added & new tests added
Aviksaikat Aug 29, 2025
3144023
feat: all tests are green now. Updated the base_client to handle the …
Aviksaikat Aug 29, 2025
86c4cfc
feat: RFQ_MODULE address added in the ContractAddresses class
Aviksaikat Aug 29, 2025
8dc14d1
feat: minor fixes & examples updated for transfer_position & transfer…
Aviksaikat Aug 29, 2025
df8ff32
feat: import fixed in cli.py
Aviksaikat Aug 29, 2025
699bddb
fix: linter issues
Karrenbelt Sep 4, 2025
31494c3
feat: Order model
Karrenbelt Sep 4, 2025
18793c6
feat: Trade model
Karrenbelt Sep 4, 2025
d996c17
feat: Quote model
Karrenbelt Sep 4, 2025
92ca525
feat: PositionTransfer and PositionsTransfer
Karrenbelt Sep 5, 2025
7bae03e
fix: remove derive_client_2 and update tests
Karrenbelt Sep 5, 2025
522bc97
chore: remove _extract_transaction_id
Karrenbelt Sep 5, 2025
b0dee51
fix: test_single_position_transfer
Karrenbelt Sep 10, 2025
9053824
chore: cleanup conftest
Karrenbelt Sep 10, 2025
bb09a2b
fix: test_funding_transfers.py
Karrenbelt Sep 10, 2025
015041b
fix: remove subaccount_id attribute assignment in cliet fixtures
Karrenbelt Sep 10, 2025
41eae01
fix: transfer_position
Karrenbelt Sep 10, 2025
b447585
feat: assign subaccount_ids as attribute on client instantiation
Karrenbelt Sep 10, 2025
3952ae6
feat: PositionSpec
Karrenbelt Sep 11, 2025
c54dce5
chore: outcomment problematic ARBITRUM endpoints
Karrenbelt Sep 11, 2025
0fa7792
fix: transfer_positions WIP
Karrenbelt Sep 11, 2025
fdb4553
feat: get_order endpoint
Karrenbelt Sep 11, 2025
c71b8dc
chore: add outcommented session key wallet address to conftest
Karrenbelt Sep 11, 2025
4b3435b
tests: test_transfer_positions WIP
Karrenbelt Sep 11, 2025
1fd3e2f
fix:ensures-position-orders-fill
Sep 11, 2025
0a1d559
fix:disable-simultaneous-test
Sep 11, 2025
faff376
chore:remove-non-working-json-loader
Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/common_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
poetry-version: ["2.0.1"]
os: [ubuntu-22.04,]
Expand Down
12 changes: 11 additions & 1 deletion derive_client/_bridge/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,18 @@ def _get_min_fees(


class BridgeClient:
"""
Synchronous constructor that performs minimal, non-blocking setup.

Args:
env: Environment to connect to (only PROD supported for bridging)
account: Account object containing the private key of the owner of the smart contract funding account
wallet: Address of the smart contract funding account
logger: Logger instance for logging

"""

def __init__(self, env: Environment, account: Account, wallet: Address, logger: Logger):
"""Synchronous constructor that performs minimal, non-blocking setup."""

if not env == Environment.PROD:
raise RuntimeError(f"Bridging is not supported in the {env.name} environment.")
Expand Down
57 changes: 57 additions & 0 deletions derive_client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,5 +752,62 @@ def create_order(ctx, instrument_name, side, price, amount, order_type, instrume
print(result)


@positions.command("transfer")
@click.pass_context
@click.option(
"--instrument-name",
"-i",
type=str,
required=True,
help="Name of the instrument to transfer",
)
@click.option(
"--amount",
"-a",
type=float,
required=True,
help="Amount to transfer (absolute value)",
)
@click.option(
"--limit-price",
"-p",
type=float,
required=True,
help="Limit price for the transfer",
)
@click.option(
"--from-subaccount",
"-f",
type=int,
required=True,
help="Subaccount ID to transfer from",
)
@click.option(
"--to-subaccount",
"-t",
type=int,
required=True,
help="Subaccount ID to transfer to",
)
@click.option(
"--position-amount",
type=float,
default=None,
help="Original position amount (if not provided, will be fetched)",
)
def transfer_position(ctx, instrument_name, amount, limit_price, from_subaccount, to_subaccount, position_amount):
"""Transfer a single position between subaccounts."""
client: DeriveClient = ctx.obj["client"]
result = client.transfer_position(
instrument_name=instrument_name,
amount=amount,
limit_price=limit_price,
from_subaccount_id=from_subaccount,
to_subaccount_id=to_subaccount,
position_amount=position_amount,
)
print(result)


if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter
Loading