Controtto

by contre95
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Supports configuration through environment variables stored in .env files for simplified setup and configuration.

  • Fetches cryptocurrency price data from Binance's public API to calculate asset values and profit/loss metrics.

  • Provides a container image available on Docker's public registry for easy deployment and management.

📊 コントロット

Go、HTML、 JavaScriptなしで作成された、セルフホスト型の損益トラッカーです。Controttoは、トランザクションを追跡してSQLiteファイルに保存し、以下のような様々な計算結果を返します。

  • 平均購入価格
  • 現在の資産価値
  • 取引履歴
  • 輸入/輸出取引(サンプル参照)
  • 損益

資産の価格を取得するために、Controtto は主に 4 つの API に依存しています (コードを参照)。

  • Binance - パブリック API、トークンは不要です。
  • BingX - パブリック API、トークンは必要ありません。
  • Alpha Vantage - 株式、無料ですがレート制限が短いです。(トークンを取得してCONTROTTO_AVANTAGE_TOKENを設定してください)
  • Tiingo - 株式、暗号通貨、外国為替。(アカウント/トークンを作成しCONTROTTO_TIINGO_TOKENを設定してください)

デモ

また、 demo.contre.ioでデモを確認することもできます。データベースは 1 時間ごとにリセットされます。

すべての設定は.envファイルで設定され、環境変数として渡されます。変数CONTROTTO_PORTCONTROTTO_DB_PATHが利用可能です。

# Install the dependencies go mod tidy # Set the .env mv .env.example .env # Source the env variables . <(cat .env | grep -v -e '^$' | grep -v "#" | awk '{}')

ビルドと実行

go run ./cmd/main.go # go build ./cmd/main.go to just build it

開発環境

go install github.com/cosmtrek/air@latest # Download air air -c air.toml

そしてlocalhost:3000にアクセスします

ポッドマンで走る

コンテナイメージはDockerのパブリックレジストリから入手できます。Dockerを使用する場合は、 podmandockerに置き換えるだけです。

mkdir data podman container run --rm -p 8000:8000 -v $(pwd)/data:/data contre95/controtto

テストを実行する

go test -cover ./... # Expected result # ? controtto/cmd [no test files] # ? controtto/src/app/managing [no test files] # ? controtto/src/domain/pnl [no test files] # ? controtto/src/gateways/markets [no test files] # ? controtto/src/gateways/sqlite [no test files] # ? controtto/src/presenters [no test files] # ok controtto/src/app/querying 0.003s coverage: 40.7% of statements

やるべきこと

  • さらなるテスト
  • ログとメトリックのラッパーも便利です。
  • 総純資産を追跡するためにアカウントを追加します。
  • すべての CSS を削除し、カスタムstyle.css + Tailwind CDN を使用します。
-
security - not tested
A
license - permissive license
-
quality - not tested

Golang コードを解釈し、最も厳格な DDD とクリーン アーキテクチャ パラギドムに基づいて判断することができます。

  1. Demo
    1. Build and Run
      1. Development env
        1. Run with Podman
          1. Run tests
            1. TODO
          ID: 10z262ljps