forked from jesse-ai/jesse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_custom_driver.py
More file actions
57 lines (46 loc) · 1.98 KB
/
test_custom_driver.py
File metadata and controls
57 lines (46 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
Test CustomCSV driver
"""
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'jesse'))
def test_custom_driver():
"""Test CustomCSV driver"""
print("🧪 Тест CustomCSV driver")
print("=" * 40)
try:
# Set Jesse project directory
os.chdir('/Users/alxy/Desktop/1PROJ/JesseLocal/project-template')
print(f" 📊 Рабочая директория: {os.getcwd()}")
from jesse.modes.import_candles_mode.drivers.Custom.CustomCSV import CustomCSV
print("1️⃣ Импорт CustomCSV driver... ✅")
# Create driver instance
driver = CustomCSV()
print("2️⃣ Создание driver instance... ✅")
# Test get_available_symbols
print("\n3️⃣ Тестируем get_available_symbols...")
symbols = driver.get_available_symbols()
print(f" ✅ Найдено {len(symbols)} символов")
print(f" 📋 Первые 5: {symbols[:5]}")
# Test get_starting_time
if symbols:
symbol = symbols[0]
print(f"\n4️⃣ Тестируем get_starting_time для {symbol}...")
start_time = driver.get_starting_time(symbol)
print(f" ✅ Начальное время: {start_time}")
# Test fetch
if symbols:
symbol = symbols[0]
print(f"\n5️⃣ Тестируем fetch для {symbol}...")
candles = driver.fetch(symbol, start_time, '1m')
print(f" ✅ Получено {len(candles)} свечей")
if candles:
print(f" 📊 Первая свеча: {candles[0]}")
print("\n🎉 Все тесты прошли успешно!")
except Exception as e:
print(f"\n❌ Ошибка: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_custom_driver()