Browse Source

deploy build.sh

main
strange 7 months ago
parent
commit
88b45b775b
  1. 6
      .vscode/launch.json
  2. 2
      README.md
  3. 40
      api/gateway.proto
  4. 15
      build-all.sh
  5. 16
      build.sh
  6. 1
      generate.go
  7. 34
      internal/gateway/gateway_postal_grpc_server.go

6
.vscode/launch.json vendored

@ -5,13 +5,13 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "sig-admin", "name": "admin",
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "auto", "mode": "auto",
"program": "${workspaceFolder}/cmd/sig-admin", "program": "${workspaceFolder}/cmd/admin",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"output": "${workspaceFolder}/run/sig-admin", "output": "${workspaceFolder}/run/admin",
}, },
{ {
"name": "market", "name": "market",

2
README.md

@ -146,3 +146,5 @@ page design:
- 回测页: 交易策略, 跑策略, 结果绘图 - 回测页: 交易策略, 跑策略, 结果绘图
- 交易计划: 交易策略 -> 交易所,币种,驱动周期 -> risk, sig, close, trade_strategy_param - 交易计划: 交易策略 -> 交易所,币种,驱动周期 -> risk, sig, close, trade_strategy_param
- 参数遍历回测 - 参数遍历回测
对目标目标k线时序段前的k线进行特征提取, 再进行回测评估, 反复迭代得到Alpha

40
api/gateway.proto

@ -0,0 +1,40 @@
syntax = "proto3";
option go_package = "./pb";
//
service GatewayPostal {
// 使
rpc DeliverStream(stream ReqDeliver) returns (ResDeliver);
//
rpc Deliver(ReqDeliver) returns (ResDeliver);
//
rpc DeliverBatch(ReqDeliverBatch) returns (ResDeliver);
}
message Message {
int64 time = 3;
string target = 4; // handler
bytes body = 15; // protobuf bytes
}
message ReqDeliver {
string receiver = 1;
Message msg = 2;
bool sync = 7; // , false立即返回放到队列消费投递
}
message ResDeliver {
bool ok = 1;
int32 code = 2;
string msg = 3;
}
message ReqDeliverBatch {
repeated string receivers = 1;
Message msg = 2;
bool sync = 7;
}

15
build-all.sh

@ -1,7 +1,12 @@
#! /bin/bash #! /bin/bash
./build.sh market 1.0 \ # ./build-all.sh 1.0 hub.docker.com
&& ./build.sh exchange 1.0 \
&& ./build.sh gateway 1.0 \ VERSION=$1
&& ./build.sh admin 1.0 \ DOMAIN=$2
&& ./build.sh trading 1.0
./build.sh market $VERSION $DOMAIN \
&& ./build.sh exchange $VERSION $DOMAIN \
&& ./build.sh gateway $VERSION $DOMAIN \
&& ./build.sh admin $VERSION $DOMAIN \
&& ./build.sh trading $VERSION $DOMAIN

16
build.sh

@ -1,9 +1,10 @@
#! /bin/bash #! /bin/bash
# ./build.sh exchange 1.0 # ./build.sh exchange 1.0 domain
APP=$1 APP=$1
DOCKER_IMAGE_VERSION=$2 VERSION=$2
DOMAIN=$3
GO111MODULE=on GO111MODULE=on
CGO_ENABLED=0 CGO_ENABLED=0
GOOS=linux GOOS=linux
@ -11,10 +12,15 @@ GOARCH=amd64
go build -o target/$APP cmd/$APP/main.go go build -o target/$APP cmd/$APP/main.go
if [ -n "$DOCKER_IMAGE_VERSION" ]; then if [ -n "$VERSION" ]; then
echo "docker build -t sig-$APP:$DOCKER_IMAGE_VERSION --build-arg APP=$APP ."
cp -f /usr/share/zoneinfo/Asia/Shanghai ./localtime cp -f /usr/share/zoneinfo/Asia/Shanghai ./localtime
docker build -t sig-$APP:$DOCKER_IMAGE_VERSION --build-arg APP=$APP . if [ -n "$DOMAIN" ]; then
echo "docker build -t $DOMAIN/sig-$APP:$VERSION --build-arg APP=$APP ."
docker build -t $DOMAIN/sig-$APP:$VERSION --build-arg APP=$APP .
else
echo "docker build -t sig-$APP:$VERSION --build-arg APP=$APP ."
docker build -t sig-$APP:$VERSION --build-arg APP=$APP .
fi
rm -f localtime rm -f localtime
fi fi

1
generate.go

@ -8,6 +8,7 @@ import "fmt"
//go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/exchange.proto //go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/exchange.proto
//go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/order.proto //go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/order.proto
//go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/trading.proto //go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/trading.proto
//go:generate protoc --go_out=./api/ --go-grpc_out=./api/ ./api/gateway.proto
// run cmd: go generate generate.go // run cmd: go generate generate.go
func main() { func main() {

34
internal/gateway/gateway_postal_grpc_server.go

@ -0,0 +1,34 @@
package gateway
import (
"context"
"sig-pub/api/pb"
"google.golang.org/grpc"
)
type GatewayPostalGrpcServer struct {
pb.UnimplementedGatewayPostalServer
}
func NewGatewayGrpcServer() *GatewayPostalGrpcServer {
return &GatewayPostalGrpcServer{}
}
// DeliverStream 使用流连续发送数据
func (svr *GatewayPostalGrpcServer) DeliverStream(req grpc.ClientStreamingServer[pb.ReqDeliver, pb.ResDeliver]) (err error) {
return nil
}
// Deliver 发送一次数据
func (svr *GatewayPostalGrpcServer) Deliver(ctx context.Context, req *pb.ReqDeliver) (*pb.ResDeliver, error) {
return nil, nil
}
// DeliverBatch 批量发送数据
func (svr *GatewayPostalGrpcServer) DeliverBatch(ctx context.Context, req *pb.ReqDeliverBatch) (res *pb.ResDeliver, err error) {
return nil, nil
}
Loading…
Cancel
Save