remove quota calculation from trader

This commit is contained in:
c9s 2020-09-19 11:00:32 +08:00
parent 33963f52e0
commit ce391bfee7
2 changed files with 0 additions and 9 deletions

View File

@ -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
} }

View File

@ -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)