Software development kit for the Mercor trading API
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mercor-sdk-0.1.1.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for mercor_sdk-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 887feed778ad1e498afbe0ce3a6e9fafdb457d7fad534bc8d97d06904a3a37c7 |
|
MD5 | e7c1b07c963f297460a3c78d9951729d |
|
BLAKE2b-256 | f3ed90c150d7090301aeabfd0e228765955279ab6f491dcc0f50609f94f36a5f |