mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
add sync api for syncing trades in the background
This commit is contained in:
parent
7684099f01
commit
c72b7b2dfa
|
@ -76,6 +76,18 @@ func (s *Server) newEngine() *gin.Engine {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.POST("/api/environment/sync", func(c *gin.Context) {
|
||||||
|
go func() {
|
||||||
|
if err := s.Environ.Sync(context.Background()) ; err != nil {
|
||||||
|
logrus.WithError(err).Error("sync error")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": true,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
r.GET("/api/trades", func(c *gin.Context) {
|
r.GET("/api/trades", func(c *gin.Context) {
|
||||||
if s.Environ.TradeService == nil {
|
if s.Environ.TradeService == nil {
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "database is not configured"})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "database is not configured"})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user