Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created July 19, 2023 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantra-go-algo/ad4a3894af817f3de88dc3480b4615ed to your computer and use it in GitHub Desktop.
Save quantra-go-algo/ad4a3894af817f3de88dc3480b4615ed to your computer and use it in GitHub Desktop.
# Import libraries
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Conv1D, MaxPooling1D, Flatten, Dense
# Load and preprocess the data
data = pd.read_csv('trading_data.csv')
# Perform data preprocessing steps as per your requirements
# Split the data into training and testing sets
train_data = data.loc[data['date'] < date_to_split]
test_data = data.loc[data['date'] >= date_to_split]
# Define the input and output variables
x_train = train_data[['feature1', 'feature2', 'feature3']].values
y_train = train_data['target'].values
x_test = test_data[['feature1', 'feature2', 'feature3']].values
y_test = test_data['target'].values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment