Rewrite price lookup from WebSocket to REST API
Replace unreliable WebSocket connections with on-demand REST API calls for spot and futures prices. Add cached trading pair list (refreshed hourly) for symbol validation, and /refresh command for manual updates. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package commands
|
||||
|
||||
import (
|
||||
"gopkg.in/telebot.v3"
|
||||
"me.thuanle/bbot/internal/data"
|
||||
"me.thuanle/bbot/internal/services/controllers"
|
||||
"me.thuanle/bbot/internal/services/tele/chat"
|
||||
"me.thuanle/bbot/internal/services/tele/view"
|
||||
@@ -16,3 +17,8 @@ func OnGetTopFundingFee(context telebot.Context) error {
|
||||
fee, float64s, cds := controllers.GetTopFundingFee()
|
||||
return chat.ReplyMessagePre(context, view.RenderOnGetTopFundingFeeMessage(fee, float64s, cds))
|
||||
}
|
||||
|
||||
func OnRefreshPairCache(context telebot.Context) error {
|
||||
data.Market.RefreshTradingPairCache()
|
||||
return chat.ReplyMessage(context, "Trading pair cache refreshed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user