Skip to content

Latest commit

 

History

History
158 lines (116 loc) · 3.65 KB

README.EN.md

File metadata and controls

158 lines (116 loc) · 3.65 KB

DAO - Local economic database

Local indicator system based on publicly available information for easy viewing and compiling of indicators to track economic trends

English | 简体中文

Table of Contents

💻 Getting Started

To get a local copy up and running, follow these steps.

Prerequisites

In order to run this project you need:

install chrome:

 sudo wget <http://www.linuxidc.com/files/repo/google-chrome.list> -P /etc/apt/sources.list.d/

 wget -q -O - <https://dl.google.com/linux/linux_signing_key.pub>  | sudo apt-key add -

 sudo apt-get update

 sudo apt-get install google-chrome-stable
   go get -u github.com/bufbuild/buf/cmd/buf
   go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
   go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
   go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
   go get -u google.golang.org/protobuf/cmd/protoc-gen-go

Setup

Clone this repository to your desired folder:

  cd my-folder
  git clone https://github.com/chenhaonan-eth/dao.git

Install

Install this project with:

  cd dao
  make build

Run

To run the project, execute the following command:

    make start

Usage

 # HTTP
 curl -X GET http://localhost:50053/v1/macroscopic/FuturesForeignHist/CAD
 // gRPC
 package main

 import (
     "log"

     pb "github.com/chenhaonan-eth/dao/proto/server"
     "golang.org/x/net/context"
     "google.golang.org/grpc"
     "google.golang.org/grpc/credentials/insecure"
 )

 func main() {
     conn, err := grpc.Dial(":50052", grpc.WithTransportCredentials(insecure.NewCredentials()))
     if err != nil {
         log.Fatal(err)
     }
     defer conn.Close()
     c := pb.NewGreeterClient(conn)
     context := context.Background()
     body := &pb.FturesFoewignRequest{
         Symbol: "CAD",
     }

     r, err := c.GetFuturesForeignHist(context, body)
     if err != nil {
         log.Println(err)
     }
     log.Println(r.Results)
 }

Directory

 ├─ biz            // 业务处理
 ├─ client         // gRPC 客户端演示
 ├─ cmd
 │  ├─ app         //cobra
 │  ├─ gormgen     //生成DB代码
 ├─ config         //zaplog、viper
 ├─ dal
 │  ├─ initialize  //初始化数据库
 │  ├─ model       //存放所有数据模型
 │  ├─ query       //gorm-gen生成的CURD代码
 ├─ economic       //经济指标数据获取
 │  ├─ ftures      //期货
 │  ├─ macroscopic //宏观经济
 ├─ pkg            //外部包
 ├─ proto          //gRPC、grpc-gateway生成的代码
 ├─ server         //gRPC、grpc-gateway服务
 ├─ spider         //定时爬虫更新数据

Swagger Ui

http://0.0.0.0:50053/openapiv2/server.swagger.json

http://0.0.0.0:50053/swagger-ui/

Thanks

Akshare

数据均来自网络公开数据。

License

License: MIT

Show your support

Give a ⭐️ if this project helped you!