Skip to content

Commit f4d5b13

Browse files
committed
v1.9.3
1 parent 82e4c26 commit f4d5b13

File tree

8 files changed

+81
-22
lines changed

8 files changed

+81
-22
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.git
22
.github
3-
.travis.yml
43
.DS_Store
54
.vscode
65
.dccache

.github/workflows/docker-image.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ main, beta ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v1
17+
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v1
20+
with:
21+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
22+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
id: buildx
27+
with:
28+
install: true
29+
30+
- name: Build and push
31+
uses: docker/build-push-action@v2
32+
with:
33+
context: .
34+
platforms: linux/amd64
35+
file: ./Dockerfile.cryptopump
36+
push: true
37+
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/cryptopump:latest
38+
39+
- name: Build and push
40+
uses: docker/build-push-action@v2
41+
with:
42+
context: .
43+
platforms: linux/amd64
44+
file: ./Dockerfile.mysql
45+
push: true
46+
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/cryptopump_db:latest
47+
48+
- name: Image digest
49+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Go
22

33
on:
44
push:
5-
branches: [ main, beta, features ]
5+
branches: [ main, beta ]
66

77
jobs:
88

Dockerfile.cryptopump

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
FROM golang:1.16
2+
23
RUN apt-get update -qq && apt-get install -y -qq \
34
&& apt-get -qq clean
5+
46
WORKDIR /go/src/cryptopump
7+
58
COPY . .
9+
610
# do not copy configuration files, but rather configuration templates
711
COPY config/config_template.yml /go/src/cryptopump/config/config.yml
812
COPY config/config_global_template.yml /go/src/cryptopump/config/config_global.yml
13+
914
# install dependencies
10-
RUN go get -d -v ./...
1115
RUN go install -v ./...
16+
1217
# forward request and error logs to docker log collector
1318
RUN ln -sf /dev/stdout cryptopump.log \
1419
&& ln -sf /dev/stderr cryptopump_debug.log
15-
CMD ["cryptopump"]
20+
21+
RUN go build -o /cryptopump
22+
23+
ENTRYPOINT [ "cryptopump" ]

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ services:
3131
- DB_NAME=cryptopump
3232
ports:
3333
- "8080-8090:8080-8090"
34-
- "22:22"
3534
tty: true
3635
volumes:
3736
- config_data:/go/src/cryptopump/config # config files

exchange/binance.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package exchange
33
import (
44
"context"
55
"flag"
6-
"os"
76
"time"
87

98
"github.com/aleibovici/cryptopump/functions"
109
"github.com/aleibovici/cryptopump/logger"
10+
"github.com/aleibovici/cryptopump/threads"
1111
"github.com/aleibovici/cryptopump/types"
1212

1313
"github.com/adshao/go-binance/v2"
@@ -161,15 +161,6 @@ func binanceGetClient(
161161
binance.WebsocketKeepalive = false
162162
binance.WebsocketTimeout = time.Second * 30
163163

164-
/* If TRAVIS flag is set, the testnet API is used */
165-
if os.Getenv("TRAVIS") == "true" {
166-
167-
configData.ConfigGlobal.ApikeyTestNet = functions.MustGetenv("apikeytestnet")
168-
configData.ConfigGlobal.SecretkeyTestNet = functions.MustGetenv("secretkeytestnet")
169-
return binance.NewClient(configData.ConfigGlobal.ApikeyTestNet, configData.ConfigGlobal.SecretkeyTestNet)
170-
171-
}
172-
173164
/* If the -test.v flag is set, the testnet API is used */
174165
if flag.Lookup("test.v") != nil {
175166

@@ -334,6 +325,9 @@ func binanceGetSymbolFunds(
334325

335326
}
336327

328+
/* Cleanly exit ThreadID */
329+
threads.Thread{}.Terminate(sessionData, "Balance or Pair not found for symbol "+sessionData.Symbol[0:3])
330+
337331
return 0, err
338332

339333
}

main.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func main() {
118118
DiffTotal: 0,
119119
Global: &types.Global{},
120120
Admin: false,
121+
Port: "",
121122
}
122123

123124
marketData := &types.Market{
@@ -146,15 +147,23 @@ func main() {
146147
viperData: viperData,
147148
}
148149

149-
port := functions.GetPort() /* Determine port for HTTP service. */
150+
sessionData.Port = functions.GetPort() /* Determine port for HTTP service. */
151+
152+
logger.LogEntry{ /* Log Entry */
153+
Config: configData,
154+
Market: marketData,
155+
Session: sessionData,
156+
Order: &types.Order{},
157+
Message: "Listening on port " + sessionData.Port,
158+
LogLevel: "InfoLevel",
159+
}.Do()
150160

151161
http.HandleFunc("/", myHandler.handler)
152162
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
153-
fmt.Printf("Listening on port %s \n", port)
154163

155-
open.Run("http://localhost:" + port) /* Open URI using the OS's default browser */
164+
open.Run("http://localhost:" + sessionData.Port) /* Open URI using the OS's default browser */
156165

157-
http.ListenAndServe(fmt.Sprintf(":%s", port), nil) /* Start HTTP service. */
166+
http.ListenAndServe(fmt.Sprintf(":%s", sessionData.Port), nil) /* Start HTTP service. */
158167

159168
}
160169

@@ -387,7 +396,7 @@ func execution(
387396
Market: marketData,
388397
Session: sessionData,
389398
Order: &types.Order{},
390-
Message: "Resuming",
399+
Message: "Resuming on port " + sessionData.Port,
391400
LogLevel: "InfoLevel",
392401
}.Do()
393402

@@ -410,7 +419,7 @@ func execution(
410419
Market: marketData,
411420
Session: sessionData,
412421
Order: &types.Order{},
413-
Message: "Initializing",
422+
Message: "Initializing on port " + sessionData.Port,
414423
LogLevel: "InfoLevel",
415424
}.Do()
416425

types/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ type Session struct {
109109
QuantityOffsetFlag bool /* This flag is true when the quantity is offset */
110110
DiffTotal float64 /* This variable holds the difference between the total funds and the total funds in the last session */
111111
Global *Global
112-
Admin bool /* This flag is true when the admin page is selected */
112+
Admin bool /* This flag is true when the admin page is selected */
113+
Port string /* This variable holds the port number for the web server */
113114
}
114115

115116
// Global (Session.Global) struct store semi-persistent values to help offload mySQL queries load

0 commit comments

Comments
 (0)