Skip to content

Instantly share code, notes, and snippets.

View quantra-go-algo's full-sized avatar

Algorithmic Trading quantra-go-algo

View GitHub Profile
import cudf
import cuml
import pyfolio as pf
import numpy as np
import pandas as pd
import yfinance as yf
import matplotlib.pyplot as plt
from hmmlearn import hmm
from sklearn.utils import check_random_state
# Import the libraries
import pandas as pd
import cudf
import cuml
from cuml.datasets import make_classification
from cuml.model_selection import train_test_split
# Generating a sample Pandas DataFrame
X, y = make_classification(n_samples=1000, n_features=4, n_classes=2, random_state=42)
# Import the libraries
from cuml.cluster import KMeans
import cudf
# Generate sample data
data = cudf.DataFrame()
data['feature1'] = cp.random.rand(1000)
data['feature2'] = cp.random.rand(1000)
# Perform KMeans clustering
# Import the libraries
import pandas as pd
import cudf
# Creating a Pandas DataFrame
pandas_data = {
'A': [1, 2, 3, 4, 5],
'B': [10, 20, 30, 40, 50],
'C': ['a', 'b', 'c', 'd', 'e']
}
# Import the corresponding library
import cudf
# Create a GPU DataFrame
data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
df = cudf.DataFrame(data)
# Perform data manipulation
df['C'] = df['A'] + df['B']
print(df)
# Import the corresponding library
import cupy as cp
# Define matrices using CuPy arrays
matrix_a = cp.array([[1, 2], [3, 4]])
matrix_b = cp.array([[5, 6], [7, 8]])
# Perform a matrix multiplication using CuPy
result = cp.matmul(matrix_a, matrix_b)
print("Result of Matrix Multiplication:")
# Import the cupy library
import cupy as cp
# Create 10,000 random numbers
x = cp.random.rand(10000)
y = cp.random.rand(10000)
# Perform the multiplication of both arrays
result = cp.dot(x, y)
import cudf
import cuml
import cupy
conda install -c rapidsai -c nvidia -c conda-forge -c defaults rapids=0.21 python=3.10
conda activate rapids