tmmdev commited on
Commit
d030c0f
·
1 Parent(s): e6ffcce

[add] Move test_data module from main project

Browse files
Files changed (1) hide show
  1. test_data.py +23 -0
test_data.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+
4
+ # Generate 150 days test data
5
+ days = 150
6
+ base_price = 100
7
+
8
+ # Generate price changes with realistic volatility
9
+ price_changes = np.random.normal(0.001, 0.02, days).cumsum()
10
+ base_prices = base_price * (1 + price_changes)
11
+
12
+ # Create DataFrame with all OHLCV components
13
+ test_data = pd.DataFrame({
14
+ 'open': base_prices * (1 + np.random.normal(0, 0.005, days)), # Opening prices
15
+ 'high': base_prices * (1 + np.random.normal(0.01, 0.008, days)), # Day's high prices
16
+ 'low': base_prices * (1 + np.random.normal(-0.01, 0.008, days)), # Day's low prices
17
+ 'close': base_prices * (1 + np.random.normal(0, 0.005, days)), # Closing prices
18
+ 'volume': np.random.normal(1000000, 200000, days).astype(int) # Daily volume
19
+ })
20
+
21
+ # Ensure high is always highest and low is always lowest
22
+ test_data['high'] = test_data[['open', 'high', 'close']].max(axis=1)
23
+ test_data['low'] = test_data[['open', 'low', 'close']].min(axis=1)