saniales/golang-crypto-trading-bot

Binance empty interval

inigosola opened this issue · 1 comments

I have configured a yaml file like the following:

simulation_mode: true
exchange_configs:
- exchange: binance
  public_key: aaa
  secret_key: bbb
  deposit_addresses: {}
  fake_balances:
    USDT: 35
strategies:
- strategy: prueba
  markets:
  - market: BTC-USDT
    bindings:
    - exchange: binance
      market_name: BTCUSDT

I get an API error ([] <APIError> code=-1105, msg=Parameter 'interval' was empty.) when I try to get the candles ( wrappers[0].GetCandles(markets[0])).

The problem is in binance.go file, line 236: binanceCandles, err := wrapper.api.NewKlinesService().Symbol(MarketNameFor(market, wrapper)).Do(context.Background())

NewKlinesService create a new Klines service without Interval field, only with the client (c):

type KlinesService struct {
	c         *Client
	symbol    string
	interval  string
	limit     *int
	startTime *int64
	endTime   *int64
}

func (c *Client) NewKlinesService() *KlinesService {
	return &KlinesService{c: c}
}

Then (as you can see above), it calls a Symbol method to set the symbol, but it never calls to Interval method to set it.

Feel free to open a PR with your fix, Thank you for signaling this issue <3