#货币 #交互 #API #平均 #货币 #信号 #转换

已删除 货币软件

用于与货币API交互的Rust库

0.1.4 2023年5月2日
0.1.3 2023年4月27日
0.1.2 2023年4月23日
0.1.1 2023年4月23日
0.1.0 2023年4月23日

#25 in #货币

每月42次下载

自定义许可

34KB
720

货币软件

Crates.io Build Status

一个用于与货币API交互的Rust库。

用法

将此库添加到您的 Cargo.toml

[dependencies]
currensees = "0.1.3"

认证

use currensees::auth;

// Currency API Authentication
async fn main() {
    let username = "your_username";
    let password = "your_password";

    let result = auth::login(username, password).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

货币

use currensees::currencies;

// Get All Currencies
async fn currencies_get_all() {
    let user_type = "member";
    let username = "your_username";
    let day = "19";
    let month = "04";
    let year = "2024";
    let uuid = None;

    let result = currencies(user_type, username, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get All): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

// Get Currency By ID
async fn currencies_get_by_id() {
    let user_type = "member";
    let username = "your_username";
    let day = "19";
    let month = "04";
    let year = "2023";
    let uuid = Some("currency_uuid");

    let result = currencies(user_type, username, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get By ID): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

历史数据

use currensees::historical;

// Get All Historical Data
async fn historical_get_all() {
    let user_type = "member";
    let username = "your_username";
    let date = "2023_04_02";
    let day = "19";
    let month = "04";
    let year = "2023";
    let uuid = None;

    let result = historical(user_type, username, date, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get All): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

// Get Historical Data By ID
async fn historical_get_by_id() {
    let user_type = "member";
    let username = "your_username";
    let date = "2023_04_02";
    let day = "02";
    let month = "04";
    let year = "2023";
    let uuid = Some("historical_uuid");

    let result = historical(user_type, username, date, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get By ID): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

转换

use currensees::convert;

// Converting between two currencies
async fn main() {
    let user_type = "member";
    let username = "your_username";
    let date = "2023_04_02";
    let base_currency = "GBP";
    let target_currency = "EUR";
    let amount = "500";

    let result = convert::convert(user_type, username, date, base_currency, target_currency, amount).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

全部转换

use currensees::convert_all;

// Converting between two currencies
async fn main() {
    let user_type = "member";
    let username = "your_username";
    let base_currency = "GBP";
    let amount = "500";
    let date = "2023_04_02";

    let result = convert_all::convert_all(user_type, username, base_currency, amount, date).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

每日平均

use currensees::daily_average;

// Retrieve daily average data
async fn main() {
    let user_type = "member";
    let username = "your_username";
    let date = "2023_04_10";

    let result = daily_average::daily_average(user_type, username, date).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

每周平均

use currensees::weekly_average;

// Retrieve weekly average data
async fn main() {
    let user_type = "member";
    let username = "your_username";
    let from_date = "2023_04_03";
    let to_date = "2023_04_07";

    let result = weekly_average::weekly_average(user_type, username, from_date, to_date).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

每月平均

use currensees::monthly_average;

// Retrieve monthly average data
async fn main() {
    let user_type = "member";
    let username = "your_username";
    let year = "2023";
    let month = "04";

    let result = monthly_average::monthly_average(user_type, username, year, month).await;

    match result {
        Ok(response) => println!("Received response: {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

边际和价差

use currensees::margins_spreads;

// Get All Margins and Spreads
pub async fn margins_spreads_get_all() {
    let user_type = "member";
    let username = "your_username";
    let day = "19";
    let month = "04";
    let year = "2023";
    let uuid = None;

    let result = margins_spreads(user_type, username, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get All): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

// Get Margins and Spreads By ID
pub async fn margins_spreads_get_by_id() {
    let user_type = "member";
    let username = "your_username";
    let day = "19";
    let month = "04";
    let year = "2023";
    let uuid = Some("margins_spreads_uuid");

    let result = margins_spreads(user_type, username, day, month, year, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get By ID): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

性能

use currensees::performances;

// Get All Performances
pub async fn performances_get_all() {
    let user_type = "member";
    let username = "your_username";
    let uuid = None;

    let result = performances(user_type, username, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get All): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

// Get Performances By ID
pub async fn performances_get_by_id() {
    let user_type = "member";
    let username = "your_username";
    let uuid = Some("performances_uuid");

    let result = performances(user_type, username, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get By ID): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

信号

use currensees::signals;

// Get All Signals
pub async fn signals_get_all() {
    let user_type = "member";
    let username = "your_username";
    let uuid = None;

    let result = signals(user_type, username, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get All): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

// Get Signals By ID
pub async fn signals_get_by_id() {
    let user_type = "member";
    let username = "your_username";
    let uuid = Some("signals_uuid");

    let result = signals(user_type, username, uuid).await;

    match result {
        Ok(response) => println!("Received response (Get By ID): {:?}", response),
        Err(error) => println!("Error: {:?}", error),
    }
}

设置货币API账户

在此订阅用户账户。

使用货币API

您可以通过阅读API文档了解货币API能做什么。如果您需要进一步的帮助,请不要犹豫,联系我们

许可

本项目采用BSD 3-Clause License许可。

(c) 2020 - 2023 Moat Systems Limited.

依赖项

~6–18MB
~269K SLoC