INNER CODE UNIT · Go

candle

sklinkert/at · cmd/import-histdata/main.go:85

				candle = nil // force new candle opening
			}
		}
		if candle == nil {
			candle = ohlc.New(instrument, currentTick.Datetime, candleDuration, true)
			candle.NewPrice(currentTick.Price(), currentTick.Datetime)
		}
		//if err := tx.Create(&currentTick).Error; err != nil {
		//	log.WithError(err).Warn("db.Create() failed: %v", currentTick)
		//	continue
		//}
		if imported%1000 == 0 {
			tx.Commit()
			tx = db.Begin()
		}

		if currentTime.Day() != currentTick.Datetime.Day() {
			slog.Info(fmt.Sprintf("Importing day %s", currentTick.Datetime))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…