cryptobin 1.0.1__tar.gz → 1.0.2__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.
- {cryptobin-1.0.1 → cryptobin-1.0.2}/PKG-INFO +2 -1
- {cryptobin-1.0.1 → cryptobin-1.0.2}/setup.cfg +2 -1
- cryptobin-1.0.2/src/cryptobin/__init__.py +3 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin/core.py +15 -1
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin.egg-info/PKG-INFO +2 -1
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin.egg-info/requires.txt +1 -0
- cryptobin-1.0.1/src/cryptobin/__init__.py +0 -3
- {cryptobin-1.0.1 → cryptobin-1.0.2}/LICENSE +0 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/README.md +0 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/pyproject.toml +0 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin.egg-info/SOURCES.txt +0 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin.egg-info/dependency_links.txt +0 -0
- {cryptobin-1.0.1 → cryptobin-1.0.2}/src/cryptobin.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cryptobin
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Binance Crypto Comparison Lib
|
|
5
5
|
Home-page: https://github.com/asinerum/cryptobin
|
|
6
6
|
Author: Asinerum Conlang Project
|
|
@@ -12,6 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.7
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pillow>=12.3.0
|
|
15
16
|
Requires-Dist: matplotlib>=3.10.7
|
|
16
17
|
Requires-Dist: python-binance>=1.0.36
|
|
17
18
|
Requires-Dist: python-dotenv>=1.2.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = cryptobin
|
|
3
|
-
version = 1.0.
|
|
3
|
+
version = 1.0.2
|
|
4
4
|
author = Asinerum Conlang Project
|
|
5
5
|
author_email = asinerum.com@gmail.com
|
|
6
6
|
description = Binance Crypto Comparison Lib
|
|
@@ -19,6 +19,7 @@ package_dir =
|
|
|
19
19
|
packages = find:
|
|
20
20
|
python_requires = >=3.7
|
|
21
21
|
install_requires =
|
|
22
|
+
pillow >= 12.3.0
|
|
22
23
|
matplotlib >= 3.10.7
|
|
23
24
|
python-binance >= 1.0.36
|
|
24
25
|
python-dotenv >= 1.2.1
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import io
|
|
3
|
+
import tempfile
|
|
3
4
|
import uvicorn ## for <uvia>
|
|
4
5
|
import matplotlib.pyplot as plt
|
|
5
6
|
import base64
|
|
7
|
+
|
|
6
8
|
from datetime import date, datetime
|
|
7
9
|
from dotenv import load_dotenv
|
|
8
10
|
from binance.client import Client
|
|
11
|
+
|
|
9
12
|
from starlette.applications import Starlette
|
|
10
13
|
from starlette.responses import HTMLResponse
|
|
11
14
|
from starlette.routing import Route
|
|
@@ -76,19 +79,30 @@ def binance_get_klines(symbol: str, start: date, end: date, client: Client, inte
|
|
|
76
79
|
|
|
77
80
|
def html_metrics_plot(label: str, metrics: list, plot_func, response_func=HTMLResponse):
|
|
78
81
|
charts_html = ''
|
|
82
|
+
plot_files = []
|
|
79
83
|
for metric in metrics:
|
|
80
84
|
plt.figure(figsize=(8,5))
|
|
81
85
|
plot_func(metric)
|
|
82
86
|
plt.title(f'{metric} {label}'.title())
|
|
83
87
|
plt.legend()
|
|
84
88
|
plt.tight_layout()
|
|
89
|
+
if not response_func:
|
|
90
|
+
plot_file = plotter_save_temp(plt.savefig)
|
|
91
|
+
plot_files.append(plot_file)
|
|
92
|
+
plt.close()
|
|
93
|
+
continue
|
|
85
94
|
buf = io.BytesIO()
|
|
86
95
|
plt.savefig(buf, format='png')
|
|
87
96
|
buf.seek(0)
|
|
88
97
|
img_b64 = base64.b64encode(buf.read()).decode('utf-8')
|
|
89
98
|
charts_html += f'''<h3>{metric.capitalize()}</h3><img src="data:image/png;base64,{img_b64}"><br>'''
|
|
90
99
|
plt.close()
|
|
91
|
-
return response_func(f'<html><body>{charts_html}</body></html>')
|
|
100
|
+
return response_func(f'<html><body>{charts_html}</body></html>') if response_func else plot_files
|
|
101
|
+
|
|
102
|
+
def plotter_save_temp(savefig_instance) -> str:
|
|
103
|
+
tmp_file = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
|
|
104
|
+
savefig_instance(tmp_file.name, format="png")
|
|
105
|
+
return tmp_file.name
|
|
92
106
|
|
|
93
107
|
def form_page():
|
|
94
108
|
return f'''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cryptobin
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Binance Crypto Comparison Lib
|
|
5
5
|
Home-page: https://github.com/asinerum/cryptobin
|
|
6
6
|
Author: Asinerum Conlang Project
|
|
@@ -12,6 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.7
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pillow>=12.3.0
|
|
15
16
|
Requires-Dist: matplotlib>=3.10.7
|
|
16
17
|
Requires-Dist: python-binance>=1.0.36
|
|
17
18
|
Requires-Dist: python-dotenv>=1.2.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|