mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
remove quota calculation from trader
This commit is contained in:
parent
33963f52e0
commit
ce391bfee7
|
@ -19,7 +19,6 @@ type Context struct {
|
||||||
CurrentPrice float64
|
CurrentPrice float64
|
||||||
|
|
||||||
Balances map[string]types.Balance
|
Balances map[string]types.Balance
|
||||||
Quota map[string]types.Balance
|
|
||||||
ProfitAndLossCalculator *accounting.ProfitAndLossCalculator
|
ProfitAndLossCalculator *accounting.ProfitAndLossCalculator
|
||||||
StockManager *StockManager
|
StockManager *StockManager
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,6 @@ func (trader *BackTestTrader) SubmitOrder(cxt context.Context, order *types.Subm
|
||||||
func (trader *BackTestTrader) RunStrategy(ctx context.Context, strategy Strategy) (chan struct{}, error) {
|
func (trader *BackTestTrader) RunStrategy(ctx context.Context, strategy Strategy) (chan struct{}, error) {
|
||||||
logrus.Infof("[regression] number of kline data: %d", len(trader.SourceKLines))
|
logrus.Infof("[regression] number of kline data: %d", len(trader.SourceKLines))
|
||||||
|
|
||||||
maxExposure := 0.4
|
|
||||||
trader.Context.Quota = make(map[string]types.Balance)
|
|
||||||
for currency, balance := range trader.Context.Balances {
|
|
||||||
quota := balance
|
|
||||||
quota.Available *= maxExposure
|
|
||||||
trader.Context.Quota[currency] = quota
|
|
||||||
}
|
|
||||||
|
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
defer close(done)
|
defer close(done)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user