Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrewjbateman/angular-app-crypto

:clipboard: Angular app to get crypto currency price data from a CryptoCompare API.
https://github.com/andrewjbateman/angular-app-crypto

angular angular13 api crypto cryptocompare cryptocurrency css html5 mapping pipelines rxjs7 tutorial-code visual-studio-code

Last synced: about 2 months ago
JSON representation

:clipboard: Angular app to get crypto currency price data from a CryptoCompare API.

Awesome Lists containing this project

README

        

# :zap: Angular App Crypto

* App to get crypto currency price data from a [CryptoCompare](https://min-api.cryptocompare.com/) API.
* Code from [Gary Simon at DesignCourse](https://www.youtube.com/channel/UCVyRiMvfUNMA1UPlDPzG5Ow) - see [:clap: Inspiration](#clap-inspiration) below.
* **Note:** to open web links in a new window use: _ctrl+click on link_

![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/angular-app-crypto?style=plastic)
![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/angular-app-crypto?style=plastic)
![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/angular-app-crypto?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/angular-app-crypto?style=plastic)

## :page_facing_up: Table of contents

* [:zap: Angular App Crypto](#zap-angular-app-crypto)
* [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)
* [:books: General info](#books-general-info)
* [:camera: Screenshots](#camera-screenshots)
* [:signal_strength: Technologies](#signal_strength-technologies)
* [:floppy_disk: Setup](#floppy_disk-setup)
* [:computer: Code Examples](#computer-code-examples)
* [:cool: Features](#cool-features)
* [:clipboard: Status & To-Do List](#clipboard-status--to-do-list)
* [:clap: Inspiration](#clap-inspiration)
* [:envelope: Contact](#envelope-contact)

## :books: General info

* Angular httpClient used to get API data
* Data displayed using one-way data-binding and an \*ngFor loop
* Separate `data.service.ts` file used to get API price data. This data is subscribed to in `app.component.ts`

## :camera: Screenshots

![Example screenshot](./img/crypto-euro.png).

## :signal_strength: Technologies

* [Angular v13](https://angular.io/)
* [RxJS Library v7](https://angular.io/guide/rx-library) used to [subscribe](http://reactivex.io/documentation/operators/subscribe.html) to the [observable](http://reactivex.io/documentation/observable.html)

## :floppy_disk: Setup

* Install dependencies using `npm i`.
* Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## :computer: Code Examples

* `data.service.ts` using httpClient service with a `getPrices()` function to get crypto currency details from the API.

```typescript
@Injectable()
export class DataService {
result: any;
currencyCode: string;
display: string;

constructor(private http: HttpClient) {}

// function to get crypto prices in euro from the API - no API key required.
getPrices() {
const fsymsList =
"BTC,XRP,BCH,ETH,ZEC,EOS,XMR,ETC,LTC,DASH,QTUM,NEO,XLM,TRX,ADA,BTS,USDT,XUC,PAX,IOT";
return this.http
.get(
"https://min-api.cryptocompare.com/data/pricemulti?fsyms=" +
fsymsList +
"&tsyms=EUR"
)
.pipe(map((result) => (this.result = result)));
}
}
```

## :cool: Features

* Angular httpClient used to get data from an external API.
* [Angular currency pipe](https://angular.io/api/common/CurrencyPipe) & [rxjs map operator](https://angular.io/guide/rx-library) used to extract currency data and display it to the correct format.
* Dependencies updated with 0 dependency vulnerabilities.

## :clipboard: Status & To-Do List

* Status: Working
* To-Do: Nothing

## :clap: Inspiration

* [Angular CryptoCurrency Tutorial - Display Exchange Data with an API](https://www.youtube.com/watch?v=U3INaC0leXg&t=589s)

## :file_folder: License

* This project is licensed under the terms of the MIT license.

## :envelope: Contact

* Repo created by [ABateman](https://github.com/AndrewJBateman), email: [email protected]