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

Commit

Permalink
network speedup: check markets cache for existing symbols in ccxt.go#…
Browse files Browse the repository at this point in the history
…symbolExists(), closes #559 (#560)

* 1 - check markets cache for existing symbols in ccxt.go#symbolExists()

* 2 - update circle ci config to use another secret key for trader file to avoid contention

* 3 - fix sed command circle ci
  • Loading branch information
nikhilsaraf authored Oct 25, 2020
1 parent 12ac3ce commit 4be693d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ commands:
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" ./...

replace_trader_secret:
steps:
- run:
name: Replace Trader Secret
command: sed -i -e 's/SAOQ6IG2WWDEP47WEJNLIU27OBODMEWFDN6PVUR5KHYDOCVCL34J2CUD/SCNWRBLLRCPKKMFTDBU2JN6DWOLJ42FGOQHVF62FMXRQRI7HEERAAO2B/' examples/configs/trader/sample_trader.cfg

replace_source_secret:
steps:
- run:
name: Replace Source Secret
command: sed -i -e 's/SDDAHRX2JB663N3OLKZIBZPF33ZEKMHARX362S737JEJS2AX3GJZY5LU/SCNWRBLLRCPKKMFTDBU2JN6DWOLJ42FGOQHVF62FMXRQRI7HEERAAO2B/' examples/configs/trader/sample_trader.cfg

test_kelp__integration_delete:
steps:
- run:
Expand Down Expand Up @@ -106,6 +118,8 @@ jobs:
# don't list sell_twap strategy for now because it requires a db to be enabled in sample_trader.cfg
- install_deps
- build_kelp
- replace_trader_secret
- replace_source_secret
# 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
Expand Down
5 changes: 5 additions & 0 deletions support/sdk/ccxt.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ func (c *Ccxt) newInstance(apiKey api.ExchangeAPIKey, params []api.ExchangeParam

// symbolExists returns an error if the symbol does not exist
func (c *Ccxt) symbolExists(tradingPair string) error {
if _, ok := c.markets[tradingPair]; ok {
log.Printf("found trading pair symbol '%s' in markets map", tradingPair)
return nil
}

// get list of symbols available on exchange
url := ccxtBaseURL + pathExchanges + "/" + c.exchangeName + "/" + c.instanceName
// decode generic data (see "https://blog.golang.org/json-and-go#TOC_4.")
Expand Down

0 comments on commit 4be693d

Please sign in to comment.