Skip to content

Commit

Permalink
xfunding: fix transfer and refactoring more methods
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Mar 23, 2023
1 parent a838b49 commit 20cd73e
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 64 deletions.
30 changes: 16 additions & 14 deletions config/xfunding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ notifications:
sessions:
binance:
exchange: binance
envVarPrefix: binance
envVarPrefix: BINANCE

binance_futures:
exchange: binance
envVarPrefix: BINANCE
futures: true

exchangeStrategies:
- on: binance
funding:
crossExchangeStrategies:

- xfunding:
spotSession: binance
futuresSession: binance_futures
symbol: ETHUSDT
quantity: 0.0001
fundingRate:
high: 0.01%
supportDetection:
- interval: 1m
movingAverageType: EMA
movingAverageIntervalWindow:
interval: 15m
window: 60
minVolume: 8_000
leverage: 1.0
incrementalQuoteQuantity: 11
quoteInvestment: 110
shortFundingRate:
high: 0.000%
low: -0.01%
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/c9s/rockhopper v1.2.2-0.20220617053729-ffdc87df194b
github.com/cenkalti/backoff/v4 v4.2.0
github.com/cheggaaa/pb/v3 v3.0.8
github.com/cloudflare/cfssl v0.0.0-20190808011637-b1ec8c586c2a
github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482
github.com/ethereum/go-ethereum v1.10.23
github.com/evanphx/json-patch/v5 v5.6.0
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cfssl v0.0.0-20190808011637-b1ec8c586c2a h1:ym8P2+ZvUvVtpLzy8wFLLvdggUIU31mvldvxixQQI2o=
github.com/cloudflare/cfssl v0.0.0-20190808011637-b1ec8c586c2a/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down
4 changes: 2 additions & 2 deletions pkg/strategy/drift/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *Strategy) SubmitOrder(ctx context.Context, submitOrder types.SubmitOrde
if err != nil {
return nil, err
}
createdOrders, errIdx, err := bbgo.BatchPlaceOrder(ctx, s.Session.Exchange, formattedOrder)
createdOrders, errIdx, err := bbgo.BatchPlaceOrder(ctx, s.Session.Exchange, nil, formattedOrder)
if len(errIdx) > 0 {
return nil, err
}
Expand Down Expand Up @@ -539,7 +539,7 @@ func (s *Strategy) klineHandler(ctx context.Context, kline types.KLine, counter
s.atr.PushK(kline)
atr := s.atr.Last()

price := kline.Close //s.getLastPrice()
price := kline.Close // s.getLastPrice()
pricef := price.Float64()
lowf := math.Min(kline.Low.Float64(), pricef)
highf := math.Max(kline.High.Float64(), pricef)
Expand Down
25 changes: 25 additions & 0 deletions pkg/strategy/xfunding/positionaction_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 20cd73e

Please sign in to comment.