Skip to content

Commit

Permalink
Merge pull request #206 from vegaprotocol/add-support-for-perpetuals
Browse files Browse the repository at this point in the history
feat: add support for perpetual markets
  • Loading branch information
daniel1302 authored Aug 15, 2023
2 parents 11ceff7 + 84d706f commit 2f66e02
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 249 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FILE IS AUTOMATICALLY MANAGED BY github.com/vegaprotocol/terraform//github
ARG GO_VERSION=1.19
ARG ALPINE_VERSION=3.15
ARG GO_VERSION=1.20
ARG ALPINE_VERSION=3.16
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN mkdir /build
WORKDIR /build
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ install:
.PHONY: release-ubuntu-latest
release-ubuntu-latest:
@mkdir -p build
@env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -v -o build/${REPO_NAME}-linux-amd64 $(GO_FLAGS) ./cmd/${REPO_NAME}
@env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -o build/${REPO_NAME}-linux-amd64 $(GO_FLAGS) ./cmd/${REPO_NAME}
@cd build && zip ${REPO_NAME}-linux-amd64.zip ${REPO_NAME}-linux-amd64

.PHONY: release-macos-latest
release-macos-latest:
@mkdir -p build
@env GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -v -o build/${REPO_NAME}-darwin-amd64 $(GO_FLAGS) ./cmd/${REPO_NAME}
@env GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -v -o build/${REPO_NAME}-darwin-amd64 $(GO_FLAGS) ./cmd/${REPO_NAME}
@cd build && zip ${REPO_NAME}-darwin-amd64.zip ${REPO_NAME}-darwin-amd64

.PHONY: release-windows-latest
release-windows-latest:
@env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -v -o build/${REPO_NAME}-amd64.exe $(GO_FLAGS) ./cmd/${REPO_NAME}
@env GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -v -o build/${REPO_NAME}-amd64.exe $(GO_FLAGS) ./cmd/${REPO_NAME}
@cd build && 7z a -tzip ${REPO_NAME}-windows-amd64.zip ${REPO_NAME}-amd64.exe


.PHONY: build
build: ## install the binary in GOPATH/bin
@env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -v -o bin/${REPO_NAME} ./cmd/${REPO_NAME}
@env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -o bin/${REPO_NAME} ./cmd/${REPO_NAME}

.PHONY: lint
lint:
Expand All @@ -72,7 +72,7 @@ mocks: ## Make mocks

.PHONY: race
race: ## Run data race detector
@env CGO_ENABLED=1 go test -race ./...
@env CGO_ENABLED=0 go test -race ./...

.PHONY: retest
retest: ## Force re-run of all tests
Expand Down
10 changes: 8 additions & 2 deletions bot/normal/normal.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (b *Bot) Start() error {
}

future := mkt.TradableInstrument.Instrument.GetFuture()
if future == nil {
perpetual := mkt.TradableInstrument.Instrument.GetPerpetual()
if future == nil && perpetual == nil {
continue
}

Expand All @@ -240,7 +241,12 @@ func (b *Bot) Start() error {
}
}

b.settlementAssetID = future.SettlementAsset
if future != nil {
b.settlementAssetID = future.SettlementAsset
} else if perpetual != nil {
b.settlementAssetID = perpetual.SettlementAsset
}

b.market = mkt
}
}
Expand Down
60 changes: 22 additions & 38 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,50 @@ go 1.19
require (
code.vegaprotocol.io/priceproxy v0.0.2
code.vegaprotocol.io/shared v0.0.0-20220614080106-5c97205b0d92
code.vegaprotocol.io/vega v0.67.3
code.vegaprotocol.io/vega v0.72.2-0.20230815101118-83406455de11
github.com/golang/mock v1.6.1-0.20220512030613-73266f9366fc
github.com/hashicorp/go-multierror v1.1.1
github.com/holiman/uint256 v1.2.0
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c
github.com/jinzhu/configor v1.2.1
github.com/julienschmidt/httprouter v1.3.0
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.2
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
gonum.org/v1/gonum v0.12.0
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.30.0
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/DataDog/zstd v1.4.1 // indirect
github.com/PaesslerAG/gval v1.0.0 // indirect
github.com/PaesslerAG/jsonpath v0.1.1 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/btcsuite/btcd v0.22.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.10.21 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/ethereum/go-ethereum v1.11.6 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.9.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20220317090546-adb2f9614b17 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tendermint/tendermint v0.34.24 // indirect
github.com/tendermint/tm-db v0.6.7 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/vegaprotocol/go-slip10 v0.1.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.7.0 // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 2f66e02

Please sign in to comment.