diff --git a/Makefile b/Makefile index b537652..4803ac9 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,28 @@ -lint: +.PHONY: help lint test doc +.DEFAULT_GOAL := help + +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +pre-push: lint test ## Run golang lint and test + +lint: ## Run golang lint using docker go mod download docker run --rm \ -v ${GOPATH}/pkg/mod:/go/pkg/mod \ -v ${PWD}:/app \ -w /app \ - golangci/golangci-lint:v1.53.3 \ + golangci/golangci-lint:v1.54.2 \ golangci-lint run -v --modules-download-mode=readonly -test: - GOARCH=amd64 go test ./... \ No newline at end of file +test: ## Run tests + GOARCH=amd64 go test ./... + +doc: ## Run doc server using docker + @echo "Doc server runs on http://127.0.0.1:6060" + docker run --rm \ + -p 127.0.0.1:6060:6060 \ + -v ${PWD}:/go/src/github.com/evsamsonov/trengin \ + -w /go/src/github.com/evsamsonov/trengin \ + golang:latest \ + bash -c "go install golang.org/x/tools/cmd/godoc@latest && /go/bin/godoc -http=:6060" diff --git a/trengin.go b/trengin.go index b338730..bbb38a9 100644 --- a/trengin.go +++ b/trengin.go @@ -288,6 +288,8 @@ func (p *Position) RangeExtra(f func(key interface{}, val interface{})) { // OpenPositionAction is an action to open a position type OpenPositionAction struct { + SecurityBoard string // Trading mode identifier. Example, TQBR + SecurityCode string // Example, SBER FIGI string // Financial Instrument Global Identifier Type PositionType Quantity int64