cryptobin 1.0.3__tar.gz → 1.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cryptobin
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Binance Crypto Comparison Lib
5
5
  Home-page: https://github.com/asinerum/cryptobin
6
6
  Author: Asinerum Conlang Project
@@ -24,6 +24,17 @@ Dynamic: license-file
24
24
 
25
25
  # Binance Crypto Comparison Lib
26
26
 
27
+ ## Installation
28
+ ```bash
29
+ pip install uvia vapp cryptobin
30
+ ```
31
+
32
+ ## Sample Usage (CLI Web Daemon)
33
+ ```bash
34
+ export SYMBOLS_LIST="btc,eth,bnb,sol"
35
+ uvia -a vapp -m cryptobin [-H <host>] [-p <port>]
36
+ ```
37
+
27
38
  Detailed tips, tricks, and examples, can be found at project's repository
28
39
  https://github.com/asinerum/cryptobin
29
40
 
@@ -0,0 +1,17 @@
1
+ # Binance Crypto Comparison Lib
2
+
3
+ ## Installation
4
+ ```bash
5
+ pip install uvia vapp cryptobin
6
+ ```
7
+
8
+ ## Sample Usage (CLI Web Daemon)
9
+ ```bash
10
+ export SYMBOLS_LIST="btc,eth,bnb,sol"
11
+ uvia -a vapp -m cryptobin [-H <host>] [-p <port>]
12
+ ```
13
+
14
+ Detailed tips, tricks, and examples, can be found at project's repository
15
+ https://github.com/asinerum/cryptobin
16
+
17
+ (C) 2026 Asinerum Conlang Project
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = cryptobin
3
- version = 1.0.3
3
+ version = 1.0.4
4
4
  author = Asinerum Conlang Project
5
5
  author_email = asinerum.com@gmail.com
6
6
  description = Binance Crypto Comparison Lib
@@ -0,0 +1,3 @@
1
+ from .core import *
2
+
3
+ __version__ = "1.0.4"
@@ -1,3 +1,10 @@
1
+ """
2
+ Sample Usage:
3
+ - CLI web daemon:
4
+ export SYMBOLS_LIST="btc,eth,bnb,sol"
5
+ uvia -a vapp -m cryptobin [-H <host>] [-p <port>]
6
+ """
7
+
1
8
  import os
2
9
  import io
3
10
  import tempfile
@@ -5,7 +12,7 @@ import uvicorn ## for <uvia>
5
12
  import matplotlib.pyplot as plt
6
13
  import base64
7
14
 
8
- from datetime import date, datetime
15
+ from datetime import date, datetime, timedelta
9
16
  from dotenv import load_dotenv
10
17
  from binance.client import Client
11
18
 
@@ -54,6 +61,13 @@ KLINE_VOLUME_INDEX = 7
54
61
 
55
62
  client = Client(BINANCE_API_KEY, BINANCE_API_SECRET)
56
63
 
64
+ def plotter_output_html(savefig_instance, caption: str, format: str='png') -> str:
65
+ buf = io.BytesIO()
66
+ savefig_instance(buf, format=format)
67
+ buf.seek(0)
68
+ img_b64 = base64.b64encode(buf.read()).decode('utf-8')
69
+ return f'''<h3>{caption.capitalize()}</h3><img src="data:image/png;base64,{img_b64}"><br>'''
70
+
57
71
  def binance_core_data(symbols: list, start: date, end: date, client: Client, proportions: list=[]):
58
72
  if not proportions: proportions = [1 for _ in symbols]
59
73
  data = {}
@@ -93,16 +107,10 @@ def html_metrics_plot(label: str, metrics: list, plot_func, response_func=HTMLRe
93
107
  plt.title(f'{metric} {label}'.title())
94
108
  plt.legend()
95
109
  plt.tight_layout()
96
- if not response_func:
97
- plot_file = plotter_save_temp(plt.savefig)
98
- plot_files.append(plot_file)
99
- plt.close()
100
- continue
101
- buf = io.BytesIO()
102
- plt.savefig(buf, format='png')
103
- buf.seek(0)
104
- img_b64 = base64.b64encode(buf.read()).decode('utf-8')
105
- charts_html += f'''<h3>{metric.capitalize()}</h3><img src="data:image/png;base64,{img_b64}"><br>'''
110
+ if response_func:
111
+ charts_html += plotter_output_html(plt.savefig, caption=metric)
112
+ else:
113
+ plot_files += [plotter_save_temp(plt.savefig)]
106
114
  plt.close()
107
115
  return response_func(f'<html><body>{charts_html}</body></html>') if response_func else plot_files
108
116
 
@@ -149,8 +157,8 @@ def homepage(formpage=form_page):
149
157
  form = await request.form()
150
158
  symbols = form.getlist('symbols')
151
159
  proportions = form.getlist('proportions')
152
- start = date.fromisoformat(form['start'])
153
- end = date.fromisoformat(form['end'])
160
+ start = date.fromisoformat(form.get('start') or (date.today() - timedelta(days=30)).isoformat())
161
+ end = date.fromisoformat(form.get('end') or date.today().isoformat())
154
162
  metrics = [METRIC_RATE, METRIC_VOL, METRIC_CAP]
155
163
  return html_metrics_plot(label=LABEL_COMPARISON, metrics=metrics, plot_func=binance_klines_plot(symbols, proportions, start=start, end=end, client=client))
156
164
  return submit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cryptobin
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Binance Crypto Comparison Lib
5
5
  Home-page: https://github.com/asinerum/cryptobin
6
6
  Author: Asinerum Conlang Project
@@ -24,6 +24,17 @@ Dynamic: license-file
24
24
 
25
25
  # Binance Crypto Comparison Lib
26
26
 
27
+ ## Installation
28
+ ```bash
29
+ pip install uvia vapp cryptobin
30
+ ```
31
+
32
+ ## Sample Usage (CLI Web Daemon)
33
+ ```bash
34
+ export SYMBOLS_LIST="btc,eth,bnb,sol"
35
+ uvia -a vapp -m cryptobin [-H <host>] [-p <port>]
36
+ ```
37
+
27
38
  Detailed tips, tricks, and examples, can be found at project's repository
28
39
  https://github.com/asinerum/cryptobin
29
40
 
cryptobin-1.0.3/README.md DELETED
@@ -1,6 +0,0 @@
1
- # Binance Crypto Comparison Lib
2
-
3
- Detailed tips, tricks, and examples, can be found at project's repository
4
- https://github.com/asinerum/cryptobin
5
-
6
- (C) 2026 Asinerum Conlang Project
@@ -1,3 +0,0 @@
1
- from .core import *
2
-
3
- __version__ = "1.0.3"
File without changes
File without changes