Skip to main content

Mercor SDK

Introduction

The Mercor software development kit is meant for users of the Mercor trading API that wish to access it using the Python programming language. Using this SDK will have the benefit of removing some of the boilerplate for calling the different endpoints.

Installation

python -m pip install mercor-sdk

Usage

Importing the client and token:

from mercor_sdk.client import MercorClient
from mercor_sdk.tokens import CryptoToken

Instantiating the client:

client = MercorClient("<my_algorithm_address>", "<my_password>")

Viewing the current balance of the algorithm:

balance = client.balance()
print(balance.supply)

Placing a buy order:

trade = client.buy(slippage=0.05, relative_amount=0.5)
print(trade.transaction_hash)

Placing a sell order:

trade = client.sell(slippage=0.05, relative_amount=0.5)
print(trade.transaction_hash)

Retrieving the status of a buy or sell order:

status = client.status(transaction_hash=trade.transaction_hash.value)
print(status.message)

Accessing data from the ticker:

ticker = client.ticker_list()
print(ticker[CryptoToken.ETH])

Accessing data for a specific token from the ticker:

token = client.ticker(CryptoToken.ETH)
print(token.price)

Release files for mercor-sdk 0.1.2

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

Source distribution (sdist)

Source distribution for mercor-sdk 0.1.2
File Size Uploaded
mercor-sdk-0.1.2.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mercor-sdk 0.1.2
File Interpreter ABI Platform
mercor_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / mercor-sdk-0.1.2.tar.gz

Download URL mercor-sdk-0.1.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6ec3717a58a94a48982080e326a21516dd0b5ad014d271b3db8bad67064c68bd
BLAKE2b-256 checksum
How to use checksums
6ff7c6b781783fec6647f2edf6bb945fa2fed5eb18e834a0b91a801d7d4269be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.2 Linux/5.10.0-8-amd64

Release files / mercor_sdk-0.1.2-py3-none-any.whl

Download URL mercor_sdk-0.1.2-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6198e2d8022024c6f865ad98459cad10219c8ef6ab0b2e18308432d2a89ee8b3
BLAKE2b-256 checksum
How to use checksums
8ec553def2dd00354a00b58c5adcc9b5243085c1dd72dbfe9405fc4d7d332c43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.2 Linux/5.10.0-8-amd64

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

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