From 9dc2d1ce37b945f1c547e1bb53a97f67739579ed Mon Sep 17 00:00:00 2001 From: sina <20732540+SinaKhalili@users.noreply.github.com> Date: Thu, 26 Sep 2024 03:50:06 -0700 Subject: [PATCH] Update README with test instructions --- README.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 05c5827a..42e79365 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ -DriftPy is the Python client for the [Drift](https://www.drift.trade/) protocol. It allows you to trade and fetch data from Drift using Python. +DriftPy is the Python client for the [Drift](https://www.drift.trade/) protocol. +It allows you to trade and fetch data from Drift using Python. **[Read the full SDK documentation here!](https://drift-labs.github.io/v2-teacher/)** @@ -16,7 +17,13 @@ pip install driftpy Note: requires Python >= 3.10. -## ⚠️ IMPORTANT ⚠️ + +## SDK Examples + +- `examples/` folder includes more examples of how to use the SDK including how to provide liquidity/become an lp, stake in the insurance fund, etc. + + +## Note on using QuickNode If you are using QuickNode free plan, you *must* use `AccountSubscriptionConfig("demo")`, and you can only subscribe to 1 perp market and 1 spot market at a time. @@ -24,7 +31,7 @@ Non-QuickNode free RPCs (including the public mainnet-beta url) can use `cached` Example setup for `AccountSubscriptionConfig("demo")`: -``` +```python # This example will listen to perp markets 0 & 1 and spot market 0 # If you are listening to any perp markets, you must listen to spot market 0 or the SDK will break @@ -48,31 +55,30 @@ If you intend to use `AccountSubscriptionConfig("demo)`, you *must* call `get_ma `get_markets_and_oracles` will return all the necessary `OracleInfo`s and `market_indexes` in order to use the SDK. -## SDK Examples - -- `examples/` folder includes more examples of how to use the SDK including how to provide liquidity/become an lp, stake in the insurance fund, etc. +# Development ## Setting Up Dev Env `bash setup.sh` -# Development Ensure correct python version (using pyenv is recommended): -``` +```bash pyenv install 3.10.11 pyenv global 3.10.11 poetry env use $(pyenv which python) ``` Install dependencies: -``` +```bash poetry install ``` -Run tests: -``` -poetry run bash test-scripts/integration_test.sh -poetry run bash test-scripts/math_tests.sh -``` +To run tests, first ensure you have set up the RPC url, then run `pytest`: +```bash +export MAINNET_RPC_ENDPOINT="" +export DEVNET_RPC_ENDPOINT="https://api.devnet.solana.com" # or your own RPC +poetry run pytest -v -s -x tests/ci/*.py +poetry run pytest -v -s tests/math/*.py +```