No project description provided
Project description
mango-explorer-v4
Python client library for interacting with Mango Markets V4.
📦 Installation
mango-explorer-v4
is available as a Python package on PyPI and can be installed as:
pip install mango-explorer-v4
Example usage
Assuming that you have a SOL wallet already set up, visit https://app.mango.markets to create a Mango account and fund it so that you can place orders. You can find all available examples here.
import asyncio
from mango_explorer_v4 import MangoClient
async def main():
mango_client = await MangoClient.connect(
secret_key='YOUR_SECRET_KEY',
# Can be the output from Phantom's "Export Private Key"
# Or the byte array output from solana-keygen, as [173,143,69,111 ... 109]
mango_account_pk='YOUR_MANGO_ACCOUNT_PK'
)
print(await mango_client.symbols())
# [
# {
# 'name': 'SOL/USDC',
# 'baseCurrency': 'SOL',
# 'quoteCurrency': 'USDC',
# 'makerFees': -5e-05,
# 'takerFees': 0.0001
# }
# ...
# ]
print(await mango_client.place_order('SOL/USDC', 'bid', 10, 0.1, 'limit'))
# (Refresh the UI to see the newly opened order)
print(await mango_client.orderbook_l2('SOL/USDC', 3))
# {
# 'symbol': 'SOL/USDC',
# 'bids': [
# [11.826, 0.899],
# [11.824, 39.436],
# [11.82, 316.421],
# ],
# 'asks': [
# [11.839, 0.78],
# [11.84, 44.392],
# [11.841, 1.1],
# ]}
print(await mango_client.balances())
# [
# {'symbol': 'USDC', 'balance': 2.7435726906761744},
# {'symbol': 'SOL', 'balance': 0.1690007074236178},
# ...
# ]
asyncio.run(main())
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
mango_explorer_v4-0.5.0.tar.gz
(57.8 kB
view hashes)
Built Distribution
Close
Hashes for mango_explorer_v4-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7caea064f3bea7748e3681a1ccb7852ae869a44cf74e4100ec8f5d6c21c6aab6 |
|
MD5 | 1bd98ea4c1d078634a7105344f9b4970 |
|
BLAKE2b-256 | 24001a285543edffd627fce3a7e6fe3bc960d2e91d97cfc75096c364210c6a5e |