#api-wrapper #api-client #crypto #index #greed #fear

fng_api_wrapper

Crypto Fear and Greed API wrapper

2 stable releases

1.0.1 Apr 16, 2023
1.0.0 Apr 10, 2023

#1026 in Cryptography

MIT license

5KB
73 lines

Crypto Fear and Greed API wrapper

fng-api-wrapper is a Rust API client for Crypto Fear & Greed Index.

The wrapper is incomplete and does not cover the entire API.
So far it only covers the endpoint https://api.alternative.me/fng/

Sample code

use chrono::Datelike;
use fng_api_wrapper::client;

fn main() {
    let fng = client::fetch_daily_fng(10).unwrap();
    fng.data.iter().for_each(|daily_record| {

        let ts = &daily_record.timestamp;
        let (year, month, day) = (ts.year(), ts.month(), ts.day());

        println!(
            "{year}-{month:0>2}-{day:0>2}: {:>2} -> {:?}",
            daily_record.value, daily_record.value_classification
        );
    });
}

Dependencies

~4–11MB
~130K SLoC