Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
romanornr committed Oct 30, 2023
1 parent 7eea9bd commit c131c69
Show file tree
Hide file tree
Showing 15 changed files with 1,776 additions and 357 deletions.
8 changes: 6 additions & 2 deletions algo/shortestPath/pairs.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ func fetchTickerPrice(e exchange.IBotExchange, currencies []currency.Code, asset
// currencies VIA, BTC, USD (3 currency codes)
// which should become VIA-BTC, BTC-USD (2 pairs created from 3 currency codes)

d := singleton.GetDealer()
e, err := d.ExchangeManager.GetExchangeByName(e.GetName())
d, err := singleton.GetDealer(context.Background())
if err != nil {
return 0, err
}

e, err = d.ExchangeManager.GetExchangeByName(e.GetName())
if err != nil {
return 0, err
}
Expand Down
10 changes: 6 additions & 4 deletions dealer/dealer.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ func (b Builder) Build(ctx context.Context) (*Dealer, error) {

var ErrOrdersAlreadyExists = errors.New("order already exists")

// Dealer struct holds all the information about an instance of an autodealer (`root`, `settings`, `config`, `httpFactory`, `wg`, `ctx`, `exchangeManager`).
// It has inner structs which are instances of ExchangeManager, WithdrawManager. It has functions such as NewExchangeManager() and return an instance of ExchangeManager.
// This is used for looking up exchange support to enable, and we control it through NewExchangeManager() and WithdrawManager instance.
// Dealer struct holds state. In this case it specifically has a definition function Augment().
// It also stores internal values such as the path the configs will be read from, the closures/recipe function it will use while conditioning config values.
// Our Augment() will run before the Build() code is called. In this case, the config itself may have been read from a filepath.
// In this case, our function augments with a value from the dealerBuilder struct/obj. That function is then run, and various further functions that had been defined for this.
// Finally, if a file wasn't found, one of the directives within our builder will be constructed a new default template as an alternative to the expected input not found (the expected input "initial"
type Dealer struct {
Root RootStrategy
Settings engine.Settings
Expand Down Expand Up @@ -603,7 +605,7 @@ func (bot *Dealer) loadExchange(ctx context.Context, exchCfg *config.Exchange, w
ctx, cancel := context.WithTimeout(ctx, constDefaultValidateCredentialsTimeout)
defer cancel()

if err := exch.ValidateCredentials(ctx, useAsset); err != nil {
if err := exch.ValidateAPICredentials(ctx, useAsset); err != nil {
What(log.Warn().
Err(err).
Str("exchange", exch.GetName()),
Expand Down
82 changes: 43 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ module github.com/romanornr/autodealer
go 1.17

require (
github.com/RyanCarrier/dijkstra v1.2.0
github.com/go-chi/chi/v5 v5.0.8
github.com/go-chi/render v1.0.2
github.com/go-echarts/go-echarts/v2 v2.2.4
github.com/hibiken/asynq v0.24.0
github.com/rs/cors v1.8.3
github.com/rs/zerolog v1.29.0
github.com/RyanCarrier/dijkstra v1.3.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/httplog v0.3.1
github.com/go-chi/render v1.0.3
github.com/hibiken/asynq v0.24.1
github.com/rs/cors v1.10.1
github.com/rs/zerolog v1.31.0
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.15.0
github.com/thrasher-corp/gocryptotrader v0.0.0-20230405030735-d23898e63ae0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.17.0
github.com/thrasher-corp/gocryptotrader v0.0.0-20231030061457-dbe41a741220
go.uber.org/multierr v1.11.0
gopkg.in/errgo.v2 v2.1.0
)
Expand All @@ -22,57 +22,61 @@ require (
github.com/ajg/form v1.5.1 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/d5/tengo/v2 v2.14.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/d5/tengo/v2 v2.16.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/friendsofgo/errors v0.9.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-chi/httplog v0.3.0 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pquerna/otp v1.4.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/thrasher-corp/gct-ta v0.0.0-20200623072738-f2b55b7f9f41 // indirect
github.com/thrasher-corp/sqlboiler v1.0.1-0.20191001234224-71e17f37a85e // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
github.com/volatiletech/null v8.0.0+incompatible // indirect
github.com/volatiletech/sqlboiler v3.7.1+incompatible // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/redis/go-redis/v9 v9.2.1 // indirect
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
)
Loading

0 comments on commit c131c69

Please sign in to comment.