https://github.com/blandger/crypto-ltp-example
Simple example accessing kraken crypto stock from rest api actix-web server
https://github.com/blandger/crypto-ltp-example
actix-web api docker kraken reqwest rest rust
Last synced: 15 days ago
JSON representation
Simple example accessing kraken crypto stock from rest api actix-web server
- Host: GitHub
- URL: https://github.com/blandger/crypto-ltp-example
- Owner: blandger
- License: mit
- Created: 2024-04-24T17:06:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T06:55:58.000Z (about 2 years ago)
- Last Synced: 2025-04-06T07:47:20.128Z (about 1 year ago)
- Topics: actix-web, api, docker, kraken, reqwest, rest, rust
- Language: Rust
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crypto-ltp-example
Simple example accessing crypto stock from rest api server
# Prerequisite installation
### Install Rust compiler
Use any suitable approach to [Rust compiler](https://www.rust-lang.org/tools/install). Then check it using command below
>cargo --version
The output should be something like :
```
cargo 1.77.2 (e52e36006 2024-03-26)
```
## Docker (with docker compose)
### Install Docker + docker compose tools into your system
See how to install it [from Docker guide/doc](https://docs.docker.com/engine/install/)
## Build docker image
> docker build -t crypto-ltp-example:v1 .
> docker build --no-cache -t crypto-ltp-example:v1 .
## Run docker image
> docker network create --driver bridge mynetwork
> docker run -p 8080:8080 -it --network mynetwork crypto-ltp-example:v1
OR
> docker run -p 8080:8080 -it --net=host crypto-ltp-example:v1
## Testing REST API
Deployed application API is accessible by URL: http://127.0.0.1:8080/api/v1/ltp
## Possible compile errors
### Windows 10
failed to run custom build command for `openssl-sys v0.9.102`
The possible solution to build 'openssl' library is available [by a link](https://github.com/sfackler/rust-openssl/issues/1086#issue-422065024)
### Other possible errors
If you see below error in running docker container
```
ERROR crypto_ltp_example::routes::last_trade_price] Not fetched pair = "BTC/USD" due to error: Connect is failed: error sending request for url (https://api.kraken.com/0/public/Ticker?pair=BTCUSD)
```
There are number of reasons possible that prevent internal container code to access external internet (firewall, network settings). There is no one solution for all OS and situations, sorry.