bcp6 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bcp6-0.1/MANIFEST.in ADDED
@@ -0,0 +1 @@
1
+ include bcp6/data.txt
bcp6-0.1/PKG-INFO ADDED
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: bcp6
3
+ Version: 0.1
bcp6-0.1/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # bcp6
2
+
3
+ Version: 0.1
4
+
5
+ This package was created using the PyPI Package Generator.
@@ -0,0 +1,2 @@
1
+ from importlib.resources import files
2
+ print(files("bcp6").joinpath("data.txt").read_text())
bcp6-0.1/bcp6/data.txt ADDED
@@ -0,0 +1,66 @@
1
+ import requests
2
+ import numpy as np
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+ from sklearn.preprocessing import MinMaxScaler
6
+ from tensorflow.keras.models import Sequential
7
+ from tensorflow.keras.layers import LSTM, Dense, Dropout
8
+
9
+
10
+ key = '9868b3d065ca4448baaf699d7fb35fd4'
11
+ url = f'https://api.twelvedata.com/time_series?symbol=BTC/USD&start_date=2021-11-03&end_date=2021-11-20&interval=5min&order=asc&apikey={key}'
12
+ data = pd.DataFrame(requests.get(url).json()['values'])
13
+
14
+
15
+ scaler = MinMaxScaler()
16
+ prices = scaler.fit_transform(data[['close']])
17
+
18
+
19
+ n = 24
20
+ x, y = [], []
21
+
22
+ for i in range(n, len(prices) - 12):
23
+ x.append(prices[i-n:i])
24
+ y.append(prices[i+12])
25
+
26
+ x, y = np.array(x), np.array(y)
27
+
28
+
29
+ model = Sequential([
30
+ LSTM(128, return_sequences=True, activation='relu', input_shape=(n, 1)),
31
+ Dropout(0.4),
32
+ LSTM(64, return_sequences=True, activation='relu'),
33
+ Dropout(0.3),
34
+ LSTM(32, activation='relu'),
35
+ Dropout(0.2),
36
+ Dense(1, activation='sigmoid')
37
+ ])
38
+
39
+ model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])
40
+ model.fit(x, y, epochs=10, batch_size=64)
41
+
42
+
43
+ url = f'https://api.twelvedata.com/time_series?symbol=BTC/USD&start_date=2021-11-20&end_date=2021-11-24&interval=5min&order=asc&apikey={key}'
44
+ test = pd.DataFrame(requests.get(url).json()['values'])
45
+
46
+ actual = pd.to_numeric(test['close']).values.reshape(-1, 1)
47
+ test_scaled = scaler.transform(actual)
48
+
49
+
50
+ x_test = np.array([
51
+ test_scaled[i-n:i, 0]
52
+ for i in range(n, len(test_scaled))
53
+ ]).reshape(-1, n, 1)
54
+
55
+
56
+ pred = scaler.inverse_transform(model.predict(x_test))
57
+
58
+
59
+ plt.figure(figsize=(12, 6))
60
+ plt.plot(actual[n:], label='Actual Bitcoin Prices', color='green')
61
+ plt.plot(pred, label='Predicted Prices', color='red')
62
+ plt.title('Bitcoin Price Prediction')
63
+ plt.xlabel('Time Interval')
64
+ plt.ylabel('Price')
65
+ plt.legend()
66
+ plt.show()
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: bcp6
3
+ Version: 0.1
@@ -0,0 +1,10 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ bcp6/__init__.py
6
+ bcp6/data.txt
7
+ bcp6.egg-info/PKG-INFO
8
+ bcp6.egg-info/SOURCES.txt
9
+ bcp6.egg-info/dependency_links.txt
10
+ bcp6.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ bcp6
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
bcp6-0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
bcp6-0.1/setup.py ADDED
@@ -0,0 +1,9 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="bcp6",
5
+ version="0.1",
6
+ packages=find_packages(),
7
+ include_package_data=True,
8
+ package_data={"bcp6": ["data.txt"]},
9
+ )