arcadedb 0.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/Gemfile.lock +2 -36
- data/README.md +105 -30
- data/arcade.yml +4 -4
- data/bin/console +16 -16
- data/iruby/.ipynb_checkpoints/01-start-and-end-of-datarows-checkpoint.ipynb +258 -0
- data/iruby/01-start-and-end-of-datarows.ipynb +203 -0
- data/iruby/db-console.rb +73 -0
- data/lib/arcade/api/operations.rb +26 -65
- data/lib/arcade/api/primitives.rb +57 -29
- data/lib/arcade/base.rb +72 -39
- data/lib/{config.rb → arcade/config.rb} +5 -6
- data/lib/arcade/database.rb +104 -154
- data/lib/arcade/errors.rb +8 -0
- data/lib/arcade/match.rb +162 -0
- data/lib/{query.rb → arcade/query.rb} +34 -18
- data/lib/{support → arcade/support}/conversions.rb +1 -0
- data/lib/{support → arcade/support}/model.rb +20 -15
- data/lib/arcade/version.rb +1 -1
- data/lib/arcade.rb +11 -11
- data/lib/model/document.rb +22 -0
- data/lib/model/edge.rb +12 -0
- data/lib/model/vertex.rb +67 -48
- metadata +15 -12
- data/lib/match.rb +0 -216
- /data/lib/{init.rb → arcade/init.rb} +0 -0
- /data/lib/{support → arcade/support}/class.rb +0 -0
- /data/lib/{support → arcade/support}/object.rb +0 -0
- /data/lib/{support → arcade/support}/sql.rb +0 -0
- /data/lib/{support → arcade/support}/string.rb +0 -0
@@ -0,0 +1,258 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": 1,
|
6
|
+
"id": "24212c68",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [
|
9
|
+
{
|
10
|
+
"name": "stdout",
|
11
|
+
"output_type": "stream",
|
12
|
+
"text": [
|
13
|
+
"DB = Arcade::Database-instance\n"
|
14
|
+
]
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"data": {
|
18
|
+
"text/plain": [
|
19
|
+
"true"
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"execution_count": 1,
|
23
|
+
"metadata": {},
|
24
|
+
"output_type": "execute_result"
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"source": [
|
28
|
+
"require_relative 'db-console'\n"
|
29
|
+
]
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"cell_type": "code",
|
33
|
+
"execution_count": 8,
|
34
|
+
"id": "a91a107d",
|
35
|
+
"metadata": {},
|
36
|
+
"outputs": [
|
37
|
+
{
|
38
|
+
"data": {
|
39
|
+
"text/html": [
|
40
|
+
"<b style=\"color: \">Index</b>[#313:0]:{0->}{->0}, SPX USD () "
|
41
|
+
],
|
42
|
+
"text/plain": [
|
43
|
+
"\"<b style=\\\"color: \\\">Index</b>[#313:0]:{0->}{->0}, SPX USD () \""
|
44
|
+
]
|
45
|
+
},
|
46
|
+
"metadata": {},
|
47
|
+
"output_type": "display_data"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"data": {},
|
51
|
+
"execution_count": 8,
|
52
|
+
"metadata": {},
|
53
|
+
"output_type": "execute_result"
|
54
|
+
}
|
55
|
+
],
|
56
|
+
"source": [
|
57
|
+
"spx = Contract.first\n"
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"cell_type": "markdown",
|
62
|
+
"id": "49d2051c",
|
63
|
+
"metadata": {},
|
64
|
+
"source": [
|
65
|
+
"Die Standard-IRuby Ausgabe für ein OHLC-Record"
|
66
|
+
]
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"cell_type": "code",
|
70
|
+
"execution_count": 14,
|
71
|
+
"id": "49f480d2",
|
72
|
+
"metadata": {},
|
73
|
+
"outputs": [
|
74
|
+
{
|
75
|
+
"data": {
|
76
|
+
"text/html": [
|
77
|
+
"<span style=\"color: #50953DFF\"><b>Trades</b>[#386:2057] : {1->}{->1}</span><br/> "
|
78
|
+
],
|
79
|
+
"text/plain": [
|
80
|
+
"\"<span style=\\\"color: #50953DFF\\\"><b>Trades</b>[#386:2057] : {1->}{->1}</span><br/> \""
|
81
|
+
]
|
82
|
+
},
|
83
|
+
"metadata": {},
|
84
|
+
"output_type": "display_data"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"data": {
|
88
|
+
"text/html": [
|
89
|
+
"<table><tr><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr></table>"
|
90
|
+
],
|
91
|
+
"text/plain": [
|
92
|
+
"\"<table><tr><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr></table>\""
|
93
|
+
]
|
94
|
+
},
|
95
|
+
"metadata": {},
|
96
|
+
"output_type": "display_data"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"data": {},
|
100
|
+
"metadata": {},
|
101
|
+
"output_type": "display_data"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"data": {},
|
105
|
+
"execution_count": 14,
|
106
|
+
"metadata": {},
|
107
|
+
"output_type": "execute_result"
|
108
|
+
}
|
109
|
+
],
|
110
|
+
"source": [
|
111
|
+
"Ohlc.start_entry( spx ).first"
|
112
|
+
]
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"cell_type": "markdown",
|
116
|
+
"id": "d1c21ee6",
|
117
|
+
"metadata": {},
|
118
|
+
"source": [
|
119
|
+
"Die Anfangsdaten der Datenreihen Trades und Vola für den SPX in Tabellenform"
|
120
|
+
]
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"cell_type": "code",
|
124
|
+
"execution_count": 13,
|
125
|
+
"id": "5b6d1950",
|
126
|
+
"metadata": {},
|
127
|
+
"outputs": [
|
128
|
+
{
|
129
|
+
"data": {
|
130
|
+
"text/html": [
|
131
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>1</td><td>1</td><td>#386:2057</td><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:2058</td><td>2004-03-05</td><td>1151.0</td><td>1163.23</td><td>1148.75</td><td>1157.34</td><td>1806</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:2058</td><td>2004-03-08</td><td>1157.75</td><td>1160.12</td><td>1147.02</td><td>1147.02</td><td>1133</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:2058</td><td>2004-03-09</td><td>1146.59</td><td>1146.81</td><td>1136.86</td><td>1140.67</td><td>1439</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#398:2058</td><td>2004-03-10</td><td>1141.61</td><td>1142.05</td><td>1122.5</td><td>1124.1</td><td>1413</td></tr></table>"
|
132
|
+
],
|
133
|
+
"text/plain": [
|
134
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>1</td><td>1</td><td>#386:2057</td><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:2058</td><td>2004-03-05</td><td>1151.0</td><td>1163.23</td><td>1148.75</td><td>1157.34</td><td>1806</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:2058</td><td>2004-03-08</td><td>1157.75</td><td>1160.12</td><td>1147.02</td><td>1147.02</td><td>1133</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:2058</td><td>2004-03-09</td><td>1146.59</td><td>1146.81</td><td>1136.86</td><td>1140.67</td><td>1439</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#398:2058</td><td>2004-03-10</td><td>1141.61</td><td>1142.05</td><td>1122.5</td><td>1124.1</td><td>1413</td></tr></table>\""
|
135
|
+
]
|
136
|
+
},
|
137
|
+
"metadata": {},
|
138
|
+
"output_type": "display_data"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"data": {
|
142
|
+
"text/html": [
|
143
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>1</td><td>1</td><td>#404:549</td><td>2006-01-06</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>1</td><td>0.15874508</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#407:549</td><td>2006-01-09</td><td>0.10477175</td><td>0.1063592</td><td>0.10159685</td><td>0.1031843</td><td>1</td><td>0.10620046</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:549</td><td>2006-01-10</td><td>0.1031843</td><td>0.1063592</td><td>0.1000094</td><td>0.10159685</td><td>1</td><td>0.10569247</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:549</td><td>2006-01-11</td><td>0.10477175</td><td>0.10477175</td><td>0.09842195</td><td>0.10159685</td><td>1</td><td>0.10516861</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:549</td><td>2006-01-12</td><td>0.1000094</td><td>0.1031843</td><td>0.0968345</td><td>0.10159685</td><td>1</td><td>0.10380341</td></tr></table>"
|
144
|
+
],
|
145
|
+
"text/plain": [
|
146
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>1</td><td>1</td><td>#404:549</td><td>2006-01-06</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>1</td><td>0.15874508</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#407:549</td><td>2006-01-09</td><td>0.10477175</td><td>0.1063592</td><td>0.10159685</td><td>0.1031843</td><td>1</td><td>0.10620046</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:549</td><td>2006-01-10</td><td>0.1031843</td><td>0.1063592</td><td>0.1000094</td><td>0.10159685</td><td>1</td><td>0.10569247</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:549</td><td>2006-01-11</td><td>0.10477175</td><td>0.10477175</td><td>0.09842195</td><td>0.10159685</td><td>1</td><td>0.10516861</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:549</td><td>2006-01-12</td><td>0.1000094</td><td>0.1031843</td><td>0.0968345</td><td>0.10159685</td><td>1</td><td>0.10380341</td></tr></table>\""
|
147
|
+
]
|
148
|
+
},
|
149
|
+
"metadata": {},
|
150
|
+
"output_type": "display_data"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"data": {},
|
154
|
+
"metadata": {},
|
155
|
+
"output_type": "display_data"
|
156
|
+
}
|
157
|
+
],
|
158
|
+
"source": [
|
159
|
+
"IRuby.display( Ohlc.start_entry( spx ).map{|y| IRuby.table( y.vector(5).map(&:html_attributes))})"
|
160
|
+
]
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"cell_type": "markdown",
|
164
|
+
"id": "9de8d4a5",
|
165
|
+
"metadata": {},
|
166
|
+
"source": [
|
167
|
+
"Die Enddaten der Datenreihen Trades und Vola für den SPX in Tabellenform"
|
168
|
+
]
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"cell_type": "code",
|
172
|
+
"execution_count": 15,
|
173
|
+
"id": "0a5fa214",
|
174
|
+
"metadata": {},
|
175
|
+
"outputs": [
|
176
|
+
{
|
177
|
+
"data": {
|
178
|
+
"text/html": [
|
179
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>2</td><td>0</td><td>#398:24</td><td>2023-11-07</td><td>4366.21</td><td>4386.26</td><td>4355.41</td><td>4378.38</td><td>21528</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:24</td><td>2023-11-06</td><td>4364.27</td><td>4372.21</td><td>4347.53</td><td>4365.98</td><td>21611</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:24</td><td>2023-11-03</td><td>4334.23</td><td>4373.62</td><td>4334.23</td><td>4358.34</td><td>21667</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:24</td><td>2023-11-02</td><td>4268.26</td><td>4319.72</td><td>4268.26</td><td>4317.78</td><td>21607</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#386:24</td><td>2023-11-01</td><td>4201.27</td><td>4245.64</td><td>4197.74</td><td>4237.86</td><td>22064</td></tr></table>"
|
180
|
+
],
|
181
|
+
"text/plain": [
|
182
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>2</td><td>0</td><td>#398:24</td><td>2023-11-07</td><td>4366.21</td><td>4386.26</td><td>4355.41</td><td>4378.38</td><td>21528</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:24</td><td>2023-11-06</td><td>4364.27</td><td>4372.21</td><td>4347.53</td><td>4365.98</td><td>21611</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:24</td><td>2023-11-03</td><td>4334.23</td><td>4373.62</td><td>4334.23</td><td>4358.34</td><td>21667</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:24</td><td>2023-11-02</td><td>4268.26</td><td>4319.72</td><td>4268.26</td><td>4317.78</td><td>21607</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#386:24</td><td>2023-11-01</td><td>4201.27</td><td>4245.64</td><td>4197.74</td><td>4237.86</td><td>22064</td></tr></table>\""
|
183
|
+
]
|
184
|
+
},
|
185
|
+
"metadata": {},
|
186
|
+
"output_type": "display_data"
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"data": {
|
190
|
+
"text/html": [
|
191
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>2</td><td>0</td><td>#422:24</td><td>2023-11-07</td><td>0.12382116</td><td>0.12699606</td><td>0.12223371</td><td>0.12223371</td><td>1</td><td>0.12710718</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#419:24</td><td>2023-11-06</td><td>0.12540861</td><td>0.12858351</td><td>0.12382116</td><td>0.12540861</td><td>1</td><td>0.12855176</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:24</td><td>2023-11-03</td><td>0.13334587</td><td>0.13334587</td><td>0.12540861</td><td>0.12699606</td><td>1</td><td>0.13299663</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:24</td><td>2023-11-02</td><td>0.14763292</td><td>0.14763292</td><td>0.13493332</td><td>0.13493332</td><td>1</td><td>0.14722019</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:24</td><td>2023-11-01</td><td>0.15874508</td><td>0.15874508</td><td>0.14604547</td><td>0.14604547</td><td>1</td><td>0.15812597</td></tr></table>"
|
192
|
+
],
|
193
|
+
"text/plain": [
|
194
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>2</td><td>0</td><td>#422:24</td><td>2023-11-07</td><td>0.12382116</td><td>0.12699606</td><td>0.12223371</td><td>0.12223371</td><td>1</td><td>0.12710718</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#419:24</td><td>2023-11-06</td><td>0.12540861</td><td>0.12858351</td><td>0.12382116</td><td>0.12540861</td><td>1</td><td>0.12855176</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:24</td><td>2023-11-03</td><td>0.13334587</td><td>0.13334587</td><td>0.12540861</td><td>0.12699606</td><td>1</td><td>0.13299663</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:24</td><td>2023-11-02</td><td>0.14763292</td><td>0.14763292</td><td>0.13493332</td><td>0.13493332</td><td>1</td><td>0.14722019</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:24</td><td>2023-11-01</td><td>0.15874508</td><td>0.15874508</td><td>0.14604547</td><td>0.14604547</td><td>1</td><td>0.15812597</td></tr></table>\""
|
195
|
+
]
|
196
|
+
},
|
197
|
+
"metadata": {},
|
198
|
+
"output_type": "display_data"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"data": {},
|
202
|
+
"metadata": {},
|
203
|
+
"output_type": "display_data"
|
204
|
+
}
|
205
|
+
],
|
206
|
+
"source": [
|
207
|
+
"IRuby.display( Ohlc.last_entry( spx ).map{|y| IRuby.table( y.vector(-5).map(&:html_attributes))})"
|
208
|
+
]
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"cell_type": "code",
|
212
|
+
"execution_count": null,
|
213
|
+
"id": "99bf460d",
|
214
|
+
"metadata": {},
|
215
|
+
"outputs": [],
|
216
|
+
"source": []
|
217
|
+
},
|
218
|
+
{
|
219
|
+
"cell_type": "code",
|
220
|
+
"execution_count": null,
|
221
|
+
"id": "4465d3b4",
|
222
|
+
"metadata": {},
|
223
|
+
"outputs": [],
|
224
|
+
"source": []
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"cell_type": "code",
|
228
|
+
"execution_count": null,
|
229
|
+
"id": "2269968c",
|
230
|
+
"metadata": {},
|
231
|
+
"outputs": [],
|
232
|
+
"source": []
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"cell_type": "code",
|
236
|
+
"execution_count": null,
|
237
|
+
"id": "96f15d3c",
|
238
|
+
"metadata": {},
|
239
|
+
"outputs": [],
|
240
|
+
"source": []
|
241
|
+
}
|
242
|
+
],
|
243
|
+
"metadata": {
|
244
|
+
"kernelspec": {
|
245
|
+
"display_name": "Ruby 3.2.0",
|
246
|
+
"language": "ruby",
|
247
|
+
"name": "ruby"
|
248
|
+
},
|
249
|
+
"language_info": {
|
250
|
+
"file_extension": ".rb",
|
251
|
+
"mimetype": "application/x-ruby",
|
252
|
+
"name": "ruby",
|
253
|
+
"version": "3.2.0"
|
254
|
+
}
|
255
|
+
},
|
256
|
+
"nbformat": 4,
|
257
|
+
"nbformat_minor": 5
|
258
|
+
}
|
@@ -0,0 +1,203 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": 1,
|
6
|
+
"id": "24212c68",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [
|
9
|
+
{
|
10
|
+
"data": {
|
11
|
+
"text/html": [
|
12
|
+
"<h2>Arcade Stock Database </h2>"
|
13
|
+
],
|
14
|
+
"text/plain": [
|
15
|
+
"\"<h2>Arcade Stock Database </h2>\""
|
16
|
+
]
|
17
|
+
},
|
18
|
+
"metadata": {},
|
19
|
+
"output_type": "display_data"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"data": {
|
23
|
+
"text/html": [
|
24
|
+
"<h3>Production Environment </h3>"
|
25
|
+
],
|
26
|
+
"text/plain": [
|
27
|
+
"\"<h3>Production Environment </h3>\""
|
28
|
+
]
|
29
|
+
},
|
30
|
+
"metadata": {},
|
31
|
+
"output_type": "display_data"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"data": {
|
35
|
+
"text/plain": [
|
36
|
+
"true"
|
37
|
+
]
|
38
|
+
},
|
39
|
+
"execution_count": 1,
|
40
|
+
"metadata": {},
|
41
|
+
"output_type": "execute_result"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"source": [
|
45
|
+
"require_relative 'db-console'\n"
|
46
|
+
]
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"cell_type": "code",
|
50
|
+
"execution_count": 3,
|
51
|
+
"id": "8e3fa151",
|
52
|
+
"metadata": {},
|
53
|
+
"outputs": [
|
54
|
+
{
|
55
|
+
"data": {
|
56
|
+
"text/html": [
|
57
|
+
"<b style=\"color: \">Index</b>[#313:0]:{0->}{->0}, SPX USD () "
|
58
|
+
],
|
59
|
+
"text/plain": [
|
60
|
+
"\"<b style=\\\"color: \\\">Index</b>[#313:0]:{0->}{->0}, SPX USD () \""
|
61
|
+
]
|
62
|
+
},
|
63
|
+
"metadata": {},
|
64
|
+
"output_type": "display_data"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"data": {},
|
68
|
+
"execution_count": 3,
|
69
|
+
"metadata": {},
|
70
|
+
"output_type": "execute_result"
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"source": [
|
74
|
+
"spx = Contract.first\n"
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"cell_type": "markdown",
|
79
|
+
"id": "74a3fca1",
|
80
|
+
"metadata": {},
|
81
|
+
"source": [
|
82
|
+
"Die Datenreihen beginnen 2004 bw. 2006"
|
83
|
+
]
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"cell_type": "code",
|
87
|
+
"execution_count": 5,
|
88
|
+
"id": "717b6837",
|
89
|
+
"metadata": {},
|
90
|
+
"outputs": [
|
91
|
+
{
|
92
|
+
"data": {
|
93
|
+
"text/html": [
|
94
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>1</td><td>1</td><td>#386:2057</td><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:2058</td><td>2004-03-05</td><td>1151.0</td><td>1163.23</td><td>1148.75</td><td>1157.34</td><td>1806</td></tr></table>"
|
95
|
+
],
|
96
|
+
"text/plain": [
|
97
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>1</td><td>1</td><td>#386:2057</td><td>2004-03-04</td><td>1150.61</td><td>1154.98</td><td>1149.8</td><td>1154.57</td><td>692</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:2058</td><td>2004-03-05</td><td>1151.0</td><td>1163.23</td><td>1148.75</td><td>1157.34</td><td>1806</td></tr></table>\""
|
98
|
+
]
|
99
|
+
},
|
100
|
+
"metadata": {},
|
101
|
+
"output_type": "display_data"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"data": {
|
105
|
+
"text/html": [
|
106
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>1</td><td>1</td><td>#404:549</td><td>2006-01-06</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>1</td><td>0.15874508</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#407:549</td><td>2006-01-09</td><td>0.10477175</td><td>0.1063592</td><td>0.10159685</td><td>0.1031843</td><td>1</td><td>0.10620046</td></tr></table>"
|
107
|
+
],
|
108
|
+
"text/plain": [
|
109
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>1</td><td>1</td><td>#404:549</td><td>2006-01-06</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>0.15874508</td><td>1</td><td>0.15874508</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#407:549</td><td>2006-01-09</td><td>0.10477175</td><td>0.1063592</td><td>0.10159685</td><td>0.1031843</td><td>1</td><td>0.10620046</td></tr></table>\""
|
110
|
+
]
|
111
|
+
},
|
112
|
+
"metadata": {},
|
113
|
+
"output_type": "display_data"
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"data": {},
|
117
|
+
"execution_count": 5,
|
118
|
+
"metadata": {},
|
119
|
+
"output_type": "execute_result"
|
120
|
+
}
|
121
|
+
],
|
122
|
+
"source": [
|
123
|
+
"Ohlc.start_entry( spx ).vector(2)"
|
124
|
+
]
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"cell_type": "markdown",
|
128
|
+
"id": "e7d23427",
|
129
|
+
"metadata": {},
|
130
|
+
"source": [
|
131
|
+
"Die Anfangsdaten der Datenreihen Trades und Vola für den SPX in Tabellenform"
|
132
|
+
]
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"cell_type": "markdown",
|
136
|
+
"id": "c3dea938",
|
137
|
+
"metadata": {},
|
138
|
+
"source": [
|
139
|
+
"Die aktuellen Enddaten der Datenreihen Trades und Vola für den SPX in Tabellenform"
|
140
|
+
]
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"cell_type": "code",
|
144
|
+
"execution_count": 6,
|
145
|
+
"id": "a91fb843",
|
146
|
+
"metadata": {
|
147
|
+
"scrolled": false
|
148
|
+
},
|
149
|
+
"outputs": [
|
150
|
+
{
|
151
|
+
"data": {
|
152
|
+
"text/html": [
|
153
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>2</td><td>0</td><td>#398:24</td><td>2023-11-07</td><td>4366.21</td><td>4386.26</td><td>4355.41</td><td>4378.38</td><td>21528</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:24</td><td>2023-11-06</td><td>4364.27</td><td>4372.21</td><td>4347.53</td><td>4365.98</td><td>21611</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:24</td><td>2023-11-03</td><td>4334.23</td><td>4373.62</td><td>4334.23</td><td>4358.34</td><td>21667</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:24</td><td>2023-11-02</td><td>4268.26</td><td>4319.72</td><td>4268.26</td><td>4317.78</td><td>21607</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#386:24</td><td>2023-11-01</td><td>4201.27</td><td>4245.64</td><td>4197.74</td><td>4237.86</td><td>22064</td></tr></table>"
|
154
|
+
],
|
155
|
+
"text/plain": [
|
156
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>trades</th></tr><tr><td>Trades</td><td>2</td><td>0</td><td>#398:24</td><td>2023-11-07</td><td>4366.21</td><td>4386.26</td><td>4355.41</td><td>4378.38</td><td>21528</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#395:24</td><td>2023-11-06</td><td>4364.27</td><td>4372.21</td><td>4347.53</td><td>4365.98</td><td>21611</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#392:24</td><td>2023-11-03</td><td>4334.23</td><td>4373.62</td><td>4334.23</td><td>4358.34</td><td>21667</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#389:24</td><td>2023-11-02</td><td>4268.26</td><td>4319.72</td><td>4268.26</td><td>4317.78</td><td>21607</td></tr><tr><td>Trades</td><td>2</td><td>1</td><td>#386:24</td><td>2023-11-01</td><td>4201.27</td><td>4245.64</td><td>4197.74</td><td>4237.86</td><td>22064</td></tr></table>\""
|
157
|
+
]
|
158
|
+
},
|
159
|
+
"metadata": {},
|
160
|
+
"output_type": "display_data"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"data": {
|
164
|
+
"text/html": [
|
165
|
+
"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>2</td><td>0</td><td>#422:24</td><td>2023-11-07</td><td>0.12382116</td><td>0.12699606</td><td>0.12223371</td><td>0.12223371</td><td>1</td><td>0.12710718</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#419:24</td><td>2023-11-06</td><td>0.12540861</td><td>0.12858351</td><td>0.12382116</td><td>0.12540861</td><td>1</td><td>0.12855176</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:24</td><td>2023-11-03</td><td>0.13334587</td><td>0.13334587</td><td>0.12540861</td><td>0.12699606</td><td>1</td><td>0.13299663</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:24</td><td>2023-11-02</td><td>0.14763292</td><td>0.14763292</td><td>0.13493332</td><td>0.13493332</td><td>1</td><td>0.14722019</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:24</td><td>2023-11-01</td><td>0.15874508</td><td>0.15874508</td><td>0.14604547</td><td>0.14604547</td><td>1</td><td>0.15812597</td></tr></table>"
|
166
|
+
],
|
167
|
+
"text/plain": [
|
168
|
+
"\"<table><tr><th>CLASS</th><th>IN</th><th>OUT</th><th>RID</th><th>date</th><th>open</th><th>high</th><th>low</th><th>close</th><th>volume</th><th>wap</th></tr><tr><td>Vola</td><td>2</td><td>0</td><td>#422:24</td><td>2023-11-07</td><td>0.12382116</td><td>0.12699606</td><td>0.12223371</td><td>0.12223371</td><td>1</td><td>0.12710718</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#419:24</td><td>2023-11-06</td><td>0.12540861</td><td>0.12858351</td><td>0.12382116</td><td>0.12540861</td><td>1</td><td>0.12855176</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#416:24</td><td>2023-11-03</td><td>0.13334587</td><td>0.13334587</td><td>0.12540861</td><td>0.12699606</td><td>1</td><td>0.13299663</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#413:24</td><td>2023-11-02</td><td>0.14763292</td><td>0.14763292</td><td>0.13493332</td><td>0.13493332</td><td>1</td><td>0.14722019</td></tr><tr><td>Vola</td><td>2</td><td>1</td><td>#410:24</td><td>2023-11-01</td><td>0.15874508</td><td>0.15874508</td><td>0.14604547</td><td>0.14604547</td><td>1</td><td>0.15812597</td></tr></table>\""
|
169
|
+
]
|
170
|
+
},
|
171
|
+
"metadata": {},
|
172
|
+
"output_type": "display_data"
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"data": {},
|
176
|
+
"execution_count": 6,
|
177
|
+
"metadata": {},
|
178
|
+
"output_type": "execute_result"
|
179
|
+
}
|
180
|
+
],
|
181
|
+
"source": [
|
182
|
+
"Ohlc.last_entry( spx ).vector(-5)\n",
|
183
|
+
"# Langform\n",
|
184
|
+
"# IRuby.display( Ohlc.last_entry( spx ).map{|y| IRuby.table( y.vector(-5).map(&:html_attributes))})"
|
185
|
+
]
|
186
|
+
}
|
187
|
+
],
|
188
|
+
"metadata": {
|
189
|
+
"kernelspec": {
|
190
|
+
"display_name": "Ruby 3.2.0",
|
191
|
+
"language": "ruby",
|
192
|
+
"name": "ruby"
|
193
|
+
},
|
194
|
+
"language_info": {
|
195
|
+
"file_extension": ".rb",
|
196
|
+
"mimetype": "application/x-ruby",
|
197
|
+
"name": "ruby",
|
198
|
+
"version": "3.2.0"
|
199
|
+
}
|
200
|
+
},
|
201
|
+
"nbformat": 4,
|
202
|
+
"nbformat_minor": 5
|
203
|
+
}
|
data/iruby/db-console.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# REQUIREMENTS
|
2
|
+
# Install iruby and include the gem in the Gemfile
|
3
|
+
#
|
4
|
+
# For visualisations
|
5
|
+
# include vega in the Gemfile
|
6
|
+
#
|
7
|
+
# require this file at the top of each notebook
|
8
|
+
|
9
|
+
require 'bundler/setup'
|
10
|
+
require 'arcade'
|
11
|
+
require 'dry/struct'
|
12
|
+
require 'iruby'
|
13
|
+
require 'vega'
|
14
|
+
module Types
|
15
|
+
include Dry.Types()
|
16
|
+
end
|
17
|
+
class Array
|
18
|
+
|
19
|
+
def method_missing(method, *key)
|
20
|
+
unless method == :to_hash || method == :to_str #|| method == :to_int
|
21
|
+
return self.map{|x| x.public_send(method, *key)}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#def to_html
|
26
|
+
# map{|y| IRuby.display IRuby.table y.html_attributes }
|
27
|
+
#end
|
28
|
+
|
29
|
+
|
30
|
+
def to_html
|
31
|
+
if first.respond_to? :html_attributes
|
32
|
+
title = first.html_attributes.keys
|
33
|
+
body = map{|y| y.html_attributes.values }
|
34
|
+
# map{|y| IRuby.display IRuby.table html_attributes } # alternative approach
|
35
|
+
IRuby.display IRuby.table [ title ] + body
|
36
|
+
|
37
|
+
else
|
38
|
+
each{|y| IRuby.display IRuby.html y }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
def inspect
|
45
|
+
end
|
46
|
+
|
47
|
+
end # Array
|
48
|
+
|
49
|
+
module Arcade
|
50
|
+
class Base
|
51
|
+
def inspect
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
include Arcade
|
57
|
+
require 'irb'
|
58
|
+
|
59
|
+
begin
|
60
|
+
environment ||= :development
|
61
|
+
IRuby.display IRuby.html "<h2>Arcade Stock Database </h2>"
|
62
|
+
IRuby.display IRuby.html "<h3>#{environment.to_s.capitalize} Environment </h3>"
|
63
|
+
Arcade::Init.connect environment
|
64
|
+
DB = Stock::Init.db
|
65
|
+
#require 'pry'
|
66
|
+
require 'irb'
|
67
|
+
ARGV.clear
|
68
|
+
|
69
|
+
rescue Dry::Struct::Error, Dry::Types::MissingKeyError => e
|
70
|
+
ARGV.clear
|
71
|
+
puts "Maintance Modus: Please repair the Database"
|
72
|
+
puts e.inspect
|
73
|
+
end
|