Skip to content

Commit

Permalink
Merge pull request ccxt#17065 from ttodua/bitget-ohlcv-fix2
Browse files Browse the repository at this point in the history
bitget - fetchOHLCV for spot
  • Loading branch information
kroitor authored Mar 6, 2023
2 parents a6770fa + 0763c8a commit 755c0c4
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions js/bitget.js
Original file line number Diff line number Diff line change
Expand Up @@ -2064,24 +2064,23 @@ module.exports = class bitget extends Exchange {
if (limit === undefined) {
limit = 100;
}
if (market['type'] === 'spot') {
const timeframes = this.options['timeframes']['spot'];
request['period'] = this.safeString (timeframes, timeframe, timeframe);
const timeframes = this.options['timeframes'][marketType];
const selectedTimeframe = this.safeString (timeframes, timeframe, timeframe);
const duration = this.parseTimeframe (timeframe);
if (market['spot']) {
request['period'] = selectedTimeframe;
request['limit'] = limit;
if (since !== undefined) {
request['after'] = since;
if (until === undefined) {
const millisecondsPerTimeframe = this.options['timeframes']['swap'][timeframe] * 1000;
request['before'] = this.sum (since, millisecondsPerTimeframe * limit);
request['before'] = this.sum (since, limit * duration * 1000);
}
}
if (until !== undefined) {
request['before'] = until;
}
} else if (market['type'] === 'swap') {
const timeframes = this.options['timeframes']['swap'];
request['granularity'] = this.safeString (timeframes, timeframe, timeframe);
const duration = this.parseTimeframe (timeframe);
} else if (market['swap']) {
request['granularity'] = selectedTimeframe;
const now = this.milliseconds ();
if (since === undefined) {
request['startTime'] = now - (limit - 1) * (duration * 1000);
Expand Down

0 comments on commit 755c0c4

Please sign in to comment.