mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 01:06:59 +08:00
refactor: split large files and clean up project structure
- Rename experience/ to telemetry/ for clarity - Split 15+ large Go files (800-2200 lines) into focused modules: kernel/engine.go, backtest/runner.go, market/data.go, store/position.go, api/handler_trader.go, trader/auto_trader_grid.go, and 9 exchange traders - Split frontend monoliths: types.ts, api.ts, AITradersPage.tsx, BacktestPage.tsx into domain-specific modules with barrel re-exports - Remove stale files: screenshots, .yml.old, pyproject.toml - Remove unused scripts/ and cmd/ directories - Remove broken/outdated test files (network-dependent, stale expectations)
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
package alpaca
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetBars(t *testing.T) {
|
||||
client := NewClient()
|
||||
|
||||
resp, err := client.GetBars(context.TODO(), "AAPL", "1Day", 5)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Log("=== AAPL 日线数据 (Alpaca IEX feed) ===")
|
||||
for i, bar := range resp {
|
||||
t.Logf("\n[%d] 时间: %s", i, bar.Timestamp.Format("2006-01-02 15:04:05"))
|
||||
t.Logf(" Open: %.2f", bar.Open)
|
||||
t.Logf(" High: %.2f", bar.High)
|
||||
t.Logf(" Low: %.2f", bar.Low)
|
||||
t.Logf(" Close: %.2f", bar.Close)
|
||||
t.Logf(" Volume: %d (股数)", bar.Volume)
|
||||
t.Logf(" TradeCount: %d (成交笔数)", bar.TradeCount)
|
||||
t.Logf(" VWAP: %.2f (成交量加权平均价)", bar.VWAP)
|
||||
|
||||
// 计算成交额
|
||||
quoteVolume := float64(bar.Volume) * bar.Close
|
||||
t.Logf(" 成交额: %.2f USD (Volume × Close)", quoteVolume)
|
||||
}
|
||||
|
||||
fmt.Printf("\n⚠️ 注意:IEX feed 只包含 IEX 交易所的数据,不是完整市场数据\n")
|
||||
fmt.Printf("完整市场数据需要使用 SIP feed(付费)\n")
|
||||
}
|
||||
Reference in New Issue
Block a user