Skip to main content

MoC prices source

This is the python package used in Money on Chain projects where it is required to get the coinpair values directly from the sources. This package includes a CLI tool that allows you to query the coinpair values in the same way that Money on Chain projects do.

How to use it in your project

A simple example, do some imports first

user@host:~$ python3 -q
>>> from moc_prices_source import get_price, BTC_USD
>>>

Get de BTC/USD coin pair

>>> get_price(BTC_USD)
Decimal('89561.50000')
>>> 

And that's it!

More usage examples can be seen here

How the included CLI tool looks like

Here you can see how the output of the moc_prices_source_check command looks like

user@host:~$ moc_prices_source_check "BTC/USD*"

Coinpair    V.    Short description    Exchnage     Response        Weight    %  Time
----------  ----  -------------------  -----------  ------------  --------  ---  ------
BTC/USD     och   Bitcoin to Dollar    MOC onchain  $  89.08900K      1     100  1.66s
BTC/USD           Bitcoin to Dollar    Bitfinex     $  89.18400K      0.18   18  214ms
BTC/USD           Bitcoin to Dollar    Bitstamp     $  89.06700K      0.22   22  553ms
BTC/USD           Bitcoin to Dollar    Coinbase     $  89.06769K      0.25   25  261ms
BTC/USD           Bitcoin to Dollar    Gemini       $  89.05753K      0.17   17  787ms
BTC/USD           Bitcoin to Dollar    Kraken       $  89.05310K      0.18   18  226ms
BTC/USDT          Bitcoin to Tether    Binance      ₮  89.19590K      0.65   65  374ms
BTC/USDT          Bitcoin to Tether    Bybit        ₮  89.19105K      0.1    10  467ms
BTC/USDT          Bitcoin to Tether    Huobi        ₮  89.19650K      0.05    5  472ms
BTC/USDT          Bitcoin to Tether    KuCoin       ₮  89.19595K      0.05    5  756ms
BTC/USDT          Bitcoin to Tether    OKX          ₮  89.19965K      0.15   15  759ms

    Coinpair              Value   Sources count    Ok   Time
--  ------------  -------------  ---------------  ----  ------
⇓   BTC/USD       89,067.000000      5 of 5        ✓    787ms
ƒ   BTC/USD(24h)        ▼ 0.25%        N/A         ✓    2.66s
⛓   BTC/USD(och)  89,089.000000      1 of 1        ✓    1.66s
⇓   BTC/USDT      89,195.905000      5 of 5        ✓    759ms

Response time 4.36s

user@host:~$ 

This command has many options. you can run moc_prices_source_check --help to get help on how to run them. More information about this CLI tool can be seen here.

References

Requirements

  • Python 3.12+ support

Installation

From the Python package index (PyPI)

Run:

$ pip3 install moneyonchain-prices-source 

And then run:

$ moc_prices_source_check --version

To verify that it has been installed correctly

From source

Download from Github

Standing inside the folder, run:

$ pip3 install -r requirements.txt 

For install the dependencies and then run:

$ pip3 install .

Finally run:

$ moc_prices_source_check --version

To verify that it has been installed correctly

Supported coinpairs and symbols

Here you can find an summary of supported coinpairs and symbols

Metadata

Release files for moneyonchain-prices-source 0.7.11

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

Source distribution (sdist)

Source distribution for moneyonchain-prices-source 0.7.11
File Size Uploaded Provenance Actions
moneyonchain_prices_source-0.7.11.tar.gz 83.6 kB Without provenance Details for moneyonchain_prices_source-0.7.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moneyonchain-prices-source 0.7.11
File Interpreter ABI Platform Actions
moneyonchain_prices_source-0.7.11-py3-none-any.whl Python 3 none any Details for moneyonchain_prices_source-0.7.11-py3-none-any.whl

Total release size: 235.7 kB

Release files / moneyonchain_prices_source-0.7.11.tar.gz

Download URL moneyonchain_prices_source-0.7.11.tar.gz
Size 83.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cc3fa13995472a361136ee19d43707c9844d866b16bf1054e73463717849c046
BLAKE2b-256 checksum
How to use checksums
469d0e025d3048da6a9db256def17f6f04bea19383f93bdfa92b7b726935cab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / moneyonchain_prices_source-0.7.11-py3-none-any.whl

Download URL moneyonchain_prices_source-0.7.11-py3-none-any.whl
Size 152.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
793355087fcfc57993f0505210ddfbeb939c8498e1ac16770c2849e7ac64fa1e
BLAKE2b-256 checksum
How to use checksums
2ab8dc4ccf2e1a2f34a8ef93693bd1b3adb815588cda462305720d3a8d4e9839
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for moneyonchain-prices-source 0.7.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.11 This release

2 release files No provenance

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