feat(lighter): improve API key validation and market caching

- Add API key validation status tracking
- Add market list caching to reduce API calls
- Improve logging (debug vs info levels)
- Add comprehensive integration tests
- Update trader manager and store for lighter support
This commit is contained in:
tinkle-community
2026-01-17 23:07:35 +08:00
parent 19698529b8
commit 7f24a90851
11 changed files with 2024 additions and 166 deletions

View File

@@ -141,7 +141,7 @@ func runStandardTests(t *testing.T, exchangeName string) {
traderID, exchangeID, exchangeType,
trade.Symbol, trade.Side, trade.Action,
trade.Quantity, trade.Price, trade.Fee, trade.RealizedPnL,
time.Now().Add(time.Duration(i)*time.Second),
time.Now().Add(time.Duration(i)*time.Second).UnixMilli(),
"",
)
if err != nil {
@@ -227,7 +227,7 @@ func TestPositionAccumulationBug(t *testing.T) {
traderID, exchangeID, exchangeType,
"ETHUSDT", "LONG", "open_long",
0.1, 3500+float64(i*10), 0.5, 0,
time.Now().Add(time.Duration(i*2)*time.Second),
time.Now().Add(time.Duration(i*2)*time.Second).UnixMilli(),
"",
)
if err != nil {
@@ -239,7 +239,7 @@ func TestPositionAccumulationBug(t *testing.T) {
traderID, exchangeID, exchangeType,
"ETHUSDT", "LONG", "close_long",
0.1, 3600+float64(i*10), 0.5, 10,
time.Now().Add(time.Duration(i*2+1)*time.Second),
time.Now().Add(time.Duration(i*2+1)*time.Second).UnixMilli(),
"",
)
if err != nil {
@@ -309,7 +309,7 @@ func TestQuantityPrecision(t *testing.T) {
traderID, exchangeID, exchangeType,
"BTCUSDT", "LONG", "open_long",
0.01, 50000, 1.0, 0,
time.Now(),
time.Now().UnixMilli(),
"",
)
if err != nil {
@@ -322,7 +322,7 @@ func TestQuantityPrecision(t *testing.T) {
traderID, exchangeID, exchangeType,
"BTCUSDT", "LONG", "close_long",
0.00999999, 51000, 1.0, 10,
time.Now().Add(time.Second),
time.Now().Add(time.Second).UnixMilli(),
"",
)
if err != nil {