lonestar108 commited on
Commit
9daec70
Β·
verified Β·
1 Parent(s): 2545806

a futures/crypto trading interface with a main tradingview chart with indicators, right hand sidebar with trading contols, a tabset underthe chart - cryptowat.ch vibes

Browse files
Files changed (6) hide show
  1. README.md +7 -4
  2. components/footer.js +64 -0
  3. components/navbar.js +92 -0
  4. index.html +226 -19
  5. script.js +44 -0
  6. style.css +49 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Cryptotrader Pro
3
- emoji: πŸ‘€
4
- colorFrom: yellow
5
  colorTo: yellow
 
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: CryptoTrader Pro πŸš€πŸ“Š
3
+ colorFrom: red
 
4
  colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background: #1e293b;
8
+ color: #94a3b8;
9
+ padding: 1.5rem;
10
+ text-align: center;
11
+ font-size: 0.875rem;
12
+ border-top: 1px solid #334155;
13
+ margin-top: auto;
14
+ }
15
+ .footer-links {
16
+ display: flex;
17
+ justify-content: center;
18
+ gap: 1.5rem;
19
+ margin-bottom: 1rem;
20
+ flex-wrap: wrap;
21
+ }
22
+ .footer-links a {
23
+ color: #94a3b8;
24
+ text-decoration: none;
25
+ transition: color 0.2s;
26
+ }
27
+ .footer-links a:hover {
28
+ color: white;
29
+ }
30
+ .social-links {
31
+ display: flex;
32
+ justify-content: center;
33
+ gap: 1rem;
34
+ margin-top: 1rem;
35
+ }
36
+ .social-links a {
37
+ color: #94a3b8;
38
+ transition: color 0.2s;
39
+ }
40
+ .social-links a:hover {
41
+ color: white;
42
+ }
43
+ </style>
44
+ <footer>
45
+ <div class="footer-links">
46
+ <a href="#">Terms</a>
47
+ <a href="#">Privacy</a>
48
+ <a href="#">API</a>
49
+ <a href="#">Status</a>
50
+ <a href="#">Contact</a>
51
+ <a href="#">Help</a>
52
+ </div>
53
+ <div>Β© 2023 CryptoTrader Pro. All rights reserved.</div>
54
+ <div class="social-links">
55
+ <a href="#"><i data-feather="twitter"></i></a>
56
+ <a href="#"><i data-feather="discord"></i></a>
57
+ <a href="#"><i data-feather="github"></i></a>
58
+ <a href="#"><i data-feather="linkedin"></i></a>
59
+ </div>
60
+ </footer>
61
+ `;
62
+ }
63
+ }
64
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background: #1e293b;
8
+ padding: 1rem 2rem;
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ border-bottom: 1px solid #334155;
13
+ }
14
+ .logo {
15
+ color: white;
16
+ font-weight: bold;
17
+ font-size: 1.25rem;
18
+ display: flex;
19
+ align-items: center;
20
+ gap: 0.5rem;
21
+ }
22
+ .logo-icon {
23
+ color: #3b82f6;
24
+ }
25
+ ul {
26
+ display: flex;
27
+ gap: 1.5rem;
28
+ list-style: none;
29
+ margin: 0;
30
+ padding: 0;
31
+ }
32
+ a {
33
+ color: #94a3b8;
34
+ text-decoration: none;
35
+ transition: color 0.2s;
36
+ font-weight: 500;
37
+ display: flex;
38
+ align-items: center;
39
+ gap: 0.25rem;
40
+ font-size: 0.9375rem;
41
+ }
42
+ a:hover {
43
+ color: white;
44
+ }
45
+ a.active {
46
+ color: white;
47
+ }
48
+ .user-menu {
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 1rem;
52
+ }
53
+ .balance {
54
+ background: #334155;
55
+ padding: 0.375rem 0.75rem;
56
+ border-radius: 9999px;
57
+ font-size: 0.875rem;
58
+ font-weight: 500;
59
+ }
60
+ .avatar {
61
+ width: 32px;
62
+ height: 32px;
63
+ border-radius: 9999px;
64
+ background: #475569;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ color: white;
69
+ font-weight: bold;
70
+ cursor: pointer;
71
+ }
72
+ </style>
73
+ <nav>
74
+ <div class="logo">
75
+ <i data-feather="activity" class="logo-icon"></i>
76
+ <span>CryptoTrader Pro</span>
77
+ </div>
78
+ <ul>
79
+ <li><a href="/" class="active"><i data-feather="home"></i> Dashboard</a></li>
80
+ <li><a href="#"><i data-feather="dollar-sign"></i> Markets</a></li>
81
+ <li><a href="#"><i data-feather="briefcase"></i> Portfolio</a></li>
82
+ <li><a href="#"><i data-feather="file-text"></i> Reports</a></li>
83
+ </ul>
84
+ <div class="user-menu">
85
+ <div class="balance">$12,345.67</div>
86
+ <div class="avatar">JD</div>
87
+ </div>
88
+ </nav>
89
+ `;
90
+ }
91
+ }
92
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,226 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>CryptoTrader Pro πŸš€πŸ“Š</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://s3.tradingview.com/tv.js"></script>
12
+ </head>
13
+ <body class="bg-gray-900 text-gray-100">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <div class="container mx-auto px-4 py-6 flex flex-col lg:flex-row gap-6">
17
+ <!-- Main Chart Area -->
18
+ <div class="flex-1">
19
+ <div class="bg-gray-800 rounded-lg shadow-xl overflow-hidden">
20
+ <!-- Chart Tabs -->
21
+ <div class="flex border-b border-gray-700">
22
+ <button class="px-4 py-2 font-medium text-blue-400 border-b-2 border-blue-400">BTC/USDT</button>
23
+ <button class="px-4 py-2 font-medium text-gray-400 hover:text-gray-200">ETH/USDT</button>
24
+ <button class="px-4 py-2 font-medium text-gray-400 hover:text-gray-200">SOL/USDT</button>
25
+ <div class="flex-1"></div>
26
+ <button class="px-4 py-2 text-gray-400 hover:text-gray-200">
27
+ <i data-feather="plus"></i>
28
+ </button>
29
+ </div>
30
+
31
+ <!-- TradingView Widget -->
32
+ <div id="tradingview-chart" class="w-full h-[500px]"></div>
33
+
34
+ <!-- Chart Controls -->
35
+ <div class="p-4 bg-gray-800 border-t border-gray-700 flex items-center justify-between">
36
+ <div class="flex gap-2">
37
+ <button class="px-3 py-1 bg-gray-700 rounded-md hover:bg-gray-600">
38
+ <i data-feather="settings"></i>
39
+ </button>
40
+ <button class="px-3 py-1 bg-gray-700 rounded-md hover:bg-gray-600">
41
+ <i data-feather="bar-chart-2"></i>
42
+ </button>
43
+ <button class="px-3 py-1 bg-gray-700 rounded-md hover:bg-gray-600">
44
+ <i data-feather="trending-up"></i>
45
+ </button>
46
+ </div>
47
+ <div class="flex gap-2">
48
+ <button class="px-3 py-1 bg-gray-700 rounded-md hover:bg-gray-600">
49
+ <i data-feather="clock"></i>
50
+ </button>
51
+ <button class="px-3 py-1 bg-gray-700 rounded-md hover:bg-gray-600">
52
+ <i data-feather="maximize"></i>
53
+ </button>
54
+ </div>
55
+ </div>
56
+ </div>
57
+
58
+ <!-- Bottom Tabs -->
59
+ <div class="mt-4 bg-gray-800 rounded-lg shadow-xl overflow-hidden">
60
+ <div class="flex border-b border-gray-700">
61
+ <button class="px-4 py-2 font-medium text-blue-400 border-b-2 border-blue-400">Orders</button>
62
+ <button class="px-4 py-2 font-medium text-gray-400 hover:text-gray-200">Positions</button>
63
+ <button class="px-4 py-2 font-medium text-gray-400 hover:text-gray-200">History</button>
64
+ </div>
65
+
66
+ <div class="p-4">
67
+ <div class="overflow-x-auto">
68
+ <table class="w-full">
69
+ <thead>
70
+ <tr class="text-gray-400 text-left border-b border-gray-700">
71
+ <th class="pb-2">Date</th>
72
+ <th class="pb-2">Pair</th>
73
+ <th class="pb-2">Type</th>
74
+ <th class="pb-2">Side</th>
75
+ <th class="pb-2">Price</th>
76
+ <th class="pb-2">Amount</th>
77
+ <th class="pb-2">Status</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr class="border-b border-gray-700 hover:bg-gray-700">
82
+ <td class="py-3">2023-06-15 14:32</td>
83
+ <td>BTC/USDT</td>
84
+ <td>Limit</td>
85
+ <td class="text-green-400">Buy</td>
86
+ <td>25,432.12</td>
87
+ <td>0.05</td>
88
+ <td class="text-blue-400">Filled</td>
89
+ </tr>
90
+ <tr class="border-b border-gray-700 hover:bg-gray-700">
91
+ <td class="py-3">2023-06-15 09:47</td>
92
+ <td>ETH/USDT</td>
93
+ <td>Market</td>
94
+ <td class="text-red-400">Sell</td>
95
+ <td>1,832.45</td>
96
+ <td>1.2</td>
97
+ <td class="text-blue-400">Filled</td>
98
+ </tr>
99
+ </tbody>
100
+ </table>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ </div>
105
+
106
+ <!-- Right Sidebar -->
107
+ <div class="w-full lg:w-80 flex-shrink-0">
108
+ <div class="bg-gray-800 rounded-lg shadow-xl overflow-hidden">
109
+ <!-- Order Form -->
110
+ <div class="p-4 border-b border-gray-700">
111
+ <div class="flex justify-between items-center mb-4">
112
+ <h3 class="font-bold text-lg">New Order</h3>
113
+ <div class="flex gap-1">
114
+ <button class="px-2 py-1 bg-blue-600 rounded-md text-xs font-medium">Limit</button>
115
+ <button class="px-2 py-1 bg-gray-700 rounded-md text-xs font-medium hover:bg-gray-600">Market</button>
116
+ <button class="px-2 py-1 bg-gray-700 rounded-md text-xs font-medium hover:bg-gray-600">Stop</button>
117
+ </div>
118
+ </div>
119
+
120
+ <div class="space-y-4">
121
+ <div>
122
+ <label class="block text-sm text-gray-400 mb-1">Amount</label>
123
+ <div class="relative">
124
+ <input type="number" class="w-full bg-gray-700 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="0.00">
125
+ <div class="absolute right-3 top-2 text-xs text-gray-400">BTC</div>
126
+ </div>
127
+ </div>
128
+
129
+ <div>
130
+ <label class="block text-sm text-gray-400 mb-1">Price</label>
131
+ <input type="number" class="w-full bg-gray-700 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="0.00">
132
+ </div>
133
+
134
+ <div class="grid grid-cols-2 gap-2">
135
+ <button class="py-2 bg-green-600 rounded-md font-medium hover:bg-green-700">Buy</button>
136
+ <button class="py-2 bg-red-600 rounded-md font-medium hover:bg-red-700">Sell</button>
137
+ </div>
138
+
139
+ <div class="pt-2 border-t border-gray-700">
140
+ <div class="flex justify-between text-sm text-gray-400">
141
+ <span>Available:</span>
142
+ <span>5,432.12 USDT</span>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+
148
+ <!-- Market Data -->
149
+ <div class="p-4">
150
+ <h3 class="font-bold text-lg mb-3">Market Data</h3>
151
+ <div class="space-y-3">
152
+ <div class="flex justify-between">
153
+ <span class="text-gray-400">Price</span>
154
+ <span class="font-medium">25,432.12</span>
155
+ </div>
156
+ <div class="flex justify-between">
157
+ <span class="text-gray-400">24h Change</span>
158
+ <span class="text-green-400">+2.34%</span>
159
+ </div>
160
+ <div class="flex justify-between">
161
+ <span class="text-gray-400">24h High</span>
162
+ <span>25,678.90</span>
163
+ </div>
164
+ <div class="flex justify-between">
165
+ <span class="text-gray-400">24h Low</span>
166
+ <span>24,543.21</span>
167
+ </div>
168
+ <div class="flex justify-between">
169
+ <span class="text-gray-400">24h Volume</span>
170
+ <span>1,234.56 BTC</span>
171
+ </div>
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- Open Positions -->
177
+ <div class="mt-4 bg-gray-800 rounded-lg shadow-xl overflow-hidden">
178
+ <div class="p-4 border-b border-gray-700">
179
+ <h3 class="font-bold text-lg">Open Positions</h3>
180
+ </div>
181
+ <div class="p-4">
182
+ <div class="space-y-4">
183
+ <div class="flex justify-between items-center">
184
+ <div>
185
+ <div class="font-medium">BTC/USDT</div>
186
+ <div class="text-sm text-gray-400">Long 0.05 BTC</div>
187
+ </div>
188
+ <div class="text-right">
189
+ <div class="text-green-400 font-medium">+$124.32 (+2.1%)</div>
190
+ <div class="text-sm text-gray-400">25,432.12</div>
191
+ </div>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+
199
+ <custom-footer></custom-footer>
200
+
201
+ <script src="components/navbar.js"></script>
202
+ <script src="components/footer.js"></script>
203
+ <script src="script.js"></script>
204
+ <script>
205
+ feather.replace();
206
+
207
+ // Initialize TradingView widget
208
+ new TradingView.widget({
209
+ "autosize": true,
210
+ "symbol": "BINANCE:BTCUSDT",
211
+ "interval": "15",
212
+ "timezone": "Etc/UTC",
213
+ "theme": "dark",
214
+ "style": "1",
215
+ "locale": "en",
216
+ "toolbar_bg": "#1e293b",
217
+ "enable_publishing": false,
218
+ "hide_top_toolbar": false,
219
+ "hide_side_toolbar": false,
220
+ "allow_symbol_change": true,
221
+ "container_id": "tradingview-chart"
222
+ });
223
+ </script>
224
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
225
+ </body>
226
+ </html>
script.js ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Trading interface functionality
2
+ document.addEventListener('DOMContentLoaded', () => {
3
+ // Initialize tooltips
4
+ const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
5
+ tooltipTriggerList.forEach(tooltipTriggerEl => {
6
+ new bootstrap.Tooltip(tooltipTriggerEl);
7
+ });
8
+
9
+ // Tab functionality
10
+ const tabs = document.querySelectorAll('[data-tab-target]');
11
+ tabs.forEach(tab => {
12
+ tab.addEventListener('click', () => {
13
+ const target = document.querySelector(tab.dataset.tabTarget);
14
+ document.querySelectorAll('[data-tab-content]').forEach(tabContent => {
15
+ tabContent.classList.add('hidden');
16
+ });
17
+ target.classList.remove('hidden');
18
+ });
19
+ });
20
+
21
+ // Order form validation
22
+ const orderForm = document.querySelector('#order-form');
23
+ if (orderForm) {
24
+ orderForm.addEventListener('submit', (e) => {
25
+ e.preventDefault();
26
+ // Validate and submit order
27
+ });
28
+ }
29
+ });
30
+
31
+ // Utility functions
32
+ function formatPrice(price) {
33
+ return parseFloat(price).toLocaleString('en-US', {
34
+ minimumFractionDigits: 2,
35
+ maximumFractionDigits: 2
36
+ });
37
+ }
38
+
39
+ function formatAmount(amount) {
40
+ return parseFloat(amount).toLocaleString('en-US', {
41
+ minimumFractionDigits: 4,
42
+ maximumFractionDigits: 4
43
+ });
44
+ }
style.css CHANGED
@@ -1,28 +1,59 @@
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Custom styles for trading interface */
2
  body {
3
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
4
+ min-height: 100vh;
5
+ display: flex;
6
+ flex-direction: column;
7
  }
8
 
9
+ /* Scrollbar styling */
10
+ ::-webkit-scrollbar {
11
+ width: 8px;
12
+ height: 8px;
13
  }
14
 
15
+ ::-webkit-scrollbar-track {
16
+ background: #1e293b;
 
 
 
17
  }
18
 
19
+ ::-webkit-scrollbar-thumb {
20
+ background: #334155;
21
+ border-radius: 4px;
 
 
 
22
  }
23
 
24
+ ::-webkit-scrollbar-thumb:hover {
25
+ background: #475569;
26
  }
27
+
28
+ /* TradingView chart container */
29
+ #tradingview-chart {
30
+ min-height: 500px;
31
+ }
32
+
33
+ /* Custom table styling */
34
+ table {
35
+ border-collapse: separate;
36
+ border-spacing: 0;
37
+ }
38
+
39
+ th {
40
+ font-weight: 500;
41
+ font-size: 0.875rem;
42
+ }
43
+
44
+ td {
45
+ font-size: 0.875rem;
46
+ padding-top: 0.75rem;
47
+ padding-bottom: 0.75rem;
48
+ }
49
+
50
+ /* Input number arrows */
51
+ input[type="number"]::-webkit-outer-spin-button,
52
+ input[type="number"]::-webkit-inner-spin-button {
53
+ -webkit-appearance: none;
54
+ margin: 0;
55
+ }
56
+
57
+ input[type="number"] {
58
+ -moz-appearance: textfield;
59
+ }