Skip to main content

marginfi Python SDK

Project description

marginpy

Codecov License Code style: black

◼️ The marginfi Python SDK ◼️

marginpy is the python library for interacting with marginfi, the decentralized portfolio margin protocol on Solana.

🏎 Quickstart

Installation

pip install marginpy

:warning: If you are using M1: marginpy is not currently available natively on M1, and only availble through Rosetta which impacts performance. The easiest way to work with the marginpy library is to make sure you are working out of an x86_64 terminal/editor, including the installation step.

General Usage

import marginpy

Check out the examples for more details.

👷‍♀️ Development

Setup local development environment

  1. Spare yourself some pain and setup your default python command to point to 3.10+

  2. Install poetry: $ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

  3. Install nox-poetry: $ pip install nox-poetry

  4. Initialize Python 3.10 virtual environment: $ poetry env use 3.10

  5. Install project dependencies: $ poetry install

  6. Activate virtual environment: $ poetry shell

  7. Build the rust crate and install it locally: $ maturin develop

Running tests

As of writing, only a small subset of tests can be run by the user, due to initially private dependencies. They can be run like so:

  1. Activate virtual environment:
$ poetry shell
  1. Run desired task:
    • unit tests only: $ make test-unit
    • type check + lint: $ make lint

Feel free to check the Makefile for other available actions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marginpy-0.1.0_alpha.0.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distributions

marginpy-0.1.0_alpha.0-cp310-abi3-manylinux_2_28_x86_64.whl (7.1 MB view hashes)

Uploaded CPython 3.10+ manylinux: glibc 2.28+ x86-64

marginpy-0.1.0_alpha.0-cp310-abi3-macosx_10_7_x86_64.whl (332.3 kB view hashes)

Uploaded CPython 3.10+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page