From 5e9ba9e05da92631ac55f4dd4e117b4686e6a155 Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Sun, 10 Dec 2023 21:14:21 +0100 Subject: [PATCH] Even more README --- README.md | 38 +++++++++++++++++++++++++++++++---- buf.lock | 2 ++ money-gopher.code-workspace | 3 +++ ui/src/lib/gen/mgo_connect.ts | 2 +- ui/src/lib/gen/mgo_pb.ts | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 buf.lock diff --git a/README.md b/README.md index 619451c8..70e1abce 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ The Money Gopher will help you to keep track of your investments. Surely, there are a number of programs and services out there that already manage your portfolio(s), why creating another one? Well there are several -reasons or rather requirements that I need. Note, that these might be very -specific to my use case, but maybe somebody else will appreciate them as well. +reasons or rather requirements that I have. Note, that these might be very +specific to my use-case, but maybe somebody else will appreciate them as well. * 🏘️ I need to manage several portfolios for several distinct people, for example my own and my children's. I want to keep these portfolios completely @@ -69,13 +69,13 @@ After checking out the source-code, the necessary Go binaries can be compiled using `go build ./cmd/moneyd` and can be started using `./moneyd`. It will print out some information, but logging definitely needs to improved. -On startup, an SQLite database named `moneyd.db` will be created (or loaded) in +On startup, an SQLite database named `money.db` will be created (or loaded) in the same directory as the started binary. If the database is empty, a new portfolio named `mybank/myportfolio` and one example security will be created. As a simple check, one can simply interact with the RPC-API with a normal HTTP client, for example to list all portfolios. -```bash +```zsh curl \ --header 'Content-Type: application/json' \ --data '{}' \ @@ -88,6 +88,36 @@ This should print something like the following. {"portfolios":[{"name":"bank/myportfolio","displayName":"My Portfolio"}]} ``` +## Using `mgo` + +Alternatively, a simple CLI called `mgo` can be used. Its preferable to install +it for the current user using `go install ./cmd/mgo`. Afterwards, it can for +example used to display all portfolios with `mgo portfolio list`. + +### Adding Transactions + +To add transactions (buy, sell, etc.) to an existing portfolio, the command `mgo +portfolio transaction create` can be used. The following shows an example for +the security with the ISIN US0378331005. +```zsh +mgo portfolio transactions create US0378331005 --portfolio-name bank/myportfolio --amount 5 --price 120 --time="2022-01-01 10:00" +``` + +When successful, this should print something like the following. + +```zsh +Successfully created a buy transaction (1c12ac28dfbc5440) for security US09075V1026 in bank/myportfolio. +``` + +The unique identifier (also called 'name') of the transaction can be used in +other calls, e.g., to modify it. + +### Available Commands and Shell Completion + +For a detailed list of all available commands see `mgo --help`. The CLI also +supports (basic) shell completion. For details how to activate it, please see +`mgo completion`. + # When is it finished? Since I am working on this in my spare time, it will probably take a while 😃. diff --git a/buf.lock b/buf.lock new file mode 100644 index 00000000..c91b5810 --- /dev/null +++ b/buf.lock @@ -0,0 +1,2 @@ +# Generated by buf. DO NOT EDIT. +version: v1 diff --git a/money-gopher.code-workspace b/money-gopher.code-workspace index a75a227b..f9201ce5 100644 --- a/money-gopher.code-workspace +++ b/money-gopher.code-workspace @@ -22,7 +22,10 @@ "jotaen", "kongcompletion", "modernc", + "moneyd", "moneygopher", + "mybank", + "myportfolio", "oxisto", "portfoliov", "protobuf", diff --git a/ui/src/lib/gen/mgo_connect.ts b/ui/src/lib/gen/mgo_connect.ts index 6afcd499..778250a6 100644 --- a/ui/src/lib/gen/mgo_connect.ts +++ b/ui/src/lib/gen/mgo_connect.ts @@ -1,4 +1,4 @@ -// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=ts" +// @generated by protoc-gen-connect-es v1.1.4 with parameter "target=ts" // @generated from file mgo.proto (package mgo.portfolio.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/ui/src/lib/gen/mgo_pb.ts b/ui/src/lib/gen/mgo_pb.ts index cdbdb436..fad4696c 100644 --- a/ui/src/lib/gen/mgo_pb.ts +++ b/ui/src/lib/gen/mgo_pb.ts @@ -1,4 +1,4 @@ -// @generated by protoc-gen-es v1.4.2 with parameter "target=ts" +// @generated by protoc-gen-es v1.5.1 with parameter "target=ts" // @generated from file mgo.proto (package mgo.portfolio.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck