Skip to main content

Unofficial Nexo API Wrapper (Python)

✨ A Python wrapper for the Nexo Pro API ✨

lint tests codecov CodeFactor Percentage of issues still open PipPerMonths Pip version fury.io GitHub license GitHub contributors

About Nexo 💸

Nexo is a crypto lending platform that lets you borrow crypto or cash by placing your crypto as collateral. They offer high APY on holdings based on loyalty tier (the more Nexo token you hold the higher your tier). You can earn your interests in the same kind of your holding or as Nexo tokens. As an example, stablecoins can earn up to 12% APY. Bitcoin and Ethereum, 8%.

Unfortunately, Nexo doesn't offer some automated way of buying periodically. All you can do is setup a bank transfer and then convert/buy manually. This API Wrapper aims to offer a way of automating your purchases. You'd just have to setup your periodic bank transfer to Nexo, and then buy at spot price the coins that you want in an automated way by using the wrapped API calls.

Description 📰

This is an unofficial Python wrapper for the Nexo Pro exchange REST API v1. I am in no way affiliated with Nexo, use at your own risk.

If you came here looking for the Nexo exchange to purchase cryptocurrencies, then go to the official Nexo website. If you want to automate interactions with Nexo, stick around.

Click here to register a Nexo account

Heavily influenced by python-binance

You can check which endpoints are currently functional here

  • ✨ Work in Progress
  • 🎌 Built with Python
  • 🐋 Docker Available
  • 🍻 Actively Maintained

Roadmap 🌱

See it on Issue https://github.com/guilyx/python-nexo/issues/2 Checkout the Changelog

Preparation 🔎

  • Register a Nexo Account. here
  • Generate an API Key in Nexo Pro with the permissions you want.

Advice

Priviledge Async Client. The advantage of async processing is that we don’t need to block on I/O which is every action that we make when we interact with the Nexo Pro servers.

By not blocking execution we can continue processing data while we wait for responses or new data from websockets.

Set it up 💾

PIP

  1. Install the pip package: python3 -m pip install python-nexo
  2. Explore the API:
#### Sync

import nexo
import os
from dotenv import load_dotenv

# Loads your API keys from the .env file you created
load_dotenv()
key = os.getenv("NEXO_PUBLIC_KEY")
secret = os.getenv("NEXO_SECRET_KEY")

# Instantiate Client and grab account balances
c = nexo.Client(key, secret)
balances = c.get_account_balances()
print(balances)

#### Async

import nexo
import os
import asyncio
from dotenv import load_dotenv

load_dotenv()

key = os.getenv("NEXO_PUBLIC_KEY")
secret = os.getenv("NEXO_SECRET_KEY")

async def main():
    client = await nexo.AsyncClient.create(key, secret)
    print(await client.get_account_balances())

    await client.close_connection()

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Docker (source)

  1. Clone the Project: git clone -b master https://github.com/guilyx/python-nexo.git
  2. Move to the Repository: cd python-nexo
  3. Create a copy of .env.example and name it .env
  4. Fill up your API Key/Secret
  5. Build and Compose the Docker: docker-compose -f docker/docker-compose.yml up - The container should keep running so that you can explore the API
  6. Attach to the docker: docker exec -it $(docker ps -qf "name=docker_python-nexo") /bin/bash
  7. Run python in the docker's bash environment: python3
  8. From there, copy the following snippet to instantiate a Client:
import nexo
import os
nexo_key = os.getenv("NEXO_PUBLIC_KEY")
nexo_secret = os.getenv("NEXO_SECRET_KEY")
assert(nexo_key)
assert(nexo_secret)
c = nexo.Client(nexo_key, nexo_secret)
  1. You can now explore the client's exposed endpoints, for instance:
balances = c.get_account_balances()
print(balances)

Contribute 🆘

Open an issue to state clearly the contribution you want to make. Upon aproval send in a PR with the Issue referenced. (Implement Issue #No / Fix Issue #No).

Maintainers Ⓜ️

  • Erwin Lejeune

Buy me a Coffee

ERC-20 / EVM: 0xcC1C1E8F5fD3c832d970C8d5A62Ff9dD74259B1f

BTC: bc1q0c45w3jvlwclvuv9axlwq4sfu2kqy4w9xx225j

DOT: 1Nt7G2igCuvYrfuD2Y3mCkFaU4iLS9AZytyVgZ5VBUKktjX

DAG: DAG7rGLbD71VrU6nWPrepdzcyRS6rFVvfWjwRKg5

LUNC: terra12n3xscq5efr7mfd6pk5ehtlsgmaazlezhypa7g

Metadata

Release files for python-nexo 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-nexo 1.0.3
File Size Uploaded
python-nexo-1.0.3.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-nexo 1.0.3
File Interpreter ABI Platform
python_nexo-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 26.9 kB

Release files / python-nexo-1.0.3.tar.gz

Download URL python-nexo-1.0.3.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
caf8b2e1badb3e048209b514ce103e77aacc9e0d37ae65c790c68f6b7c5b91e5
BLAKE2b-256 checksum
How to use checksums
124d1b0aa92a7066e4bcf12a1ceafa18f9448bec97e8dc1ea51bc935f2c3244e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / python_nexo-1.0.3-py3-none-any.whl

Download URL python_nexo-1.0.3-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a04e763af159cbf268776587649860c9e964792ed05ec3ba7b193532b6c0beed
BLAKE2b-256 checksum
How to use checksums
2bc11206126d0a3eedb45eedf8b24d7ef396d680102443b566e6f61d5444da3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page