mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
add /api/environment/syncing api
This commit is contained in:
parent
b158884708
commit
7684099f01
|
@ -448,6 +448,9 @@ func (environ *Environment) Connect(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (environ *Environment) IsSyncing() bool {
|
||||
environ.syncMutex.Lock()
|
||||
defer environ.syncMutex.Unlock()
|
||||
|
||||
return environ.syncing
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@ func (s *Server) newEngine() *gin.Engine {
|
|||
r.POST("/api/setup/restart", s.setupRestart)
|
||||
}
|
||||
|
||||
r.GET("/api/environment/syncing", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"syncing": s.Environ.IsSyncing(),
|
||||
})
|
||||
})
|
||||
|
||||
r.GET("/api/trades", func(c *gin.Context) {
|
||||
if s.Environ.TradeService == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "database is not configured"})
|
||||
|
|
Loading…
Reference in New Issue
Block a user