Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
basic integration tests with sample config files, closes #51 (#543)
Browse files Browse the repository at this point in the history
* 1 - add basic buysell integration test with sample config files

* 2 - add job: test_1_13__integration

* 3 - create equivalent tests for remaining strategies

* 4 - sequential running of integration tests

* 5 - set default FILL_TRACKER_SLEEP_MILLIS to half of TICK_INTERVAL_SECONDS

* 6 - restructure integration tests because of rate limit issues

* 7 - further limit tests to avoid rate limit issues
  • Loading branch information
nikhilsaraf committed Oct 18, 2020
1 parent 5fa75b1 commit dcd59c3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
55 changes: 48 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ commands:
paths:
- "/go/src/github.com/stellar/kelp/vendor"

test_kelp:
steps:
- run:
name: Run Kelp tests
command: go test --short -ldflags="-X github.com/stellar/kelp/cmd.version=test_compile -X github.com/stellar/kelp/cmd.guiVersion=test_compile -X github.com/stellar/kelp/cmd.gitBranch=test_compile -X github.com/stellar/kelp/cmd.gitHash=test_compile -X github.com/stellar/kelp/cmd.buildDate=test_compile -X github.com/stellar/kelp/cmd.env=dev" ./...

build_kelp:
steps:
- run:
Expand All @@ -55,6 +49,37 @@ commands:
name: Ensure build was successful
command: ./bin/kelp version

test_kelp:
steps:
- run:
name: Run Kelp tests
command: go test --short -ldflags="-X github.com/stellar/kelp/cmd.version=test_compile -X github.com/stellar/kelp/cmd.guiVersion=test_compile -X github.com/stellar/kelp/cmd.gitBranch=test_compile -X github.com/stellar/kelp/cmd.gitHash=test_compile -X github.com/stellar/kelp/cmd.buildDate=test_compile -X github.com/stellar/kelp/cmd.env=dev" ./...

test_kelp__integration_delete:
steps:
- run:
name: Run Kelp tests integration - delete
command: ./bin/kelp trade -c examples/configs/trader/sample_trader.cfg -s delete --iter 1

test_kelp__integration_buysell:
steps:
- run:
name: Run Kelp tests integration - buysell
command: ./bin/kelp trade -c examples/configs/trader/sample_trader.cfg -s buysell -f examples/configs/trader/sample_buysell.cfg --iter 1

test_kelp__integration_balanced:
steps:
- run:
name: Run Kelp tests integration - balanced
command: ./bin/kelp trade -c examples/configs/trader/sample_trader.cfg -s balanced -f examples/configs/trader/sample_balanced.cfg --iter 1

test_kelp__integration_mirror:
steps:
- run:
name: Run Kelp tests integration - mirror
command: ./bin/kelp trade -c examples/configs/trader/sample_trader.cfg -s mirror -f examples/configs/trader/sample_mirror.cfg --iter 1


jobs:
# test performs all package tests from Kelp
test_1_13:
Expand All @@ -66,14 +91,30 @@ jobs:
- image: circleci/postgres:12.1-alpine-ram
environment:
POSTGRES_USER: postgres

steps:
- install_deps
- build_kelp
- test_kelp

# test runs all the strategies as integration tests, one after the other so there's no interference
test_1_13__integration:
working_directory: /go/src/github.com/stellar/kelp
docker:
- image: circleci/golang:1.13
steps:
# limit to only the key strategies because of rate limit issues, remaining strategies: sell, sell_twap, pendulum
- install_deps
- build_kelp
# delete once before we start our set of tests, don't delete in between tests because of rate limit issues
- test_kelp__integration_delete
- test_kelp__integration_buysell
- test_kelp__integration_balanced
# run mirror last because it produces many offers
- test_kelp__integration_mirror

workflows:
version: 2
build-and-test:
jobs:
- test_1_13
- test_1_13__integration
2 changes: 1 addition & 1 deletion examples/configs/trader/sample_trader.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DELETE_CYCLES_THRESHOLD=0
# Note: in most cases you are probably better off tracking fills at the beginning of the update cycle only (by setting SYNCHRONIZE_STATE_LOAD_ENABLE to true)
# although there is a valid use case to still want to track fills every X milliseconds in addition to using the new config, for example when you want a
# faster response to trades, such as with the mirror strategy.
FILL_TRACKER_SLEEP_MILLIS=0
FILL_TRACKER_SLEEP_MILLIS=150000
# how many continuous errors in each fill-tracking cycle can the bot accept before it will delete all offers to protect its exposure.
# this number has to be exceeded for all the offers to be deleted and any error will be counted only once per cycle.
# any time the bot completes a full run successfully this counter will be reset.
Expand Down

0 comments on commit dcd59c3

Please sign in to comment.