Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into okcoin_update
  • Loading branch information
samuael committed Jan 30, 2024
2 parents c60147a + 682737f commit 7337086
Show file tree
Hide file tree
Showing 118 changed files with 4,496 additions and 12,410 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/proto-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- uses: bufbuild/buf-setup-action@v1.28.1
- uses: bufbuild/buf-setup-action@v1.29.0

- name: buf generate
working-directory: ./gctrpc
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
skip_wrapper_tests: true
- os: macos-13 # beta
goarch: amd64
psql: false
psql: true
skip_wrapper_tests: true
- os: windows-latest
goarch: amd64
Expand All @@ -34,13 +34,13 @@ jobs:

steps:
- name: Cancel previous workflow runs
uses: styfle/[email protected].0
uses: styfle/[email protected].1
with:
access_token: ${{ github.token }}

- name: Setup Postgres
if: matrix.psql == true
uses: ikalnytskyi/action-setup-postgres@v4
uses: ikalnytskyi/action-setup-postgres@v5
with:
database: gct_dev_ci
id: postgres
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
shell: bash

- name: Test
run: |
run: | # PGSERVICEFILE isn't supported by lib/pq and will cause a panic if set
unset PGSERVICEFILE
if [ "${{ matrix.goarch }}" = "386" ]; then
go test -coverprofile coverage.txt -covermode atomic ./...
Expand All @@ -100,7 +100,7 @@ jobs:

steps:
- name: Cancel previous workflow runs
uses: styfle/[email protected].0
uses: styfle/[email protected].1
with:
access_token: ${{ github.token }}

Expand All @@ -116,7 +116,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /tmp/.docker-buildx-cache
key: ${{ runner.os }}-docker-buildx-${{ hashFiles('./.github/workflows/arm64.Dockerfile') }}-${{ github.sha }}
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel previous workflow runs
uses: styfle/[email protected].0
uses: styfle/[email protected].1
with:
access_token: ${{ github.token }}

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| Okx | Yes | Yes | NA |
| Poloniex | Yes | Yes | NA |
| Yobit | Yes | NA | NA |
| ZB.COM | Yes | Yes | NA |

We are aiming to support the top 30 exchanges sorted by average liquidity as [ranked by CoinMarketCap](https://coinmarketcap.com/rankings/exchanges/).
However, we welcome pull requests for any exchange which does not match this criterion. If you need help with this, please join us on [Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk).
Expand Down
32 changes: 10 additions & 22 deletions backtester/engine/backtest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/gofrs/uuid"
"github.com/shopspring/decimal"
"github.com/stretchr/testify/assert"
"github.com/thrasher-corp/gocryptotrader/backtester/common"
"github.com/thrasher-corp/gocryptotrader/backtester/config"
"github.com/thrasher-corp/gocryptotrader/backtester/data"
Expand Down Expand Up @@ -1882,36 +1883,23 @@ func TestExecuteStrategy(t *testing.T) {
func TestNewBacktesterFromConfigs(t *testing.T) {
t.Parallel()
_, err := NewBacktesterFromConfigs(nil, nil)
if !errors.Is(err, gctcommon.ErrNilPointer) {
t.Errorf("received '%v' expected '%v'", err, gctcommon.ErrNilPointer)
}
assert.ErrorIs(t, err, gctcommon.ErrNilPointer, "NewBacktesterFromConfigs should error on nil for both configs")

cfg, err := config.ReadStrategyConfigFromFile(filepath.Join("..", "config", "strategyexamples", "dca-api-candles.strat"))
assert.NoError(t, err, "ReadStrategyConfigFromFile should not error")

strat1 := filepath.Join("..", "config", "strategyexamples", "dca-api-candles.strat")
cfg, err := config.ReadStrategyConfigFromFile(strat1)
if !errors.Is(err, nil) {
t.Errorf("received '%v' expected '%v'", err, nil)
}
dc, err := config.GenerateDefaultConfig()
if !errors.Is(err, nil) {
t.Errorf("received '%v' expected '%v'", err, nil)
}
assert.NoError(t, err, "GenerateDefaultConfig should not error")

_, err = NewBacktesterFromConfigs(cfg, nil)
if !errors.Is(err, gctcommon.ErrNilPointer) {
t.Errorf("received '%v' expected '%v'", err, gctcommon.ErrNilPointer)
}
assert.ErrorIs(t, err, gctcommon.ErrNilPointer, "NewBacktesterFromConfigs should error on nil default config")

_, err = NewBacktesterFromConfigs(nil, dc)
if !errors.Is(err, gctcommon.ErrNilPointer) {
t.Errorf("received '%v' expected '%v'", err, gctcommon.ErrNilPointer)
}
assert.ErrorIs(t, err, gctcommon.ErrNilPointer, "NewBacktesterFromConfigs should error on nil config")

bt, err := NewBacktesterFromConfigs(cfg, dc)
if !errors.Is(err, nil) {
t.Fatalf("received '%v' expected '%v'", err, nil)
}
if bt.MetaData.DateLoaded.IsZero() {
t.Errorf("received '%v' expected '%v'", bt.MetaData.DateLoaded, "a date")
if assert.NoError(t, err, "NewBacktesterFromConfigs should not error") {
assert.False(t, bt.MetaData.DateLoaded.IsZero(), "DateLoaded should have a non-zero date")
}
}

Expand Down
46 changes: 39 additions & 7 deletions cmd/documentation/config_templates/config_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

+ Contains configurations for:

- Exchanges for utilisation of a broad or minimal amount of enabled
exchanges [Example](#enable-exchange-via-config-example) for
enabling an exchange.
- Enable/Disable Exchanges. [See Example](#enable-exchange-via-config-example)

- Bank accounts for withdrawal and depositing FIAT between exchange and
your personal accounts [Example](#enable-bank-accounts-via-config-example).
your personal accounts. [See Example](#enable-bank-accounts-via-config-example)

- Portfolio to monitor online and offline accounts [Example](#enable-portfolio-via-config-example).
- Portfolio to monitor online and offline accounts. [See Example](#enable-portfolio-via-config-example)

- Currency configurations to set your foreign exchange provider accounts,
your preferred display currency, suitable FIAT currency and suitable
cryptocurrency [Example](#enable-currency-via-config-example).
cryptocurrency. [See Example](#enable-currency-via-config-example)

- Communication for utilisation of supported communication mediums e.g.
email events direct to your personal account [Example](#enable-communications-via-config-example).
email events direct to your personal account. [See Example](#enable-communications-via-config-example)

- Websocket subscription channels. [See Example](#configure-exchange-websocket-subscriptions)

# Config Examples

Expand Down Expand Up @@ -194,6 +194,38 @@ comm method and add in your contact list if available.
},
```

## Configure exchange websocket subscriptions

+ Websocket subscriptions provide a stream of data from an exchange.
Whilst subscriptions are specific to each exchange, some common examples are: candles, orderbook, ticker and allTrades.
You can configure any supported channels in your exchange, but most likely you just want to disable some of the defaults, or change the default intervals.
You cannot configure an empty list of subscriptions, instead set all of the subscriptions to enabled: false.

See the section `exchange.features.enabled.subscriptions` for configuring subscriptions:

```js
"subscriptions": [
{
"enabled": true,
"channel": "ticker"
},
{
"enabled": false,
"channel": "allTrades"
},
{
"enabled": true,
"channel": "candles",
"interval": "1m"
},
{
"enabled": true,
"channel": "orderbook",
"interval": "100ms"
}
]
```


## Configure Network Time Server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ _b in this context is an `IBotExchange` implemented struct_
| Okx | Yes | Yes | Yes |
| Poloniex | Yes | Yes | Yes |
| Yobit | Yes | NA | No |
| ZB.COM | Yes | Yes | No |


### Please click GoDocs chevron above to view current GoDoc information for this package
Expand Down
105 changes: 0 additions & 105 deletions cmd/documentation/exchanges_templates/zb.tmpl

This file was deleted.

1 change: 0 additions & 1 deletion cmd/documentation/root_templates/root_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| Okx | Yes | Yes | NA |
| Poloniex | Yes | Yes | NA |
| Yobit | Yes | NA | NA |
| ZB.COM | Yes | Yes | NA |

We are aiming to support the top 30 exchanges sorted by average liquidity as [ranked by CoinMarketCap](https://coinmarketcap.com/rankings/exchanges/).
However, we welcome pull requests for any exchange which does not match this criterion. If you need help with this, please join us on [Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestMain(m *testing.M) {
if skipAdditionalWrapperCITests() {
return
}
request.MaxRequestJobs = 200
os.Exit(m.Run())
}

Expand Down
46 changes: 39 additions & 7 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader

+ Contains configurations for:

- Exchanges for utilisation of a broad or minimal amount of enabled
exchanges [Example](#enable-exchange-via-config-example) for
enabling an exchange.
- Enable/Disable Exchanges. [See Example](#enable-exchange-via-config-example)

- Bank accounts for withdrawal and depositing FIAT between exchange and
your personal accounts [Example](#enable-bank-accounts-via-config-example).
your personal accounts. [See Example](#enable-bank-accounts-via-config-example)

- Portfolio to monitor online and offline accounts [Example](#enable-portfolio-via-config-example).
- Portfolio to monitor online and offline accounts. [See Example](#enable-portfolio-via-config-example)

- Currency configurations to set your foreign exchange provider accounts,
your preferred display currency, suitable FIAT currency and suitable
cryptocurrency [Example](#enable-currency-via-config-example).
cryptocurrency. [See Example](#enable-currency-via-config-example)

- Communication for utilisation of supported communication mediums e.g.
email events direct to your personal account [Example](#enable-communications-via-config-example).
email events direct to your personal account. [See Example](#enable-communications-via-config-example)

- Websocket subscription channels. [See Example](#configure-exchange-websocket-subscriptions)

# Config Examples

Expand Down Expand Up @@ -212,6 +212,38 @@ comm method and add in your contact list if available.
},
```
## Configure exchange websocket subscriptions
+ Websocket subscriptions provide a stream of data from an exchange.
Whilst subscriptions are specific to each exchange, some common examples are: candles, orderbook, ticker and allTrades.
You can configure any supported channels in your exchange, but most likely you just want to disable some of the defaults, or change the default intervals.
You cannot configure an empty list of subscriptions, instead set all of the subscriptions to enabled: false.
See the section `exchange.features.enabled.subscriptions` for configuring subscriptions:
```js
"subscriptions": [
{
"enabled": true,
"channel": "ticker"
},
{
"enabled": false,
"channel": "allTrades"
},
{
"enabled": true,
"channel": "candles",
"interval": "1m"
},
{
"enabled": true,
"channel": "orderbook",
"interval": "100ms"
}
]
```
## Configure Network Time Server
Expand Down
Loading

0 comments on commit 7337086

Please sign in to comment.