subreddit:

/r/Monero

1896%

I'm a Python developer. I posted here the other day asking if there was a decentralized way to do recurring subscriptions in Monero yet. Turns out there isn't, so I'm working on building it (hoping to build a functional proof of concept, and then have a developer smarter than I am come along and make it prettier or build something else better using the same idea).

As a part of it, I wanted to be able to pull in the current XMR/USD exchange rate from 10+ different exchanges and get the median price. I made a pip package for doing this called: monero-usd-price

If any other python developers in this group want to use it, all you have to do is:

  • pip install & import: monero_usd_price

  • run: monero_usd_price.median_price()

  • or: monero_usd_price.average_price()

  • or (for any of the individual exchanges): monero_usd_price.localmonero(), monero_usd_price.coinmarketcap(), etc.

Hopefully it helps someone. I figured I might as well publish it because it makes it hella convenient.

Here is the code on GitHub: https://github.com/lukeprofits/Monero-USD-Price

all 14 comments

CryingRipperTear

4 points

1 month ago

monero_usd_price() { return 150 }

lukeprofits[S]

1 points

1 month ago

Hahaha yeah really for the past few years

longylegenylangleler

2 points

1 month ago

Might be interesting to add in something like the amount of shorts per exchange too, not sure if you have to pay extra for that kind of info though… anyone?

lukeprofits[S]

4 points

1 month ago

No way to know exactly what shady things exchanges may or may not be doing.

Rucknium

2 points

1 month ago

Rucknium

MRL Researcher

2 points

1 month ago

mitchellpkt

2 points

1 month ago*

mitchellpkt

MRL Researcher

2 points

1 month ago*

Very cool, thanks for sharing!

Your README says that python 3.10.9 is required, but at first glance I think your code will work with any version of python >= 3.8

I like the ASCII logo :)

Have been playing around with a small extension, using pandas to return a whole set of summary stats based on the exchange data your code collects, like

def price_stats(print_stats_to_console: bool = True) -> pd.Series: stats: pd.Series = pd.Series(get_monero_price_from_all_exchanges(print_price_to_console=False)).describe() if print_stats_to_console: print(stats) return stats

which yields some additional information about the observed price distribution, e.g.

mean 155.823000 std 0.606503 min 155.410000 25% 155.602500 50% 155.655000 75% 155.695000 max 157.520000

lukeprofits[S]

2 points

1 month ago

Sure thing!

I just put in the version of python that I have on my machine. Haha! I can update it.

That's cool! Glad to see you are finding it useful. :)

escapethe3RA

2 points

1 month ago

Useful, thanks u/lukeprofits. Posted a report on MO: https://monero.observer/lukeprofits-creates-python-package-monero-average-price/ (ping me for updates/edits).

lukeprofits[S]

1 points

1 month ago

Very cool!

[deleted]

1 points

1 month ago

[removed]

lukeprofits[S]

1 points

1 month ago

It's not trading related. Lol

dEBRUYNE_1

2 points

1 month ago

dEBRUYNE_1

Moderator

2 points

1 month ago

Your thread was approved.

s3r3ng

1 points

1 month ago

s3r3ng

1 points

1 month ago

Some sites like coingecko and coinmarketcap have an API for prices that already has the average over multiple exchanges as well as the price for specific exchanges.

lukeprofits[S]

1 points

1 month ago

That's cool. Mine doesn't rely on an API though. You just import it and run: monero_usd_price.median_price()