This repo provides a unified interface for the Derive Exchange.
Please checkout the examples directory for usage.
Here is a quick demonstration of the cli functionality.
To use the client, you will need to generate an API key from the Derive Exchange.
The process involves linking your local signer to the account you want to use programmatically.
Here are the steps:
-
Generate a local signer using your preferred method. For example, you can use the Open Aea Ledger Ethereum Cli.
aea generate-key ethereum
This will generate a new private key in the
ethereum_private_key.txtfile. -
Go to the Derive Exchange and create an account.
-
Go to the API section and create a new API key.
-
Register a new Session key with the Public Address of the account your signer generated in step 0.
Once you have the API key, you can use it to interact with the Derive Exchange.
You need;
DERIVE_WALLET - The programtic wallet generated upon account creation. It can be found in the Developer section of the Derive Exchange.
SIGNER_PRIVATE_KEY - The private key generated in step 0.
SUBACCOOUNT_ID - The subaccount id you want to use for the API key.
derive_client = DeriveClient(
private_key=TEST_PRIVATE_KEY,
env=Environment.TEST, # or Environment.PROD
wallet=TEST_WALLET,
subaccount_id = 123456
)You can filter by status, instrument name, and more.
orders = derive_client.orders.list(
status=OrderStatus.open,
)pip install derive-clientmake fmtmake lintmake typecheckmake testsmake codegen-allFor convience, all commands can be run with:
make all
We can use tbump to automatically bump our versions in preparation of a release.
export new_version=0.1.5
tbump $new_versionThe release workflow will then detect that a branch with a v prefix exists and create a release from it.
Additionally, the package will be published to PyPI.
