-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Run Gosec | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
gosec: | ||
name: GoSec Security Scanner | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install GoSec 2.18.2 | ||
run: | | ||
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.19.0 | ||
- name: Run Gosec Security Scanner | ||
run: | | ||
cd radicalvpnd | ||
$(go env GOPATH)/bin/gosec ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
id: go | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
project_name: kraken-dca | ||
builds: | ||
- goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
goarm: | ||
- "6" | ||
- "7" | ||
release: | ||
draft: true | ||
snapshot: | ||
name_template: "{{ .Version }}-{{.ShortCommit}}" | ||
checksum: | ||
name_template: "{{ .ProjectName }}_checksums.txt" | ||
dockers: | ||
- image_templates: | ||
- "gcr.io/primexz/kraken_dca:{{ .Tag }}" | ||
- "gcr.io/primexz/kraken_dca:latest" | ||
changelog: | ||
use: github | ||
sort: asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,4 @@ | ||
FROM golang:1.22 | ||
FROM scratch | ||
|
||
# Set destination for COPY | ||
WORKDIR /app | ||
|
||
# Download Go modules | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . /app/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /kraken_dca | ||
|
||
EXPOSE 8080 | ||
|
||
# Run | ||
CMD ["/kraken_dca"] | ||
ENTRYPOINT ["/kraken-dca"] | ||
COPY kraken-dca / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package bot | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/primexz/KrakenDCA/config" | ||
) | ||
|
||
func computeNextFiatDepositDay() time.Time { | ||
date := addMonthsToTime(1, time.Now()) | ||
|
||
//get the first day of the month | ||
return date.AddDate(0, 0, -date.Day()+1) | ||
} | ||
|
||
func calculateTimeOfNextOrder() { | ||
orderAmountUntilRefill := getOrderAmountUntilRefill() | ||
|
||
now := time.Now().UnixMilli() | ||
timeOfNextOrder = time.UnixMilli((timeOfEmptyFiat.UnixMilli()-now)/int64(orderAmountUntilRefill) + now) | ||
} | ||
|
||
func getOrderAmountUntilRefill() float64 { | ||
fiatValueInBtc := fiatAmount / lastBtcFiatPrice | ||
|
||
return fiatValueInBtc / config.KrakenOrderSize | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters