From fe4f809298e63734e450dadb045b5af6405538b4 Mon Sep 17 00:00:00 2001
From: Adam Soltys
Date: Thu, 29 Nov 2012 04:21:30 -0800
Subject: Post exchange rates
---
app.coffee | 22 +++++++++++++---------
public/css/index.less | 2 +-
public/js/calculator.coffee | 2 +-
public/js/index.coffee | 24 ++++++++++++++++++++++++
views/about.html | 7 +++----
views/exchangers.html | 2 +-
views/join.html | 11 +++++++++++
views/layout.html | 2 +-
8 files changed, 55 insertions(+), 17 deletions(-)
create mode 100644 views/join.html
diff --git a/app.coffee b/app.coffee
index 75cdf310..46d3260f 100644
--- a/app.coffee
+++ b/app.coffee
@@ -37,13 +37,19 @@ app.use(passport.initialize())
app.use(passport.session())
app.use(app.router)
-for route in ['', 'about', 'exchangers', 'merchants']
- ((route) ->
- app.get("/#{route}", (req, res) ->
- route = 'index' if route == ''
- res.render(route, js: (-> global.js), css: (-> global.css), layout: 'layout')
+routes =
+ "/": 'index'
+ "/about": 'about'
+ "/exchangers": 'exchangers'
+ "/exchangers/new": 'join'
+ "/merchants": 'merchants'
+
+for route, view of routes
+ ((route, view) ->
+ app.get(route, (req, res) ->
+ res.render(view, js: (-> global.js), css: (-> global.css), layout: 'layout')
)
- )(route)
+ )(route, view)
app.get('/setup', (req, res) ->
res.render('setup', js: (-> global.js), css: (-> global.css))
@@ -86,9 +92,7 @@ app.get('/:user/transactions', (req, res) ->
app.get('/ticker', (req, res) ->
options =
host: 'bitcoincharts.com',
- path: '/t/depthcalc.json?symbol=' +
- req.query.symbol +
- '&type=ask&amount=1000¤cy=true'
+ path: "/t/depthcalc.json?symbol=#{req.query.symbol}&type=#{req.query.type}&amount=#{req.query.amount}¤cy=true"
require('http').get(options, (r) ->
r.setEncoding('utf-8')
diff --git a/public/css/index.less b/public/css/index.less
index 35eb9420..cc31fc1b 100644
--- a/public/css/index.less
+++ b/public/css/index.less
@@ -9,6 +9,6 @@ footer {
text-align: right;
}
-b.exchange { color: white; }
+#ask, #bid { color: white; }
div.directory img { width: 150px; height: 150px; float: left; padding-right: 20px; }
div.row-fluid td.first { text-align: right; }
diff --git a/public/js/calculator.coffee b/public/js/calculator.coffee
index 9a66167a..78e5d91c 100644
--- a/public/js/calculator.coffee
+++ b/public/js/calculator.coffee
@@ -82,7 +82,7 @@ setup = ->
fetchExchangeRate = ->
$.ajax(
- url: 'ticker?symbol=' + g.symbol,
+ url: "ticker?symbol=#{g.symbol}&type=ask&amount=1000",
cache: false,
success: (exchange) ->
if exchange?
diff --git a/public/js/index.coffee b/public/js/index.coffee
index e69de29b..7db59a66 100644
--- a/public/js/index.coffee
+++ b/public/js/index.coffee
@@ -0,0 +1,24 @@
+#= require jquery-1.8.2.min.js
+
+$(->
+ fetchExchangeRate('ask')
+ fetchExchangeRate('bid')
+)
+
+fetchExchangeRate = (type) ->
+ commission = 0.03
+ commission *= -1 if type is 'bid'
+
+ $.ajax(
+ url: "ticker?symbol=virtexCAD&type=#{type}&amount=1000",
+ cache: false,
+ success: (exchange) ->
+ if not exchange?
+ exchange = '??'
+
+ exchange = exchange - exchange * commission
+ $("##{type}").html(exchange.toFixed(2))
+ error: ->
+ $("##{type}").html('??')
+ )
+ setTimeout(fetchExchangeRate, 900000)
diff --git a/views/about.html b/views/about.html
index 44d4a982..c7f5f45a 100644
--- a/views/about.html
+++ b/views/about.html
@@ -13,7 +13,7 @@
Transactions between bitcoin addresses are
recorded in a public file and published on
- the Internet. This file, or "block chain", keeps track of what amounts are
+ the Internet. This file called the block chain keeps track of what amounts are
stored at what addresses.
@@ -123,15 +123,14 @@
You can spend them locally at one of our participating merchants or check out
this article for some other good suggestions.
The number of companies accepting bitcoins
- is growing quickly. We're working to get more stores accepting them in
+ is growing quickly and we're working to get more stores accepting them in
Vancouver. We believe it'll be in
their best interest to avoid the transaction fees
charged by the credit card companies. Transaction
fees end up getting built into the prices we pay for
goods and services across the board so we're
indirectly subsidizing the big banks and credit card
- companies whether we personally use their services
- or not.
+ companies whether or not we personally use their services.
diff --git a/views/exchangers.html b/views/exchangers.html
index 8623e4e1..e249ee48 100644
--- a/views/exchangers.html
+++ b/views/exchangers.html
@@ -13,7 +13,7 @@
- Contact one of us to let us know your availability and how much you want to spend
- We'll arrange a time to meet at a public place like a café or a bank
- - At the time of meeting, we'll look up the exchange rate above to determine how many bitcoins to send for the amount you specified
+ - At the time of meeting, we'll look up the exchange rate above to determine how many bitcoins to send for the amount specified
- You'll provide us with a bitcoin address to send to and count out the cash for us
- We'll send the bitcoins to your address using a phone or laptop
- When the transaction is confirmed, we take the cash and you keep the bitcoins!
diff --git a/views/join.html b/views/join.html
new file mode 100644
index 00000000..26f88887
--- /dev/null
+++ b/views/join.html
@@ -0,0 +1,11 @@
+Join Us
+
+
+If you're a resident of Vancouver and would like to be listed as a local exchanger here, come to our monthly meetup group and introduce yourself! We'll teach you everything you need to know and if you agree to use our posted rates and we get the sense that you'll be fair and professional then we'll happily list you on our exchangers page.
+
+
+Our Rates
+
+
+The exchange rates on this website are pegged to the current market prices at cavirtex.com and are updated every 15 minutes. Specifically, we take an average of the bid/ask prices in the order books there using a market depth of $1000 CAD.
+
diff --git a/views/layout.html b/views/layout.html
index dbac084f..184a970c 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -15,7 +15,7 @@
VanBTC
- Exchange Rate: |
+ Buy: | Sell: |
Login