Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finance Wallet Rust

This is a small project for learning more Rust. It is a rewrite of this project started in Go by my friend Marcelo metal Jorge Vieira.

Building and running

This package uses Rocket, which currently only builds with Rust nightly. This is about to change but, for now, if you are using rustup make sure you have the nightly toolchain installed and run this on the project's directory:

rustup override set nightly

Otherwise make sure you always add +nightly when calling cargo. The following command will build and run the HTTP server:

cargo +nightly run

If all goes well you should now be able to look at the Swagger UI nicely provided by rocket-okapi:

http://localhost:8000/swagger-ui/

Examples:

Adding stock operations:

curl \
  http://localhost:8000/stocks/operations \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "portfolio": "default", "symbol": "PETR4", "type": "purchase", "broker": "Clear",
    "quantity": 500, "price": 10, "time": "2020-04-24T00:00:00Z", "fees": 0
    }'
curl \
  http://localhost:8000/stocks/operations \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "portfolio": "default", "symbol": "PETR4", "type": "sale", "broker": "Clear",
    "quantity": 500, "price": 10, "time": "2020-04-24T00:00:00Z", "fees": 0
    }'

Obtaining the current position for a stock

curl \
  http://localhost:8000/stocks/position/PETR4

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages