forked from wobine/blackboard101
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BitcoinPriceModel-Alpha.html
232 lines (203 loc) · 14 KB
/
BitcoinPriceModel-Alpha.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<html ng-app="nameApp">
<head>
<meta charset="utf-8">
<title>wbn - Bitcoin Price Speculator Model - Alpha Version</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://code.angularjs.org/1.2.4/angular.js"></script>
<script src="http://code.angularjs.org/1.2.4/angular-animate.js"></script>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css-wbn-BitcoinPriceSpeculator.css">
<link rel="icon" type="image/png" href="http://www.worldbitcoinnetwork.com/wobinefiles/favicon.ico">
<script> //all calculation takes place here
var nameApp = angular.module('nameApp', ['ngAnimate']);
nameApp.controller('NameCtrl', function ($scope, $http){
$http.get('https://blockchain.info/q/totalbc').success(function(data) {
$scope.numBTCs = data/100e6});
$scope.entered = {market:'Market',title:'Market',min:0,max:100,value:1,isMerch:0,type:'%',scalar:1};
$scope.enteredVar = {market:'Variable',title:'Variable',min:0,max:20,value:1,isMerch:0,type:'%',scalar:-1};
$http.get('https://blockchain.info/q/24hrprice').success(function(data) {
$scope.bitPrice = data;
});
$scope.NumberWithCommas = function(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); };
$scope.setMarksToZero = function(){
for (i = 0; i < $scope.dMarket.length; i++) {
$scope.dMarket[i].value = 0;
}
}
$scope.setVarsToZero = function(){
for (i = 0; i < $scope.dVar.length; i++) {
$scope.dVar[i].value = 0;
}
}
$scope.setTotBTCsToCurrent = function(){
$scope.dVar[0].value = $scope.numBTCs/210000;
$scope.dVar[0].num = ($scope.dVar[0].max * $scope.dVar[0].value/100).toFixed(2);
}
$scope.determineMe = function(indexx){if(indexx==0){$scope.dVar[0].num = $scope.dVar[0].num.toFixed(2)};
return $scope.dVar[indexx].num;
}
$scope.removeEntry = function(indexNum) {
$scope.dMarket.splice(indexNum, 1);
};
$scope.removeEntryVar = function(indexNum) {
if (indexNum>1){
$scope.dVar.splice(indexNum, 1);
}
};
$scope.addMarket = function(){
$scope.newIndex = $scope.dMarket.length + 1;
$scope.entered.scalar = $scope.entered.scalar * 1e9;
$scope.dMarket.push($scope.entered);
$scope.entered = {market:'Market',title:'AnotherMarket',min:0,max:100,value:1,isMerch:0,type:'%',scalar:1};
}
$scope.addVariable =function(){
$scope.newIndex = $scope.dVar.length + 1;
$scope.dVar.push($scope.enteredVar);
$scope.enteredVar = {market:'Variable',title:'Variable',min:0,max:20,value:1,isMerch:0,type:'%',scalar:-1};
}
$scope.dMarket = [
{"name":"Gold","min":0,"max":20,"value":0.25,"num":0,"title": "Gold / Store of Value","isMerch":0,"type":"%", "scalar":8e12},
{"name":"E-MerchAdopt","min":0,"max":50,"value":0.1,"title": "E-Commerce","isMerch":1,"type":"%", "scalar":1e12},
{"name":"MoneySupply","min":0,"max":20,"value":0.25,"title": "Global Money Supply","isMerch":0,"type":"%", "scalar":4e12},
{"name":"BlackMarket","min":0,"max":50,"value":0.5,"title": "Black Market","isMerch":1,"type":"%", "scalar":65e10},
{"name":"Remittances","min":0,"max":100,"value":0.2,"title": "Remittances","isMerch":1,"type":"%", "scalar":5e11}
];
$scope.dVar = [
{"name":"TotalBTC","min":0,"max":21,"value":61,"title": "Mined Bitcoins (Max 21 Million)","isMerch":0,"type":" Million", "scalar":1e6},
{"name":"LostBTC","min":0,"max":12,"value":8,"title": "Lost Bitcoins (Max 12 Million)","isMerch":0,"type":" Million", "scalar":1e6},
{"name":"Risk","min":0,"max":100,"value":10,"title": "Risk of Failure (51% Attack...etc)","isMerch":0,"type":"% Failure", "scalar":-1},
{"name":"Velocity","min":0,"max":"100","value":20,"title": "Velocity (Faster Lowers Price)","isMerch":1,"type":"% Max Vel.", "scalar":-1},
{"name":"Downward","min":0,"max":20,"value":28,"title": "Merchant Pressure (Max 20%)","isMerch":1,"type":"% Pressure", "scalar":-1},
{"name":"Speculation","min":0,"max":20,"value":35,"title": "Speculation Fever (Max 20%)","isMerch":0,"type":"% Hype", "scalar":1},
{"name":"Regulation","min":0,"max":40,"value":7,"title": "Regulation Pressure (Max 40%)","isMerch":0,"type":"% Reg.", "scalar":-1},
{"name":"Volatility","min":0,"max":40,"value":20,"title": "Volatility Fears (Max 40%)","isMerch":0,"type":"% Fears", "scalar":-1},
];
$scope.CalculatePrice = function() {
$scope.NumCoins = $scope.dVar[0].value * $scope.dVar[0].max /100
$scope.LostCoins = $scope.dVar[1].value * $scope.dVar[1].max /100
$scope.TotNumCoins = ($scope.NumCoins - $scope.LostCoins) * $scope.dVar[0].scalar;
$scope.AllVariables = 0;
$scope.MerchVariables = 0;
for (i = 2; i < $scope.dVar.length; i++) {
if ($scope.dVar[i].scalar < 0){
$scope.Unit = ($scope.dVar[i].value * $scope.dVar[i].max / 10000);
}
else {$scope.Unit = -($scope.dVar[i].value * $scope.dVar[i].max / 10000);
}
if ($scope.dVar[i].isMerch == 0) {
$scope.AllVariables += $scope.Unit;
}
else {$scope.MerchVariables += $scope.Unit;
if($scope.MerchVariables>1){
$scope.MerchVariables = 1;
}
}
}
$scope.AllMarkets = 0;
$scope.AllMarkets2 = 0;
for (i = 0; i < $scope.dMarket.length; i++) {
$scope.Unit = ($scope.dMarket[i].value * $scope.dMarket[i].max / 10000) * ($scope.dMarket[i].scalar);
$scope.Unit2 = $scope.Unit
if ($scope.dMarket[i].isMerch == 1) {
$scope.Unit = $scope.Unit * (1-$scope.MerchVariables);
}
$scope.AllMarkets += $scope.Unit;
$scope.AllMarkets2 += $scope.Unit2;
}
if((1-$scope.AllVariables) > 0) {
$scope.ZeePrice = $scope.AllMarkets * (1-$scope.AllVariables)}
else {$scope.ZeePrice = $scope.AllMarkets * 0.0000001}; //just a really low number
if($scope.TotNumCoins > 0) {$scope.ZeePriceFormat = "$ " + $scope.NumberWithCommas(($scope.ZeePrice/$scope.TotNumCoins).toFixed(2))}
else {$scope.ZeePriceFormat = 'No Bitcoins Available'};
};
});
</script>
</head>
<body ng-controller="NameCtrl">
<div id="Top of Page" style="position:fixed; z-index:4;">
<div style="font-size:24px; background:black; padding:18px; padding-left:24px; font-weight:bold; padding-bottom:12px; color:#aaa">
WBN Bitcoin Price Model<br/><p style="font-size:11px">Mission Impossible: Modeling a market price. This is a Simple Linear Model - Alpha Version - For Education Purposes Only</p></div>
<div style="font-size:22px; background:#f9f9f9; padding-left:22px; padding-right:22px; margin-bottom:-66px; box-shadow: 0px 6px 4px #888888;">
<div style="padding-top:12px">
<p>Total Bitcoins: <strong id="outtyjson">{{(numBTCs/1e6) | number:2}}</strong> Million              Current Price: $ <strong id="utterJson">{{bitPrice}}</strong><span style="float:right">Market Cap: $ <strong id="MarkCap">{{(numBTCs * bitPrice/1e9) | number:2}}</strong> Billion</span></p>
<div class="strongguy"><h1>{{CalculatePrice()}}{{ZeePriceFormat}}<span ng-if="TotNumCoins<0" style="font-size:16px; color:black"><br/>Mined bitcoins are less than lost bitcoins</span></h1><p style="font-size:14px !important">WBN Model Price - Bitcoin</p></div>
<hr></div>
</div>
</div>
<div id="Sliders" style="position:absolute; margin-top:258px;">
<div style="width:1020px; padding:22px;">
<br/>
<div id="Key Markets" class="box4">Key Markets Where Bitcoin Can Grow    
<button class="zerobuttons" ng-click="setMarksToZero()" ng-init="count=0">Zero All</button>
<span style="float:right">Total Market Size: ${{(AllMarkets2/1e9) | number:2}} billion</span></div>
<table style="margin-top:-20px">
<tr ng-repeat="slider in dMarket" class="box{{$index%2}}">
<td width="322px" style="padding-bottom:3px; font-size:15px">{{slider.title}}<span style="float:right; font-size:12px; color:#bbb">Market: ${{NumberWithCommas(slider.scalar/1e9)}} Billion</span></td>
<td class="tinytown" >{{slider.min}}</td>
<td width="400px">
<input type="range" name="volume" id={{slider.name}} min={{slider.min}} max="100" value="{{slider.num = slider.max * slider.value / 100}}" ng-model="slider.value" ng-change="CalculatePrice()" /></td>
<td class="tinytown" >max {{slider.max}}{{slider.type}}</td>
<td width="92px"><strong>   {{slider.num}}</strong><span style="font-size:12px; color:#aaa"> {{slider.type}}</span></td>
<td class="tinytown">${{((slider.value * slider.max / 10000) * (slider.scalar)/1e9) | number:0}} Billion</td>
<td><button class="removebuttons" ng-click="removeEntry($index)">remove</button></td>
<br />
</tr>
</table>
<div style="color:gray">
<form class="box4" ng-submit="addMarket()">
Add Market<span style="word-spacing:100px;"> </span> Market Title  <input style="background:#999; border-color:#ddd; text-align:center; color:white" type="text" size="21" ng-model="entered.title">
<!--   Max %:<input type="number" min="0" max="100" ng-model="entered.max" required>
   Merchant Based?<input type="number" min="0" max="100" ng-model="entered.isMerch" required>-->
       Market Size (Billions)   $ <input style="background:#999; border-color:#ddd; text-align:center; color:white" type="number" min="0" max="30000" ng-model="entered.scalar" required>
<input class="zerobuttons" style="float:right" type="submit" value="add new market">
</form>
<div style="padding-left:6px; font-size:12px; color:#bbb; margin-top:-9px">Other big markets: Hedge Funds $2.5 trillion, $15 trillion offshore deposits, $2 trillion electronic payments, $2+ trillion annual brick & mortar merchant market, etc.</div>
</div>
<br/>
<div class="box4">Important Variables    
<button class="zerobuttons" ng-click="setVarsToZero()" ng-init="count=0">Zero All</button>
<span style="float:right"><button class="zerobuttons" ng-click="setTotBTCsToCurrent()" ng-init="count=0">Update BTCs</button>    Total Coins (Mined-Lost): {{ TotNumCoins/1e6 | number:2}} million</span></div>
<table style="margin-top:-20px">
<tr ng-repeat="slider in dVar" class="box{{$index%2}}">
<td width="322px" style="margin-top:22px; padding-bottom:4px; font-size:15px">{{slider.title}}</td>
<td class="tinytown" >{{slider.min}}</td>
<td width="400px"><input type="range" name="volume" id={{slider.name}} min={{slider.min}} max="100" value="{{slider.num = slider.max * slider.value / 100}}" ng-model="slider.value" ng-change="CalculatePrice()" /></td>
<td class="tinytown" >max {{slider.max}}</td>
<td width="128px"><strong>   {{determineMe($index)}}</strong><span style="font-size:12px; color:#aaa"> {{slider.type}}</span></td>
<td><button ng-if="($index>1)" class="removebuttons" ng-click="removeEntryVar($index)">remove</button></td>
<br />
</tr>
</table>
<div style="color:gray">
<form class="box4" ng-submit="addVariable()">
Add Variable<span style="word-spacing:100px;"> </span> Variable Title  <input style="background:#999; border-color:#ddd; text-align:center; color:white" type="text" size="21" ng-model="enteredVar.title">
       Max Effect (Percentage)   %
<input style="background:#999; border-color:#ddd; text-align:center; color:white" type="number" min="0" max="100" ng-model="enteredVar.max" required>
<input class="zerobuttons" style="float:right" type="submit" value="add new variable">
</form>
</div>
<div style="color:#cccccc; padding-left:6px; font-size:11px">
<br/>
Things to consider/include for an improved model: <br/>Linearity is often the worst way to model natural events. Things like Velocity and Number of Coins should be modeled with logarithms. <br/>Other important things to consider: Bitcoin demand as might be conceived via Metcalfe's law; <br/> Volume; Loans; Trading Frequency; Improved wallets; 51% Attack Protection; Investment in Bitcoin Companies; Taxation; Use in Smart Contracts; <br/> Improvements in Put and Buy Options; Counting accounts of Wallets etc; etc. Email us at worldbitcoinnetwork@gmail.com <br/>All of them can be added easily <a href="https://github.com/wobine/blackboard101/blob/master/BitcoinPriceModel-Alpha.html" target="_blank">in the code</a> by adding new lines in the json scopes.
</div>
</div>
<div id="Bottom Of Page" style="font-size:11px; text-align:center; background:black; padding:22px; padding-left:22px; color:#909090; line-height:32px"><a href="https://www.youtube.com/channel/UCgo7FCCPuylVk4luP3JAgVw" target="_blank"><img src="http://www.worldbitcoinnetwork.com/wobinefiles/images/tinylogo.png" height="24px"></a><script src="http://coinwidget.com/widget/coin.js"></script>
<script>
CoinWidgetCom.go({
wallet_address: "1javsf8GNsudLaDue3dXkKzjtGM8NagQe"
, currency: "bitcoin"
, counter: "hide"
, alignment: "bl"
, qrcode: true
, auto_show: false
, lbl_button: "Donate"
, lbl_address: "My Bitcoin Address:"
, lbl_count: "donations"
, lbl_amount: "BTC"
});
</script><br/>A WBN Production - <a href="https://www.youtube.com/channel/UCgo7FCCPuylVk4luP3JAgVw" target="_blank"> World Bitcoin Network 2014 </a> - <a href="https://www.youtube.com/watch?v=g2nXgK34HIM" target="_blank">Link to original video</a></div>
</div>
<script src="js/bootstrap.js"></script>
</body>
</html>