Giter VIP home page Giter VIP logo

rate.sx's Introduction

rate.sx — console service for exploring (crypto)currencies exchange rates

Features

  • realtime¹ currencies and cryptocurrencies exchange rates information
  • (crypto)currencies converter and calculator
  • historical² exchange rates graphical representation
  • clean, concise and very fast³ interface
  • available everywhere, no installation needed

Usage

To get information about current exchange rates and market capitalization of the top ten cryptocoins in shell:

  $ curl rate.sx

rate.sx screenshot

By default, all rates are represented in USD. To use some other currency, specify it in the domain name (lower-, upper- or mixed-case):

  $ curl eur.rate.sx

Also, you can use rate.sx as (crypto)currency converter/calculator. To convert some amount of (crypto)currencies into other (crypto)currency, you have to specify the amount in the query line, after rate.sx/.

For example, to convert 10 Bitcoins (BTC) into US Dollars do:

  $ curl rate.sx/10BTC

(WARNING: This feature is currently not supported. See #70) You can also combine different currencies and cryptocurrencies in the same query:

  $ curl eur.rate.sx/1BTC+1BCH+1BTG       # convert sum of the Bitcoins (BTC, BCH and BTG) into Euro (EUR)
  $ curl rub.rate.sx/100ETH               # convert 100 ETH into Russian ruble (RUB)
  $ curl rate.sx/1BTC-10ETH               # compare what is more: 1 BTC or 10 ETH

To show how cryptocurrency exchange rate was changing in time, specify name of the cryptocurrency in the URL.

For example, for Ethereum (ETH):

  $ curl rate.sx/eth

By default, data for the last 24 hours is displayed, but you can specify any³ other interval, using the @range notation (more on it below, in the Interval specification section).

rate.sx screenshot with plot

To display output in some other currency (USD is used by default) or to compare a cryptocurrency with another cryptocurrency, specify it in the domain name or after / in the query:

  $ curl rate.sx/eth@30d                # Ethereum to USD rate for the last 30 days
  $ curl eur.rate.sx/btc@february       # How Bitcoin (BTC) price in EUR changed in February
  $ curl xlm.rate.sx/xrp@01-Feb-2018..  # Is it true that 1 XRP (Ripple) costs 3 XLM (Stellar) since Feb 1?

The time interval can be specified in many various ways. Though, most of them are intuitively clear, consult the Interval specification section just to see what interval formats are supported.

You can get the service in a web browser (though it is not its primary user interface), just type rate.sx in the location bar for that.

Supported currencies and cryptocurrencies

You can find actual list of the supported currencies in /:currencies and cryptocurrencies in /:coins. 32 different currencies and 500 most popular crypto currencies are supported at the moment.

Options

For the list of all supported options see /:help:

  $ curl rate.sx/:help

The most important options:

n=NUMBER            number of cryptocurrencies to show (10 by default)

Options are specified after the ? sign in the URL. They can be separated using the & sign (don't forget to escape or to quote it in the shell, because it is a special shell symbol).

  $ curl btc.rate.sx/?n=30

Interval specification

When showing exchange rates historical data, data for the last 24 hours is displayed by default. To use other time interval you have to specify it in the url after coin name, separated with the @ sign.

For example, to get info for the last 4 days, add @4d:

 $  curl rate.sx/eth@4d

The following time intervals specfiers are supported:

    s   Second
    m   Minute
    h   Hour
    d   Day (24 hours)
    w   Week
    M   Month (30 days)
    y   Year (365 days)

The specifiers have to be prefixed with an integer number (even if it is equal to 1) and can be combined together:

    10d     # 10 days
    2w4d    # 2 weeks and 4 days
    1h30m   # 1 hour and 30 minutes

In all these cases you specify the starting point of the interval, and the end is always the current time. That means, that information for the last time is shown.

You can specify some range in the past. There are three options for that:

  1. You specify the starting and the stopping date (and/or if needed time) separated with .. (the stopping date can be omited):
    10d..5d                     # from 10 days ago to 5 days ago
    2018-01-10..2018-01-20      # from 2018-01-10 to 2018-01-20
    2018-03-15+12:00..          # from 2018-03-15 12:00 till now
  1. You specify the starting (or stopping) date/time and the delta separated with +, - or +-:
    2018-03-01+-3d              # March 01 and +- 3 days around it
    2018-03-15+1w      			# one week starting from 2018-03-15
    2018-03-25-2w          		# two weeks to 2018-03-25
  1. You can specify some time range, and rate.sx try to guess what do you mean:
    February                    # the whole February (this year)
    02-Feb                      # the whole day, February 2 (this year)
    Март                        # you can even use other languages (Март is March in Russian)

Don't afraid to be too inventive. If rate.sx can't parse your date, it will say about it. The toplevel interval grammar is summarized below.

rate.sx screenshot with plot and interval In this output, exchange rate of IOTA (MIOTA) to Euro (EUR) in March 2018 is displayed.

Interval specifications grammar:

    LENGTH
    DATETIME
    DATETIME..[DATETIME]
    DATETIME+LENGTH
    DATETIME-LENGTH
    DATETIME+-LENGTH

Output units

By default, rate.sx shows rates of cryptocurrencies to USD (or any other currency if it is specified in the query as show above). It is possible to use a crypto currency as the unit. Keep in mind, that in the changes columns (and in the sparklines) difference to the historical rates is displayed, and not to the current rate. That is obviously the reason why spark for the rate currency to the same currency is always 1 (and change is 0).

This mode can be used to compare some cryptocurrency with the rest. Say, if we want to see, what cryptocurrencies are falling not so fast comparing to BTC (picture is done during the January 2018 correction):

btc.rate.sx/?n=30

We see here that nothing (except ARDR) from the top 30 (because we use ?n=30 here) is falling slower than BTC (USDT is obviously an exception). If we would use normal USD/EUR/GBP output, we could not find this out (at least not instantly).

Disclaimer

Though rate.sx synchronizes with online cryptocurrencies exchanges every five minutes, we cannot guarantee absolute accuracy of the displayed exchange rates. You should always confirm current rates before making any transactions that could be affected by changes in the exchange rates. Cryptocurrency rates based on the data provided by exchanges APIs. All rates are for information purposes only and are subject to change without prior notice. Since rates for actual transactions may vary, we are not offering to enter into any transaction at any rate displayed. Displayed rates are composite prices and not intended to be used for investment purposes.

Integration

GNU Emacs

rate-sx.el — rate.sx in Emacs (courtesy of Dave Pearson @davep)

rate-sx.el screenshot

Footnotes

  1. Data update interval is 5 minutes (300 seconds)
  2. Historical data covers the range starting on 07 Jan 2018
  3. 99.9% of all queries are processed within 150ms

rate.sx Server Installation

If you want to install the rate.sx server, you can do it. Keep in mind that you need some data datasource. A server without data is useless (of course, you can always use rate.sx as the datasource, though the point of such a strange configuration is not clear).

Install rate.sx server

git clone github.com/chubin/rate.sx
cd rate.sx
virtualenv ve
ve/bin/pip install -r requirements.txt
ve/bin/python bin/srv.py

Configure HTTP-frontend service

Configure the web server, that will be used to access the service (if you want to use a web frontend; it's recommended):

server {
    listen [::]:80;
    server_name  rate.sx *.rate.sx;
    access_log  /var/log/nginx/rate.sx-access.log  main;
    error_log  /var/log/nginx/rate.sx-error.log;

    location / {
        proxy_pass         http://127.0.0.1:8004;

        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $remote_addr;

        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;

        expires                    off;
    }
}

rate.sx's People

Contributors

0xflotus avatar asymmetric avatar brlipi avatar cclauss avatar chubin avatar cypherius17 avatar goznalo-git avatar jerzybrzoska avatar kasramp avatar lukesmithxyz avatar smartm0use avatar stigi avatar turbo-cafe avatar yellowred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rate.sx's Issues

Feature Request: Side by Side of two charts

While I can do this with in bash by simply using a paste command (paste <(curl -s rate.sx/BTC) <(curl -s rate.sx/DOGE)), the spacing between chart elements above and below the chart is lacking. For most part it's like a tab separation (probably because of paste's default -d option being set to the tab character)

I was wondering if there was anyway to move the information from the second chart to align with the second chart.

Ticker for stocks

Hi there!

We met each other on Twitter. I would like to use this handy tool for stocks. I found a very good stock API:

For example, I use the ticker AAPL for the stock Apple, and MSFT for the stock MSFT. The query looks like this:

https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US&region=US&corsDomain=finance.yahoo.com&symbols=AAPL,MSFT

I get the data back in JSON format. So I'm trying to use that API in your rate.sx.

When looking on the codebase, it seems the script uses Coinmarketcap's API to collect the data.When I tried to collect the data from the API of coinmarketcap, with the URL https://api.coinmarketcap.com/v1/ticker/ or https://api.coinmarketcap.com/v1/ticker/ETH I get an error

{"code": "410 Gone", "reason": "We no longer serving this endpoint here" }

But the script is still running fine however. Perhaps I'm missing something?

Remove numbers after decimal?!

Would wish there was an option to remove decimals and all numbers after. I'm not interested in the whole number because I'm having this in my tmux config.

Didn't see any option for this if this maybe is easy to implement?

curl rate.sx/avax not working

Hello, I can't curl for avax coin
I mean, when I run
$ curl 'rate.sx?n=30'

The result shows Avax
image

But
$ curl 'rate.sx/avax'
not works as expected
image

Prints Dollar Sign for any currency

Hi,
since .. like 2 hours ago I get a $ sign instead of € sign when I query like this:
curl eur.rate.sx/xmr
... begin: $219.01 (Thu 27 00:10) // end: $205.60 (Fri 28 00:00)~ ...

Possible Bogus Value at Specific Date

Hello, for a few weeks now I've noticed that December 14th has a strange and extraordinarily large value for multiple coins; in fact, every one that I've tested.
Is this something wrong on my end? I feel that this would have been brought up already if that wasn't the case.
I've tested this on an Arch and Gentoo installation, with several terminals, as well as on an iPhone.
Curious to see if this is affecting anyone else.
dec14

Invalid coin/currency name: USD

Hi! Awesome project!

Any reason why rate.sx can't graph currencies against currencies?

For example, the following doesn't work:

$ curl brl.rate.sx/usd@1d
ERROR: Invalid coin/currency name: USD

While curl brl.rate.sx/btc@1d and curl brl.rate.sx/1usd work fine.

Thank you.

No Ravencoin?

Ravencoin is in top 100
Can I get a graph for RVN?
curl rate.sx/rvn
prints out ERROR: Invalid coin/currency name: RVN

Invalid coin/currency name: USD

Hi! Awesome project!

Any reason why rate.sx can't graph currencies against currencies?

For example, the following doesn't work:

$ curl brl.rate.sx/usd@id
ERROR: Invalid coin/currency name: USD

While curl brl.rate.sx/btc@id works fine.

Thank you.

Feature Request: Single line currency summary

I think it would be useful to have a single line summary for a given currency. I am interested in this so I can display cryptocurrency information in i3blocks. I was thinking it would have the current value of the coin and the 24 hour % change.

If this feature would be accepted, and it does not already exist, I can create a PR to add it.

JSON output

Hello,

I'm BM. A very nice and polite guy.

Feature requests:

  1. Choosing which columns to display. For example I don't want the graph in the rightmost column.

  2. Output as plain text. When I try to use curl rate.sx > rates.txt the valuable data gets obscured by all the formatting. It's currently not possible to do that. Please make it so that we can simply choose the data we want and output to plain text without coloring, lines, graphics etc. Example:

BTC. Price: 39000. Changes +1%
ETH. Price: 2000. Changes +2%

Thanks.

Add https support

 curl -vvvv rate.sx
* Rebuilt URL to: rate.sx/
*   Trying 5.9.243.188...
* TCP_NODELAY set
* connect to 5.9.243.188 port 443 failed: Connection refused
* Failed to connect to rate.sx port 443: Connection refused
* Closing connection 0
curl: (7) Failed to connect to rate.sx port 443: Connection refused
❯ curl --version
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0 (+libidn2/2.0.2) librtmp/2.3
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL

not updating?

since around 22:30 18th August 2022 it seems all the data is the same, nothing is updating?

Thanks

SSL certificate has expired - https

Is it on my end, or is this the result for everyone?
Output of:

$ curl https://rate.sx

curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Call to get list of supported currencies

From the help page:

Supported currencies:

    USD, AUD, CAD, CHF, CNY, EUR, GBP, IDR, JPY, KRW, RUB

It could be useful for other code that uses rate.sx if this list could be pulled from a URL, perhaps ideally with descriptions of currencies. If that were available then code like this wouldn't be necessary and third party code won't need to be updated any time you add another currency.

Uniswap (UNI) and Filecoin (FIL) support?

Does rate.sx support UNI and FIL?

I tried curl rate.sx/fil and curl rate.sx/uni, and I'm getting ERROR: Invalid coin/currency name.

If there's no support, will it be possible to add it?

Fiat currencies except USD are not supported

curl eur.rate.sx/xmr

returns

`

<title>500 Internal Server Error</title>

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

`

Bug: doesn't seem to handle arguments

I really love your different APIs and tools. They are really reat.

I am trying to use it on my ncurses status window, but can't get output without ANSI colors:
http://rate.sx/?T
giving me this output:
image

same with: curl 'rate.sx/?qT&n=20' which displays both footer and header, which seems to be a bug. the n argument, however, works. It just seems to be "T" and "q". also would it be possible to add the "f" argument to rate.sx, much like on wttr.in, not that i don't want to subscribe to your twitter, but i don't need to be reminded when ever i am checking the weather.

Hope you have a possibility to fix it,

Blocky charts

Hi,

There must be something wrong with my terminal configuration (maybe the fonts?), because this is how charts render:

2018-12-25-121202_1920x1080_scrot

I'm using alacritty with the hack font.

Let me know if there's any other config that could help debug the issue.

Add The Utility Bixos Token (UBXS)

We often use rate.sx in the office and we got pretty used to the ease and smart design it provides. Now we need rate.sx services for the calculations, tracking and daily use for our own token that we released to the market which has a great project behind it. Can you please include UBXS in rate.sx?

Output in ASCII

Hi

I think it would be a good idea to allow the user to get the output in ASCII rather than Unicode (Some terminals are this dumb)

Thanks!

Malformed request kills server

I was accidently found out that malformed request kills server with 504 Gateway Time-out error.
Request example ("h" char in place of number parameter):
curl rate.sx/btc@hh

Graph endpoint produces HTML instead of ascii/ansi with powershell

Invoke-WebRequest rate.sx/eth
<html>
<head><title>rate.sx</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="/files/style.css" />
<link rel="stylesheet" type="text/css" href="/files/fonts/stylesheet.css" />
<style type="text/css">
.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }
.ef1,.f1 { color: #CD0000; } .eb1,.b1 { background-color: #CD0000; }
.ef2,.f2 { color: #00CD00; } .eb2,.b2 { background-color: #00CD00; }
.ef3,.f3 { color: #CDCD00; } .eb3,.b3 { background-color: #CDCD00; }
.ef4,.f4 { color: #0000EE; } .eb4,.b4 { background-color: #0000EE; }
.ef5,.f5 { color: #CD00CD; } .eb5,.b5 { background-color: #CD00CD; }
.ef6,.f6 { color: #00CDCD; } .eb6,.b6 { background-color: #00CDCD; }
.ef7,.f7 { color: #E5E5E5; } .eb7,.b7 { background-color: #E5E5E5; }

PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.2.3
PSEdition                      Core
GitCommitId                    7.2.3
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Default to HTTPS

It would be cool if the rate.sx defaulted to HTTPS. AFAIK two ways of doing this would be 301 redirects or HSTS.

ERROR: Invalid coin/currency name: VET

VET is currently ranked at #34 but not supported by rate.sx :

curl rate.sx/\?n=40 | grep VET
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 26880  100 26880    0     0  30494      0 --:--:-- --:--:-- --:--:-- 30720
│ 34   │ VET   │ 0.0165256   │ 3.31%        │ 1.14%       │ 1.198B           │ ▁▃▁▂▇▂▂▃▂▇▁▅ │

When you try to get rate specific for VET

curl rate.sx/vet
ERROR: Invalid coin/currency name: VET

This is a similar issue with #63 and #65 ..

Not working for currencies

$ curl https://rate.sx/jpy
ERROR: No data found for your query. Wrong range?

$ curl https://rate.sx/eur
ERROR: No data found for your query. Wrong range?

For USD bug, see #60

Dependency missing prevents building from source

Currently termdata is missing from Pypi so its not possible to source from requirements.txt. Has this dependency changed names? Punching it into search engines has turned up nothing, I can't seem to find an archive of it, or a description of what it did.

Missing lines in chart

https://uplr.it/d9820.png

There seems to be some missing lines for doge@1y. Is this missing data (expected) or a bug in the renderer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.