Skip to content

Commit 3e3549b

Browse files
committed
use public ticker for bot
1 parent 8ecd3a9 commit 3e3549b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/profile/profile_service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,22 @@ export class ProfileService {
141141
}
142142

143143
/**
144-
* Fetch ticker/market data for a pair
144+
* Fetch ticker/market data for a pair using authenticated exchange
145145
*/
146146
async fetchTicker(profileId: string, pair: string): Promise<MarketData> {
147147
const exchange = await this.getExchangeForProfile(profileId);
148148
return fetchMarketData(exchange, pair);
149149
}
150150

151+
/**
152+
* Fetch ticker/market data using public (unauthenticated) exchange.
153+
* Use this for watch mode bots that don't need authentication.
154+
*/
155+
async fetchTickerPublic(exchangeName: string, pair: string): Promise<MarketData> {
156+
const exchange = await this.exchangeInstanceService.getPublicExchange(exchangeName);
157+
return fetchMarketData(exchange, pair);
158+
}
159+
151160
/**
152161
* Fetch open orders for a profile/pair
153162
*/

src/strategy/bot_runner.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ export class BotRunner {
9696
}
9797

9898
private async runBot(bot: Bot, profile: Profile): Promise<void> {
99-
const marketData = await this.profileService.fetchTicker(profile.id, bot.pair);
100-
10199
const isWatchOnly = bot.mode === 'watch';
102100

101+
// Always use public exchange for ticker (no auth needed)
102+
const marketData = await this.profileService.fetchTickerPublic(profile.exchange, bot.pair);
103+
103104
// Execute strategy
104105
const signal = await this.strategyExecutor.executeStrategy(
105106
bot.strategy,

0 commit comments

Comments
 (0)