Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4363 commits
Select commit Hold shift + click to select a range
c27f416
indicator: canonicalize the CalculateAndUpdate method call
c9s Jul 13, 2022
2a3118a
indicator: clean up and update calculator method names
c9s Jul 13, 2022
b2538b6
indicator: make callback field private
c9s Jul 13, 2022
8d8d9a7
indicator/rsi: make update callback field private
c9s Jul 13, 2022
e6c6346
indicator: clean up ewma's CalculateAndUpdate
c9s Jul 14, 2022
3f80024
doc: update indicator doc
c9s Jul 14, 2022
cb481c6
fix all indicators for KLineCalculateUpdater interface
c9s Jul 14, 2022
7726434
indicator: add KLineLoader interface
c9s Jul 14, 2022
a7b7ed6
rename to KLineClosedEmitter
c9s Jul 14, 2022
0b07fb5
indicator/macd: drop the legacy func calculateMACD
c9s Jul 14, 2022
da4dbf4
indicator: macd: add link for macd https://school.stockcharts.com/dok…
c9s Jul 14, 2022
7696c9f
indicator: improve rma preload
c9s Jul 14, 2022
bbf0127
indicator/sma: clean CalculateAndUpdate and make cache field private
c9s Jul 14, 2022
975d0d6
indicator: pull out emit update
c9s Jul 14, 2022
58d2384
Merge pull request #821 from c9s/refactor/indicator-api
c9s Jul 14, 2022
a5715c6
indicator: rewrite boll indicator with stddev indicator
c9s Jul 14, 2022
2ef8ecf
indicator: clean up bollinger band indicator api usage
c9s Jul 14, 2022
3651b84
Merge pull request #823 from c9s/refactor/indicator-api
c9s Jul 14, 2022
dd3bd6a
indicator: rewrite VWMA calculator
c9s Jul 14, 2022
5eb60df
Merge pull request #824 from c9s/refactor/indicator-api
c9s Jul 14, 2022
8fb216c
pivotshort: when resistance order is filled, reset the current resist…
c9s Jul 14, 2022
0ba529c
pivotshort: replace orders if the active orders is empty
c9s Jul 14, 2022
6c91af2
pivotshort: improve useQuantityOrBaseBalance
c9s Jul 14, 2022
0284d09
all: move getExchangeAttributes
c9s Jul 14, 2022
adb96ca
pivotshort: check maximum margin leverage
c9s Jul 14, 2022
c4332fc
pivotshort: add leverage settings
c9s Jul 14, 2022
191e00a
Merge pull request #827 from c9s/strategy/pivotshort
c9s Jul 14, 2022
89ffd94
update pivotlow on start
c9s Jul 14, 2022
a370a5e
pivotshort: fix on start handler
c9s Jul 14, 2022
26f5f36
backtest: for types.OrderTypeStopMarket, use stop price to simulate t…
c9s Jul 14, 2022
44f3793
max: emit debt event and ad ratio event
c9s Jul 15, 2022
620381f
optimizer: eliminate limitation of number of grid point
COLDTURNIP Jul 15, 2022
a116307
Merge pull request #829 from COLDTURNIP/feature/eliminate_grid_limit
c9s Jul 15, 2022
2d0fbe4
fix ProtectiveStopLoss subscribe
c9s Jul 16, 2022
6e4c28e
disable marketTrade stop
c9s Jul 16, 2022
13455e4
backtest: resolve data race on index.json
COLDTURNIP Jul 17, 2022
ec4ac54
Merge pull request #830 from COLDTURNIP/fix/backtest_index_lock
c9s Jul 18, 2022
185b1fe
Update README.md
c9s Jul 18, 2022
29fc58c
autoborrow: fix repay amount
c9s Jul 18, 2022
d2d6278
update command doc files
c9s Jul 19, 2022
a6fc03e
bump version to v1.37.0
c9s Jul 19, 2022
fc5b59d
add v1.37.0 release note
c9s Jul 19, 2022
7b3673d
config: set default quantity
c9s Jul 19, 2022
1ca7e0d
add trendEMA config to pivotshort config
c9s Jul 19, 2022
9302474
add 1m subscribe to RoiTakeProfit
c9s Jul 19, 2022
f72cf9b
pivotshort: fix quantity check
c9s Jul 19, 2022
808ba2f
bbgo: make slack-app-token optional
c9s Jul 19, 2022
8af2f2f
add defaulter interface
c9s Jul 19, 2022
ab83805
bbgo: add StrategyShutdown interface
c9s Jul 19, 2022
ea4efcc
schedule: use general order executor and fix notification message format
c9s Jul 19, 2022
6dc73f9
config: update schedule config with back-test settings
c9s Jul 19, 2022
88940a6
config: update schedule config for usdttwd market
c9s Jul 19, 2022
b9bbff6
Merge pull request #832 from c9s/fix/schedule
c9s Jul 19, 2022
ed91fdc
Merge pull request #831 from c9s/feature/defaulter
c9s Jul 19, 2022
4300e00
indicator/rma: move endTime update to PushK
c9s Jul 14, 2022
9f937f5
bbgo: refactor standard indicator
c9s Jul 20, 2022
2523c22
indicator/till: refactor CalculateAndUpdate
c9s Jul 20, 2022
0b9d693
indicator/till: add zero time check
c9s Jul 20, 2022
a821641
indicator/atr: implement LoadK and BindK
c9s Jul 20, 2022
02c978b
bbgo: remove volatility from the standard indicator set
c9s Jul 20, 2022
946fb96
bbgo: reformat
c9s Jul 20, 2022
6e043ba
indicator/till: fix e1 check
c9s Jul 20, 2022
9c89359
indicator/stoch: move endTime check to pushK
c9s Jul 20, 2022
86c1619
indicator/stoch: move emitUpdate
c9s Jul 20, 2022
ea08a61
indicator/stoch: simplify CalculateAndUpdate
c9s Jul 20, 2022
0a08cc2
Merge pull request #825 from c9s/refactor/indicator-api
c9s Jul 21, 2022
b6d0482
pivotshort: add more logs and check
c9s Jul 21, 2022
c78ba6a
bbgo: fix strategy struct field injection phase
c9s Jul 21, 2022
7ce7a1b
config: update pivotshort config
c9s Jul 21, 2022
de62d9d
bbgo: fix injection
c9s Jul 21, 2022
1079757
bbgo: bind market data store to market data stream when allocating ne…
c9s Jul 21, 2022
763ae1f
bbgo: fix missing var
c9s Jul 21, 2022
8c61f68
Merge pull request #833 from c9s/fix/pivotshort-quantity-cal
c9s Jul 21, 2022
756fcb4
pivotshort: fix min leverage protection
c9s Jul 21, 2022
88c0f31
pivotshort: add trade loss to the quantity calculating
c9s Jul 21, 2022
15879ad
pivotshort: fix trade loss ratio
c9s Jul 21, 2022
e09e2df
Merge pull request #834 from c9s/strategy/pivotshort
c9s Jul 21, 2022
76def2f
pull out AccountValueCalculator
c9s Jul 21, 2022
54affd2
pivotshort: quantity calculation -- sub debt
c9s Jul 22, 2022
36cfaa9
risk: move leverage quantity calculation to the risk package
c9s Jul 22, 2022
a1387bb
risk: move spot condition to the top
c9s Jul 22, 2022
c62ba3a
Merge pull request #836 from c9s/strategy/pivotshort
c9s Jul 22, 2022
3cf5175
risk: make calculateAccountNetValue public
c9s Jul 22, 2022
b53da17
risk: add test case for account calculator
c9s Jul 22, 2022
a9f9fc4
risk: add margin level calculator
c9s Jul 22, 2022
4b7126c
risk: add doc comment for MarginLevel method
c9s Jul 22, 2022
a609c06
risk: fix margin level prec assertion
c9s Jul 22, 2022
3e44e05
Merge pull request #837 from c9s/strategy/pivotshort
c9s Jul 23, 2022
4345cef
util: use marshal instead of marshal indent
c9s Jul 23, 2022
bfb7dd5
Merge pull request #838 from c9s/improve/backtest-json-format
c9s Jul 23, 2022
07959c8
strategy/supertrend: fix exit methods problem
andycheng123 Jul 25, 2022
0d5d92b
pivotshort: fix tail function
c9s Jul 25, 2022
2e7ed9f
Merge pull request #840 from andycheng123/fix/supertrend-strategy
c9s Jul 25, 2022
e482a16
types: repay debt when closing position
c9s Jul 25, 2022
79fe49f
types: for net() always return total sub debt
c9s Jul 26, 2022
9787b86
types: call debt()
c9s Jul 26, 2022
bdfb5d0
risk: pull out max quantity variable
c9s Jul 26, 2022
549e280
autoborrow: call Debt() for repay
c9s Jul 26, 2022
9c944d4
types: fix profit stats titles
c9s Jul 26, 2022
ee4fb1a
add 24hours guard to AddProfit
c9s Jul 26, 2022
06d71aa
types: add doc comment
c9s Jul 26, 2022
6ae0620
bollmaker: integrate exits method to bollmaker
c9s Jul 26, 2022
c3b6cb8
bollmaker: upgrade bollmaker exits methods
c9s Jul 26, 2022
83c8bc8
all: drop the legacy smart stops
c9s Jul 26, 2022
d26dd2f
bollmaker: remove status change setter
c9s Jul 26, 2022
c252a7d
bollmaker: fix log format issue
c9s Jul 26, 2022
8986eeb
bollmaker: apply kline filter closure
c9s Jul 26, 2022
48ab33d
Merge pull request #842 from c9s/feature/bollmaker-exit
c9s Jul 26, 2022
9bf48e9
Merge pull request #822 from c9s/fix/api-upgrade
c9s Jul 26, 2022
2568a81
fix: binance time sync, exchange interval query interface, yaml for f…
zenixls2 Jul 26, 2022
abf967a
Merge pull request #843 from zenixls2/fix/exchange_sync_time_interval…
c9s Jul 26, 2022
cf5e81c
binance: refactor set server time go routine
c9s Jul 26, 2022
ff61235
binance: rename to timeSetterOnce
c9s Jul 26, 2022
e1e7258
binance: refactor server time offset setter
c9s Jul 26, 2022
5bb1722
binance: remove ineffected DEBUG_BINANCE_STREAM
c9s Jul 26, 2022
44c3e5a
indicator: split pivot low indicator
c9s Jul 26, 2022
0ae6b67
feature: use drift indicator to create basic strategy for study
zenixls2 Jul 1, 2022
6a9e00e
fix: update drift strategy
zenixls2 Jul 4, 2022
69b45e9
add drift exit condition
zenixls2 Jul 5, 2022
c51a994
feature: add plot for series. add autocorrelation. add clone for indi…
zenixls2 Jul 12, 2022
7310feb
fix: highest price normalization in drift strategy
zenixls2 Jul 13, 2022
83f8b7a
fix: logistic regression test case
zenixls2 Jul 13, 2022
586f1ff
fix: clone on sma
zenixls2 Jul 13, 2022
e097421
feature: export canvas path for drift strategy. fix exit/entry order …
zenixls2 Jul 13, 2022
55704fd
fix: Reverse length, alma comment
zenixls2 Jul 13, 2022
f2d3765
fix: drift bias on long entry position condition, make cancel faster
zenixls2 Jul 14, 2022
7368069
fix: add persistence to drift
zenixls2 Jul 14, 2022
b52208d
fix: bug in wrong channel subscription in drift
zenixls2 Jul 14, 2022
9c73aa4
fix: fine tune drift config. fix atr updating issue
zenixls2 Jul 14, 2022
c6563aa
feature: add stoploss from stopPrice
zenixls2 Jul 14, 2022
0d65fe1
feature: trailing stop, print mean and modify normalization function …
zenixls2 Jul 15, 2022
62aac8e
fix: indicator limits
zenixls2 Jul 15, 2022
ac5c7f5
feature: add pnl / cummulative pnl graph, add continuous graph
zenixls2 Jul 15, 2022
b6fb5e9
feature: deduct fee from entry, move StopLoss orders cleanup to the b…
zenixls2 Jul 16, 2022
a5039de
feature: add omega ratio, print sharpe/omega/interval profit from tra…
zenixls2 Jul 19, 2022
a8fe20a
fix: drift exit condition, trade_stats serialization in redis
zenixls2 Jul 20, 2022
d2dee44
fix: ewma copy
zenixls2 Jul 21, 2022
553a558
fix: buyPrice/sellPrice calculation on one order multiple trades
zenixls2 Jul 22, 2022
2ceb24a
fix: panic on image drawing, reduce fee by smoothing the drift curve
zenixls2 Jul 25, 2022
4dd4c58
fix: unlock lock to get latest price
zenixls2 Jul 25, 2022
85f8b95
fix: gofmt
zenixls2 Jul 26, 2022
eeab328
indicator: rewrite pivotlow indicator
c9s Jul 26, 2022
8bf9b28
add low indicator
c9s Jul 26, 2022
0df321c
indicator: drop the legacy CalculateAndUpdate for standard indicators
c9s Jul 26, 2022
16c62ea
indicator/pivotlow: drop the legacy CalculateAndUpdate
c9s Jul 26, 2022
82673e5
indicator: fix test cases
c9s Jul 26, 2022
94efa88
rename inf.go to interface.go
c9s Jul 26, 2022
46afc54
bbgo: refactor standard indicator set
c9s Jul 26, 2022
1d6b1de
bbgo: rename standard indicator receiver name
c9s Jul 26, 2022
f5e64e8
bbgo: add ATR, ATRP, EMV to the standard indicator set
c9s Jul 26, 2022
808d742
bbgo: add CCI helper
c9s Jul 26, 2022
2459dbd
indicator: refactor hull indicator
c9s Jul 26, 2022
0456cdc
bbgo: add hull to the standard indicator
c9s Jul 26, 2022
3959e28
all: refactor standard indicator helper and fix tests
c9s Jul 26, 2022
2758239
Merge pull request #845 from c9s/refactor/standard-indicator
c9s Jul 26, 2022
f460a79
indicator: refactor macd indicator
c9s Jul 26, 2022
2822e39
pivotshort: remove the legacy preloadPivot
c9s Jul 26, 2022
da51bf4
fix: rebase error
zenixls2 Jul 26, 2022
605c665
Merge pull request #844 from c9s/strategy/pivotshort
c9s Jul 26, 2022
578e4b2
indicator: fix pivot low indicator
c9s Jul 26, 2022
076f196
risk: return quantity directly if it's not zero
c9s Jul 26, 2022
5dd14fe
indicator: fix pivot low indicator
c9s Jul 26, 2022
0e18aa6
indicator: fix length slice calculation
c9s Jul 26, 2022
4fd3187
indicator: fix slice
c9s Jul 26, 2022
6f64b6d
pivotshort: introduce new config struct
c9s Jul 26, 2022
854af6b
pivotshort: use new config struct stopEMA and trendEMA
c9s Jul 26, 2022
b746f80
pivotshort: get the correct pivot low value
c9s Jul 26, 2022
ac496e8
pivotshort: refactor pivot low collector
c9s Jul 26, 2022
feef912
indicator: pivot low reformat
c9s Jul 26, 2022
3adeb46
config: update pivotshort default config
c9s Jul 26, 2022
3fbc634
bbgo: narrow down indicator interface type
c9s Jul 26, 2022
3f33111
fix: rename kline Copy to Set
zenixls2 Jul 27, 2022
84c7c05
fix: fix drift naming style, fix kline Copy -> Set
zenixls2 Jul 27, 2022
4fd571d
Merge pull request #813 from zenixls2/feature/drift_study
c9s Jul 27, 2022
f323e91
pivotshort: fix resistance short
c9s Jul 27, 2022
7438798
bbgo: add ClosedKLineStop trigger
c9s Jul 27, 2022
4c6fe11
pivotshort: rename ClosedKLineStop to fake break stop
c9s Jul 27, 2022
3aeb691
Merge pull request #846 from c9s/strategy/pivotshort
c9s Jul 27, 2022
a9eef3f
pivotshort: fix pivot low usage
c9s Jul 27, 2022
b067c02
pivotshort: fix resistance order quantity calculation
c9s Jul 27, 2022
9b35c78
pivotshort: add total quantity to the notification
c9s Jul 27, 2022
5821dd0
pivotshort: fix log format
c9s Jul 27, 2022
2719c86
pivotshort: drop unused tail function
c9s Jul 27, 2022
c65456e
pivotshort: refactor and add trendEMA to resistance short
c9s Jul 27, 2022
151d907
use debug log for trendEMA
c9s Jul 27, 2022
9f06be1
types: calculate MaximumConsecutiveLosses and MaximumConsecutiveProfits
c9s Jul 27, 2022
56bfa22
types: add position openedAt time field
c9s Jul 27, 2022
03541ca
types: record the position open time
c9s Jul 27, 2022
abd99a1
types: fix IntervalProfits struct tag
c9s Jul 27, 2022
5e276dd
Merge pull request #847 from c9s/strategy/pivotshort
c9s Jul 28, 2022
5fa2606
pivotshort: rename kLineClosedStop to fakeBreakStop
c9s Jul 28, 2022
a791b45
types: fix average profit/loss overflow issue
c9s Jul 28, 2022
93593ff
bbgo: add close position tag log
c9s Jul 28, 2022
d61047c
pivotshort: add maxGradient config to trendEMA
c9s Jul 28, 2022
05f6581
Merge pull request #848 from c9s/strategy/pivotshort
c9s Jul 28, 2022
30978ec
pivotshort: check TrendEMA pointer
c9s Jul 28, 2022
3c0d572
optimizer: print equity diff in final report
COLDTURNIP Jul 28, 2022
1681413
optimizer: calculate total number of grids before testing
COLDTURNIP Jul 28, 2022
d46267a
feature: use ma for tp coefficient, rewrite trailing stop for drift, …
zenixls2 Jul 28, 2022
75047d5
Merge pull request #851 from zenixls2/stablize/drift
c9s Jul 28, 2022
a32ef8c
Merge pull request #850 from COLDTURNIP/feature/optimizer_predict_gri…
c9s Jul 28, 2022
ae6c6c9
Merge pull request #849 from COLDTURNIP/feature/optimizer_output_asse…
c9s Jul 28, 2022
8c53c7e
positionupdater: update base position
andycheng123 Jul 29, 2022
32b91b6
positionupdater: update quote position
andycheng123 Jul 29, 2022
2724949
positionupdater: update avaerage cost
andycheng123 Jul 29, 2022
9588a6f
positionupdater: update command flow
andycheng123 Jul 29, 2022
4bc7082
positionmodifier: move functions into types.Position
andycheng123 Jul 29, 2022
6a9b10d
update command doc files
c9s Jul 29, 2022
a132e78
bump version to v1.38.0
c9s Jul 29, 2022
4fd15ae
add v1.38.0 release note
c9s Jul 29, 2022
b324149
added SideEffectTypeAutoRepay to supportTakeProfit
frin1 Jul 29, 2022
8302620
Merge pull request #854 from frin1/fix/pivotshort-autorepay
c9s Jul 29, 2022
bd754e1
pivotshort: use infof log
c9s Jul 29, 2022
67f8b1c
optimizeex: hyperparameter optimization tool
COLDTURNIP Jul 29, 2022
23dc8a9
exchange: FTX default fee
COLDTURNIP Jul 29, 2022
4e14df4
optimizer: fix typo
COLDTURNIP Jul 29, 2022
f5d4fa0
optimizer: refactor selector config types
COLDTURNIP Jul 29, 2022
ae3eaaa
optimizer: testing: param config
COLDTURNIP Jul 29, 2022
76d908e
optimizer: workaround for data race in TPE optimization
COLDTURNIP Jul 30, 2022
efaf8e9
pivotshort: add more logs
c9s Jul 30, 2022
adb8a2a
remove ping / pong debug
c9s Jul 30, 2022
8873101
pivotshort: move trendEMA log
c9s Jul 30, 2022
55a128e
pivotshort: use bbgo notify instead of just info log
c9s Jul 30, 2022
09940ed
optimizer: optimizeEx supports discrete parameters
COLDTURNIP Jul 30, 2022
4ea70de
config: add more example for optimizeex
COLDTURNIP Jul 30, 2022
bad0aa3
optimizer: print best result in the same parameter order defined in c…
COLDTURNIP Jul 30, 2022
5ef34a3
optimizer: calculate equity diff from whole assets instead of first s…
COLDTURNIP Jul 31, 2022
961a783
Merge pull request #857 from COLDTURNIP/fix/optimizer_objective_total…
c9s Jul 31, 2022
6095082
Merge pull request #856 from COLDTURNIP/fix/ftx_default_fee
c9s Jul 31, 2022
68af2d0
optimizer: rename optimizeex to hoptimize
COLDTURNIP Aug 2, 2022
1b17704
Merge pull request #855 from COLDTURNIP/feature/optimizer_hyperparam
c9s Aug 2, 2022
b00efaa
strategy/supertrend: re-organize exits part of config
andycheng123 Aug 3, 2022
1277586
strategy/supertrend: remove redundant part of config
andycheng123 Aug 3, 2022
b16abee
Merge pull request #861 from andycheng123/fix/supertrend-strategy
andycheng123 Aug 3, 2022
dc9ecdd
strategy/supertrend: add accumulated profit SMA report
andycheng123 Aug 3, 2022
5d1bfc6
strategy/supertrend: add last period accumulated profit report
andycheng123 Aug 3, 2022
e60aae4
positionModifier: combine callbacks into one
andycheng123 Aug 3, 2022
0d82f32
Merge pull request #852 from andycheng123/position-updater
andycheng123 Aug 3, 2022
9369ad3
strategy/supertrend: adapt SetIntervalProfitCollector
andycheng123 Aug 4, 2022
550f2f3
strategy/supertrend: adapt risk.AccountValueCalculator
andycheng123 Aug 5, 2022
eb57e80
strategy/supertrend: different qty calculation for spot and leveraged
andycheng123 Aug 5, 2022
dba1102
strategy/supertrend: rename AvailableValue() to AvailableQuote()
andycheng123 Aug 5, 2022
b564e69
strategy/supertrend: add CalculateQuoteQuantity()
andycheng123 Aug 5, 2022
737f6e9
strategy/supertrend: use CalculateQuoteQuantity() in strategy
andycheng123 Aug 5, 2022
318590f
types: rbtree: resolve neel reusing problem
COLDTURNIP Aug 7, 2022
e367c42
Merge pull request #863 from COLDTURNIP/fix/rbtree_concurrent_neel
c9s Aug 7, 2022
9d0eecc
strategy/supertrend: linreg adapted new indicator API
andycheng123 Aug 8, 2022
c6407e9
strategy/supertrend: supertrend indicator adapted new indicator API
andycheng123 Aug 8, 2022
1cd4817
Merge pull request #862 from andycheng123/improve/supertrend-strategy
andycheng123 Aug 8, 2022
cd89af7
strategy/supertrend: update example config
andycheng123 Aug 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/contracts
.env.*
/linode
/frontend
/desktop
3 changes: 3 additions & 0 deletions .evans.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
protoFile = ["pkg/pb/bbgo.proto"]
package = "bbgo"
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: c9s
custom: [https://etherscan.io/address/0x5ed8508e3d046cbe9ff44d6063e29349000c8ddd]
53 changes: 53 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Docker Image

on:
workflow_dispatch:
inputs:
ref:
description: 'ref to build'
required: false
default: 'main'
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
yoanlin/bbgo
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
# tags: yoanlin/bbgo:latest
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
90 changes: 90 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Go

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
redis-version:
- 6.2
env:
MYSQL_DATABASE: bbgo
MYSQL_USER: "root"
MYSQL_PASSWORD: "root" # pragma: allowlist secret

steps:

- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}

- name: Set up redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: ${{ matrix.redis-version }}
# auto-start: "false"

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Install Migration Tool
run: go install github.com/c9s/rockhopper/cmd/rockhopper@v1.2.1

- name: Test Migration SQL Files For MySQL
run: |
rockhopper --config rockhopper_mysql.yaml up

- name: Test Migration SQL Files For SQLite
run: |
rockhopper --config rockhopper_sqlite.yaml up

- name: Build
run: go build -v ./cmd/bbgo

- name: Test
run: |
go test -race -coverprofile coverage.txt -covermode atomic ./pkg/...
sed -i -e '/_requestgen.go/d' coverage.txt

- name: TestDnum
run: |
go test -race -coverprofile coverage_dnum.txt -covermode atomic -tags dnum ./pkg/...
sed -i -e '/_requestgen.go/d' coverage_dnum.txt

- name: Revive Check
uses: morphy2k/revive-action@v2
with:
reporter: github-pr-review
fail_on_error: true

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt,./coverage_dnum.txt

- name: Create dotenv file
run: |
echo "DB_DRIVER=mysql" >> .env.local
echo "DB_DSN=root:root@/bbgo" >> .env.local

22 changes: 22 additions & 0 deletions .github/workflows/golang-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: golang-lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
40 changes: 40 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Node.js CI

on:
push:
branches: [ main ]
paths:
- apps/backtest-report
- frontend
pull_request:
branches: [ main ]
paths:
- apps/backtest-report
- frontend

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 16.x ]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn
- name: Install
run: yarn install
working-directory: "apps/backtest-report"
- name: Build
run: yarn run next build
working-directory: "apps/backtest-report"
- name: Export
run: yarn run next export
working-directory: "apps/backtest-report"
- run: yarn export
working-directory: "frontend"
48 changes: 48 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Python

on:
push:
branches: [ main ]
paths:
- python

pull_request:
branches: [ main ]
paths:
- python

jobs:

build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ 3.8 ]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: pip install poetry==1.1.13

- name: Install package
run: |
cd python
poetry install

- name: Test
run: |
cd python
poetry run pytest -v -s tests

- name: Lint
run: |
cd python
poetry run flake8 .
Loading