Skip to content

Instantly share code, notes, and snippets.

@mementum
Created October 26, 2019 08:42
Show Gist options
  • Save mementum/aba92e2ca48d01746e61a6d029015869 to your computer and use it in GitHub Desktop.
Save mementum/aba92e2ca48d01746e61a6d029015869 to your computer and use it in GitHub Desktop.
Generate Cancles
import numpy as np
import pandas as pd
COLUMNS = ['open', 'high', 'low', 'close', 'volume', 'openinterest']
CANDLES = 20000
STOCKS
dateindex = pd.date_range(start='2010-01-01', periods=CANDLES, freq='15min')
for i in range(STOCKS):
data = np.random.randint(10, 20, size=(CANDLES, len(COLUMNS)))
df = pd.DataFrame(data * 1.01, dateindex, columns=COLUMNS)
df = df.rename_axis('datetime')
df.to_csv('candles{:02d}.csv'.format(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment