fix charts
This commit is contained in:
60
test_pivot_api.py
Normal file
60
test_pivot_api.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify pivot recalculation API works
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
def test_pivot_api():
|
||||
"""Test the pivot recalculation API"""
|
||||
|
||||
print("Testing pivot recalculation API...")
|
||||
print("-" * 50)
|
||||
|
||||
url = "http://localhost:8051/api/recalculate-pivots"
|
||||
|
||||
payload = {
|
||||
"symbol": "ETH/USDT",
|
||||
"timeframe": "1m"
|
||||
}
|
||||
|
||||
try:
|
||||
print(f"Calling: {url}")
|
||||
print(f"Payload: {json.dumps(payload, indent=2)}")
|
||||
|
||||
response = requests.post(url, json=payload, timeout=10)
|
||||
|
||||
print(f"Status: {response.status_code}")
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print(f"Success: {data.get('success')}")
|
||||
|
||||
if data.get('success'):
|
||||
pivot_markers = data.get('pivot_markers', {})
|
||||
print(f"Pivot markers: {len(pivot_markers)} timestamps")
|
||||
|
||||
# Show first few pivot markers
|
||||
for i, (timestamp, pivots) in enumerate(list(pivot_markers.items())[:3]):
|
||||
highs = len(pivots.get('highs', []))
|
||||
lows = len(pivots.get('lows', []))
|
||||
print(f" {timestamp}: {highs} highs, {lows} lows")
|
||||
|
||||
if len(pivot_markers) > 3:
|
||||
print(f" ... and {len(pivot_markers) - 3} more")
|
||||
|
||||
print("✅ Pivot API working correctly!")
|
||||
else:
|
||||
print(f"❌ API returned error: {data.get('error')}")
|
||||
else:
|
||||
print(f"❌ HTTP Error: {response.status_code}")
|
||||
print(f"Response: {response.text}")
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"❌ Request failed: {e}")
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_pivot_api()
|
||||
Reference in New Issue
Block a user