Giter Site home page Giter Site logo

scottdurkin / cryptoprice Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 39 KB

CryptoPrice enables developers to obtain real-time prices with very little code. All you need is a free API key and you're good to go.

Home Page: https://twitter.com/CryptoPriceCS

License: MIT License

C# 100.00%

cryptoprice's Introduction

About CryptoPrice

Cryptocurrency is hot right now. It remains unclear how it will perform in the future, but until then, it is the trending topic on the horizon. CryptoPrice is a library to obtain real-time price information on cryptocurrencies. It's .NET implementation is lightweight, fast, and easy to use.

Get started with CryptoPrice

Note: In order to use CryptoPrice, you will need to obtain a free API Key from nomics.com

  1. Insallation .NET CLI:
dotnet add package CryptoPrice --version 0.0.3

Nuget Package: https://www.nuget.org/packages/CryptoPrice/

  1. Once the package is installed add the following to the top of your class.
using CryptoPrice;
  1. Getting the current price of Bitcoin
using System;
using CryptoPrice;
namespace TestNugets
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initalize the library by passing your API key into it.
            CryptoCore _CryptoPrice = new CryptoCore("YOUR_API_KEY");
            
            //Get the current price of Bitcoin
            double BitcoinPrice = _CryptoPrice.GetCryptoPrice("BTC");

            //Output to console
            Console.WriteLine(BitcoinPrice);
        }
    }
}

Console Output

58942.97387688
  1. Configure the currecy you would like to see the price of crypto in.
using CryptoPrice.Currencies;
  1. Setting the currency to Euro.
using System;
using CryptoPrice;
using CryptoPrice.Currencies;
namespace TestNugets
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initalize the library by passing your API key into it.
            CryptoCore _CryptoPrice = new CryptoCore("YOUR_API_KEY");

            //Set the currency for the price return - Default is USD.
            _CryptoPrice.SetCurrency = Fiat.EUR;

            //Get the current price of Bitcoin
            double BitcoinPrice = _CryptoPrice.GetCryptoPrice("BTC");

            //Output to console
            Console.WriteLine(BitcoinPrice);
        }
    }
}

Console Output

52928.63502381
  1. Getting a list of crypto prices
using System;
using CryptoPrice;
using CryptoPrice.Currencies;
using CryptoPrice.Models;

namespace TestNugets
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initalize the library by passing your API key into it.
            CryptoCore _CryptoPrice = new CryptoCore("YOUR_API_KEY");

            //Set the currency for the price return - Default is USD.
            _CryptoPrice.SetCurrency = Fiat.USD;

            //Get a list of Crypto Prices
            String[] Symbols = { Crypto.BNB, Crypto.BTC, Crypto.CAKE, Crypto.ETH, Crypto.SOL, Crypto.GALA };
            PriceList prices = _CryptoPrice.GetCryptoPrices(Symbols);

            //Wrtie prices to console
            foreach (var detail in prices.Prices)
                Console.WriteLine(String.Format("{0} - {1}", detail.Symbol, detail.Price));
        }
    }
}

Console Output

BTC - 57433.14607099
ETH - 4345.36644844
BNB - 615.08581624
SOL - 206.49062392
GALA - 0.70083059
CAKE - 14.22022867

Nuget Package

https://www.nuget.org/packages/CryptoPrice/

cryptoprice's People

Contributors

scottdurkin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.