Skip to content

Toskosz/serverless-tradelog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless tradelog

A serverless REST API built using the AWS-SDK for golang. It has some jwt authentication and CRUD functionalities for the tradelog's. I made this with the intention to have my trading diary available anywhere at any time.

Diagram

Diagram

tradelog

Tradelogs are the logging of the basic data in a day-trade operation in the B3 futures market.

Data Type Meaning
Abertura string Datetime of the start of the operation
Fechamento string Datetime of the end of the operation
Ativo string Asset of the operation
Resultado float32 Result of the operation
Contratos int Number of contracts aka leverage
MEP float32 Maximun positive exposure during operation
MEN float32 Maximun negative exposure during operation
TempoOperacaoSegundos int Duration of op. in seconds
PrecoCompra float32 Buying price
PrecoVenda float32 Selling price
Revisado bool If the op. has been reviewed
Desc string Description of the operation

Environment Variables

To run this project, you will need to add the following environment variables to your lambda environment

AWS_REGION

JWT_SECRET

For best practices purposes JWT_SECRET should be in stored in the secrets manager, but in the spirit of cutting costs it's stored as a environment variable.

API Reference

All calls need to have a API key in the header.

Healthchecks API

  GET /healthcheck

Register new user

  POST /register
Parameter Type
username string
password string

login

  POST /login
Parameter Type
username string
password string

logout

  POST /logout

Get user logs

  GET /api/my/logs/?log-abertura=YYYY-MM-DDTHH:MM:SSZ
Parameter Type Description
log-abertura string Datetime of the start of the operation, if not informed gets all logs

Create log

  POST /my/logs

The following parameters must be in the request body:

Parameter Type
abertura string
fechamento string
ativo string
resultado float
contratos int
mep float
men float
duracao int
preco-compra float
preco-venda float
revisado bool
descricao string

Update log

  PUT /my/logs

The following parameters must be in the request body:

Parameter Type
abertura string
revisado bool
descricao string

Delete specific log

  DELETE /my/logs/?log-abertura=YYYY-MM-DDTHH:MM:SSZ
Parameter Type Description
log-abertura string Datetime of the start of the operation

About

Serverless AWS REST API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages